xref: /openbmc/telemetry/tests/src/params/report_params.hpp (revision b4ef22e4d365bde35a7fce7950033c9271c68ce7)
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& 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 
23     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 
34     ReportParams& reportingType(const ReportingType val)
35     {
36         reportingTypeProperty = val;
37         return *this;
38     }
39 
40     ReportingType reportingType() const
41     {
42         return reportingTypeProperty;
43     }
44 
45     ReportParams& reportActions(std::vector<ReportAction> val)
46     {
47         reportActionsProperty = std::move(val);
48         return *this;
49     }
50 
51     std::vector<ReportAction> reportActions() const
52     {
53         return reportActionsProperty;
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(ReportUpdates val)
90     {
91         reportUpdatesProperty = val;
92         return *this;
93     }
94 
95     ReportUpdates 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     ReportParams& triggerIds(std::vector<std::string> val)
112     {
113         triggerIdsProperty = std::move(val);
114         return *this;
115     }
116 
117     std::vector<std::string> triggerIds() const
118     {
119         return triggerIdsProperty;
120     }
121 
122   private:
123     std::string reportIdProperty = "TestId";
124     std::string reportNameProperty = "TestReport";
125     ReportingType reportingTypeProperty = ReportingType::onRequest;
126     std::vector<ReportAction> reportActionsProperty;
127     Milliseconds intervalProperty = ReportManager::minInterval;
128     uint64_t appendLimitProperty = 123;
129     ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite;
130     std::vector<LabeledMetricParameters> metricParametersProperty{
131         {LabeledMetricParameters{
132              {LabeledSensorInfo{"Service",
133                                 "/xyz/openbmc_project/sensors/power/p1",
134                                 "metadata1"}},
135              OperationType::single,
136              "MetricId1",
137              CollectionTimeScope::point,
138              CollectionDuration(Milliseconds(0u))},
139          LabeledMetricParameters{
140              {LabeledSensorInfo{"Service",
141                                 "/xyz/openbmc_project/sensors/power/p2",
142                                 "metadata2"}},
143              OperationType::single,
144              "MetricId2",
145              CollectionTimeScope::point,
146              CollectionDuration(Milliseconds(0u))}}};
147     std::vector<std::string> triggerIdsProperty{};
148     bool enabledProperty = true;
149 };
150