blob: 19ea5195c4a16c820665e1e5abb4ac8df53bc10d [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;
115 std::vector<ReportAction> reportActionsProperty;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000116 Milliseconds intervalProperty = ReportManager::minInterval;
Szymon Dompke3eb56862021-09-20 15:32:04 +0200117 uint64_t appendLimitProperty = 123;
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100118 ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000119 std::vector<LabeledMetricParameters> metricParametersProperty{
120 {LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100121 {LabeledSensorInfo{"Service",
122 "/xyz/openbmc_project/sensors/power/p1",
123 "metadata1"}},
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000124 OperationType::single,
125 "MetricId1",
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000126 CollectionTimeScope::point,
127 CollectionDuration(Milliseconds(0u))},
128 LabeledMetricParameters{
Szymon Dompke94f71c52021-12-10 07:16:33 +0100129 {LabeledSensorInfo{"Service",
130 "/xyz/openbmc_project/sensors/power/p2",
131 "metadata2"}},
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000132 OperationType::single,
133 "MetricId2",
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000134 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};