blob: a10c783ed690d073efb517e4952cd966e10abace [file] [log] [blame]
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +02001#pragma once
2
Wludzik, Jozefe2362792020-10-27 17:23:55 +01003#include "report_manager.hpp"
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +00004#include "types/report_types.hpp"
Wludzik, Jozefe2362792020-10-27 17:23:55 +01005
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +02006#include <chrono>
7#include <string>
8
9class ReportParams final
10{
11 public:
Szymon Dompke32305f12022-07-05 15:37:21 +020012 ReportParams& reportId(std::string_view val)
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010013 {
Szymon Dompke32305f12022-07-05 15:37:21 +020014 reportIdProperty = val;
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010015 return *this;
16 }
17
18 const std::string& reportId() const
19 {
20 return reportIdProperty;
21 }
22
Szymon Dompke32305f12022-07-05 15:37:21 +020023 ReportParams& reportName(std::string_view val)
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020024 {
Szymon Dompke32305f12022-07-05 15:37:21 +020025 reportNameProperty = val;
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020026 return *this;
27 }
28
29 const std::string& reportName() const
30 {
31 return reportNameProperty;
32 }
33
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010034 ReportParams& reportingType(const ReportingType val)
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020035 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010036 reportingTypeProperty = val;
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020037 return *this;
38 }
39
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010040 ReportingType reportingType() const
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020041 {
42 return reportingTypeProperty;
43 }
44
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010045 ReportParams& reportActions(std::vector<ReportAction> val)
Wludzik, Jozefe2362792020-10-27 17:23:55 +010046 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010047 reportActionsProperty = std::move(val);
Wludzik, Jozefe2362792020-10-27 17:23:55 +010048 return *this;
49 }
50
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010051 std::vector<ReportAction> reportActions() const
Wludzik, Jozefe2362792020-10-27 17:23:55 +010052 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010053 return reportActionsProperty;
Wludzik, Jozefe2362792020-10-27 17:23:55 +010054 }
55
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000056 ReportParams& interval(Milliseconds val)
Wludzik, Jozefe2362792020-10-27 17:23:55 +010057 {
58 intervalProperty = val;
59 return *this;
60 }
61
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000062 Milliseconds interval() const
Wludzik, Jozefe2362792020-10-27 17:23:55 +010063 {
64 return intervalProperty;
65 }
66
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020067 ReportParams& enabled(bool val)
68 {
69 enabledProperty = val;
70 return *this;
71 }
72
73 bool enabled() const
74 {
75 return enabledProperty;
76 }
77
Szymon Dompke3eb56862021-09-20 15:32:04 +020078 ReportParams& appendLimit(uint64_t val)
79 {
80 appendLimitProperty = val;
81 return *this;
82 }
83
84 uint64_t appendLimit() const
85 {
86 return appendLimitProperty;
87 }
88
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010089 ReportParams& reportUpdates(ReportUpdates val)
Szymon Dompke3eb56862021-09-20 15:32:04 +020090 {
91 reportUpdatesProperty = val;
92 return *this;
93 }
94
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010095 ReportUpdates reportUpdates() const
Szymon Dompke3eb56862021-09-20 15:32:04 +020096 {
97 return reportUpdatesProperty;
98 }
99
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000100 ReportParams& metricParameters(std::vector<LabeledMetricParameters> val)
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100101 {
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000102 metricParametersProperty = std::move(val);
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100103 return *this;
104 }
105
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000106 const std::vector<LabeledMetricParameters>& metricParameters() const
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100107 {
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000108 return metricParametersProperty;
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100109 }
110
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +0100111 ReportParams& readings(Readings val)
112 {
113 readingsProperty = std::move(val);
114 return *this;
115 }
116
117 Readings readings() const
118 {
119 return readingsProperty;
120 }
121
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100122 private:
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100123 std::string reportIdProperty = "TestId";
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200124 std::string reportNameProperty = "TestReport";
Krzysztof Grobelny973b4bb2022-04-25 17:07:27 +0200125 ReportingType reportingTypeProperty = ReportingType::onChange;
Szymon Dompkefdb06a12022-02-11 11:04:44 +0100126 std::vector<ReportAction> reportActionsProperty = {
127 ReportAction::logToMetricReportsCollection};
Krzysztof Grobelny973b4bb2022-04-25 17:07:27 +0200128 Milliseconds intervalProperty{};
Szymon Dompke3eb56862021-09-20 15:32:04 +0200129 uint64_t appendLimitProperty = 123;
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100130 ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000131 std::vector<LabeledMetricParameters> metricParametersProperty{
132 {LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100133 {LabeledSensorInfo{"Service",
134 "/xyz/openbmc_project/sensors/power/p1",
135 "metadata1"}},
Krzysztof Grobelny60fee072022-01-13 16:25:04 +0100136 OperationType::avg,
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000137 CollectionTimeScope::point,
138 CollectionDuration(Milliseconds(0u))},
139 LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100140 {LabeledSensorInfo{"Service",
141 "/xyz/openbmc_project/sensors/power/p2",
142 "metadata2"}},
Krzysztof Grobelny60fee072022-01-13 16:25:04 +0100143 OperationType::avg,
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000144 CollectionTimeScope::point,
145 CollectionDuration(Milliseconds(0u))}}};
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200146 bool enabledProperty = true;
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +0100147 Readings readingsProperty = {};
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +0000148};