Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 3 | #include "report_manager.hpp" |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 4 | #include "types/report_types.hpp" |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 5 | |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 6 | #include <chrono> |
| 7 | #include <string> |
| 8 | |
| 9 | class ReportParams final |
| 10 | { |
| 11 | public: |
| 12 | ReportParams& reportName(std::string val) |
| 13 | { |
| 14 | reportNameProperty = std::move(val); |
| 15 | return *this; |
| 16 | } |
| 17 | |
| 18 | const std::string& reportName() const |
| 19 | { |
| 20 | return reportNameProperty; |
| 21 | } |
| 22 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 23 | ReportParams& reportingType(const ReportingType val) |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 24 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 25 | reportingTypeProperty = val; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 26 | return *this; |
| 27 | } |
| 28 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 29 | ReportingType reportingType() const |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 30 | { |
| 31 | return reportingTypeProperty; |
| 32 | } |
| 33 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 34 | ReportParams& reportActions(std::vector<ReportAction> val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 35 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 36 | reportActionsProperty = std::move(val); |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 37 | return *this; |
| 38 | } |
| 39 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 40 | std::vector<ReportAction> reportActions() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 41 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 42 | return reportActionsProperty; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 43 | } |
| 44 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 45 | ReportParams& interval(Milliseconds val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 46 | { |
| 47 | intervalProperty = val; |
| 48 | return *this; |
| 49 | } |
| 50 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 51 | Milliseconds interval() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 52 | { |
| 53 | return intervalProperty; |
| 54 | } |
| 55 | |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 56 | ReportParams& enabled(bool val) |
| 57 | { |
| 58 | enabledProperty = val; |
| 59 | return *this; |
| 60 | } |
| 61 | |
| 62 | bool enabled() const |
| 63 | { |
| 64 | return enabledProperty; |
| 65 | } |
| 66 | |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 67 | ReportParams& appendLimit(uint64_t val) |
| 68 | { |
| 69 | appendLimitProperty = val; |
| 70 | return *this; |
| 71 | } |
| 72 | |
| 73 | uint64_t appendLimit() const |
| 74 | { |
| 75 | return appendLimitProperty; |
| 76 | } |
| 77 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 78 | ReportParams& reportUpdates(ReportUpdates val) |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 79 | { |
| 80 | reportUpdatesProperty = val; |
| 81 | return *this; |
| 82 | } |
| 83 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 84 | ReportUpdates reportUpdates() const |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 85 | { |
| 86 | return reportUpdatesProperty; |
| 87 | } |
| 88 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 89 | ReportParams& metricParameters(std::vector<LabeledMetricParameters> val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 90 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 91 | metricParametersProperty = std::move(val); |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 92 | return *this; |
| 93 | } |
| 94 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 95 | const std::vector<LabeledMetricParameters>& metricParameters() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 96 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 97 | return metricParametersProperty; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | private: |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 101 | std::string reportNameProperty = "TestReport"; |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 102 | ReportingType reportingTypeProperty = ReportingType::onRequest; |
| 103 | std::vector<ReportAction> reportActionsProperty; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 104 | Milliseconds intervalProperty = ReportManager::minInterval; |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 105 | uint64_t appendLimitProperty = 123; |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame^] | 106 | ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 107 | std::vector<LabeledMetricParameters> metricParametersProperty{ |
| 108 | {LabeledMetricParameters{ |
| 109 | {LabeledSensorParameters{"Service", |
| 110 | "/xyz/openbmc_project/sensors/power/p1"}}, |
| 111 | OperationType::single, |
| 112 | "MetricId1", |
| 113 | "Metadata1", |
| 114 | CollectionTimeScope::point, |
| 115 | CollectionDuration(Milliseconds(0u))}, |
| 116 | LabeledMetricParameters{ |
| 117 | {LabeledSensorParameters{"Service", |
| 118 | "/xyz/openbmc_project/sensors/power/p2"}}, |
| 119 | OperationType::single, |
| 120 | "MetricId2", |
| 121 | "Metadata2", |
| 122 | CollectionTimeScope::point, |
| 123 | CollectionDuration(Milliseconds(0u))}}}; |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 124 | bool enabledProperty = true; |
Krzysztof Grobelny | d223819 | 2020-12-02 09:27:28 +0000 | [diff] [blame] | 125 | }; |