blob: d68f3fb5fee5180176a86cf2ad09c032c0a6dd23 [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:
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
23 ReportParams& reportingType(std::string val)
24 {
25 reportingTypeProperty = std::move(val);
26 return *this;
27 }
28
29 const std::string& reportingType() const
30 {
31 return reportingTypeProperty;
32 }
33
Wludzik, Jozefe2362792020-10-27 17:23:55 +010034 ReportParams& emitReadingUpdate(bool val)
35 {
36 emitReadingUpdateProperty = val;
37 return *this;
38 }
39
40 bool emitReadingUpdate() const
41 {
42 return emitReadingUpdateProperty;
43 }
44
45 ReportParams& logToMetricReportCollection(bool val)
46 {
47 logToMetricReportCollectionProperty = val;
48 return *this;
49 }
50
51 bool logToMetricReportCollection() const
52 {
53 return logToMetricReportCollectionProperty;
54 }
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
89 ReportParams& reportUpdates(std::string val)
90 {
91 reportUpdatesProperty = val;
92 return *this;
93 }
94
95 std::string reportUpdates() const
96 {
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
111 private:
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200112 std::string reportNameProperty = "TestReport";
113 std::string reportingTypeProperty = "OnRequest";
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100114 bool emitReadingUpdateProperty = true;
115 bool logToMetricReportCollectionProperty = true;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000116 Milliseconds intervalProperty = ReportManager::minInterval;
Szymon Dompke3eb56862021-09-20 15:32:04 +0200117 uint64_t appendLimitProperty = 123;
118 std::string reportUpdatesProperty = "Overwrite";
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000119 std::vector<LabeledMetricParameters> metricParametersProperty{
120 {LabeledMetricParameters{
121 {LabeledSensorParameters{"Service",
122 "/xyz/openbmc_project/sensors/power/p1"}},
123 OperationType::single,
124 "MetricId1",
125 "Metadata1",
126 CollectionTimeScope::point,
127 CollectionDuration(Milliseconds(0u))},
128 LabeledMetricParameters{
129 {LabeledSensorParameters{"Service",
130 "/xyz/openbmc_project/sensors/power/p2"}},
131 OperationType::single,
132 "MetricId2",
133 "Metadata2",
134 CollectionTimeScope::point,
135 CollectionDuration(Milliseconds(0u))}}};
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200136 bool enabledProperty = true;
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +0000137};