Break out metric report definition get
In the same way we're doing other places.
Tested: THe last commit of the series will be tested.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I177e61dd3741f3885516a2f645a7039d274786cb
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index 54607a8..b824bcc 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -743,6 +743,30 @@
};
} // namespace telemetry
+inline void handleMetricReportDefinitionsGet(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#MetricReportDefinitionCollection."
+ "MetricReportDefinitionCollection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions";
+ asyncResp->res.jsonValue["Name"] = "Metric Definition Collection";
+ constexpr std::array<std::string_view, 1> interfaces{
+ telemetry::reportInterface};
+ collection_util::getCollectionMembers(
+ asyncResp,
+ boost::urls::url(
+ "/redfish/v1/TelemetryService/MetricReportDefinitions"),
+ interfaces, "/xyz/openbmc_project/Telemetry/Reports/TelemetryService");
+}
+
inline void
handleMetricReportGet(App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -818,28 +842,7 @@
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
.privileges(redfish::privileges::getMetricReportDefinitionCollection)
.methods(boost::beast::http::verb::get)(
- [&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
-
- asyncResp->res.jsonValue["@odata.type"] =
- "#MetricReportDefinitionCollection."
- "MetricReportDefinitionCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/TelemetryService/MetricReportDefinitions";
- asyncResp->res.jsonValue["Name"] = "Metric Definition Collection";
- constexpr std::array<std::string_view, 1> interfaces{
- telemetry::reportInterface};
- collection_util::getCollectionMembers(
- asyncResp,
- boost::urls::url(
- "/redfish/v1/TelemetryService/MetricReportDefinitions"),
- interfaces,
- "/xyz/openbmc_project/Telemetry/Reports/TelemetryService");
- });
+ std::bind_front(handleMetricReportDefinitionsGet, std::ref(app)));
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
.privileges(redfish::privileges::postMetricReportDefinitionCollection)