blob: 295be36ae794bc2514487f43fed1f43d5308e385 [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:
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010012 ReportParams& reportId(std::string val)
13 {
14 reportIdProperty = std::move(val);
15 return *this;
16 }
17
18 const std::string& reportId() const
19 {
20 return reportIdProperty;
21 }
22
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020023 ReportParams& reportName(std::string val)
24 {
25 reportNameProperty = std::move(val);
26 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
111 private:
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100112 std::string reportIdProperty = "TestId";
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200113 std::string reportNameProperty = "TestReport";
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100114 ReportingType reportingTypeProperty = ReportingType::onRequest;
Szymon Dompkefdb06a12022-02-11 11:04:44 +0100115 std::vector<ReportAction> reportActionsProperty = {
116 ReportAction::logToMetricReportsCollection};
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000117 Milliseconds intervalProperty = ReportManager::minInterval;
Szymon Dompke3eb56862021-09-20 15:32:04 +0200118 uint64_t appendLimitProperty = 123;
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100119 ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000120 std::vector<LabeledMetricParameters> metricParametersProperty{
121 {LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100122 {LabeledSensorInfo{"Service",
123 "/xyz/openbmc_project/sensors/power/p1",
124 "metadata1"}},
Krzysztof Grobelny60fee072022-01-13 16:25:04 +0100125 OperationType::avg,
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000126 "MetricId1",
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000127 CollectionTimeScope::point,
128 CollectionDuration(Milliseconds(0u))},
129 LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100130 {LabeledSensorInfo{"Service",
131 "/xyz/openbmc_project/sensors/power/p2",
132 "metadata2"}},
Krzysztof Grobelny60fee072022-01-13 16:25:04 +0100133 OperationType::avg,
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000134 "MetricId2",
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000135 CollectionTimeScope::point,
136 CollectionDuration(Milliseconds(0u))}}};
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200137 bool enabledProperty = true;
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +0000138};