xref: /openbmc/telemetry/tests/src/params/report_params.hpp (revision 3eb56865714cd591b24d2bdef83307508aa072c5)
1 #pragma once
2 
3 #include "report_manager.hpp"
4 #include "types/report_types.hpp"
5 
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 
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 
34     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 
56     ReportParams& interval(Milliseconds val)
57     {
58         intervalProperty = val;
59         return *this;
60     }
61 
62     Milliseconds interval() const
63     {
64         return intervalProperty;
65     }
66 
67     ReportParams& enabled(bool val)
68     {
69         enabledProperty = val;
70         return *this;
71     }
72 
73     bool enabled() const
74     {
75         return enabledProperty;
76     }
77 
78     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 
100     ReportParams& metricParameters(std::vector<LabeledMetricParameters> val)
101     {
102         metricParametersProperty = std::move(val);
103         return *this;
104     }
105 
106     const std::vector<LabeledMetricParameters>& metricParameters() const
107     {
108         return metricParametersProperty;
109     }
110 
111   private:
112     std::string reportNameProperty = "TestReport";
113     std::string reportingTypeProperty = "OnRequest";
114     bool emitReadingUpdateProperty = true;
115     bool logToMetricReportCollectionProperty = true;
116     Milliseconds intervalProperty = ReportManager::minInterval;
117     uint64_t appendLimitProperty = 123;
118     std::string reportUpdatesProperty = "Overwrite";
119     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))}}};
136     bool enabledProperty = true;
137 };
138