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& readings(Readings val) 112 { 113 readingsProperty = std::move(val); 114 return *this; 115 } 116 117 Readings readings() const 118 { 119 return readingsProperty; 120 } 121 122 private: 123 std::string reportIdProperty = "TestId"; 124 std::string reportNameProperty = "TestReport"; 125 ReportingType reportingTypeProperty = ReportingType::onChange; 126 std::vector<ReportAction> reportActionsProperty = { 127 ReportAction::logToMetricReportsCollection}; 128 Milliseconds intervalProperty{}; 129 uint64_t appendLimitProperty = 123; 130 ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite; 131 std::vector<LabeledMetricParameters> metricParametersProperty{ 132 {LabeledMetricParameters{ 133 {LabeledSensorInfo{"Service", 134 "/xyz/openbmc_project/sensors/power/p1", 135 "metadata1"}}, 136 OperationType::avg, 137 "MetricId1", 138 CollectionTimeScope::point, 139 CollectionDuration(Milliseconds(0u))}, 140 LabeledMetricParameters{ 141 {LabeledSensorInfo{"Service", 142 "/xyz/openbmc_project/sensors/power/p2", 143 "metadata2"}}, 144 OperationType::avg, 145 "MetricId2", 146 CollectionTimeScope::point, 147 CollectionDuration(Milliseconds(0u))}}}; 148 bool enabledProperty = true; 149 Readings readingsProperty = {}; 150 }; 151