summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-05-24 02:34:47 +0300
committerEd Tanous <ed@tanous.net>2023-06-05 21:14:54 +0300
commit4220be3b25a3d70eb632661cae09d875e039421b (patch)
tree5e80ec8a5e3cab20d16882764a4720b401762f54
parentfc0edbe37b92a378f929c5ce3b7e817589d954ba (diff)
downloadbmcweb-4220be3b25a3d70eb632661cae09d875e039421b.tar.xz
Implement HEAD for metrics
These got missed in the initial patchset. Add them Tested: At the end of the series. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I120986fb0afc34d5e0572d2cc2e1d8ff6994ee3c
-rw-r--r--redfish-core/lib/metric_report_definition.hpp47
1 files changed, 44 insertions, 3 deletions
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index b824bccbe1..23e65f7418 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -743,7 +743,20 @@ class AddReport
};
} // namespace telemetry
-inline void handleMetricReportDefinitionsGet(
+inline void handleMetricReportDefinitionCollectionHead(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/MetricReportDefinitionCollection/MetricReportDefinitionCollection.json>; rel=describedby");
+}
+
+inline void handleMetricReportDefinitionCollectionGet(
App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
@@ -768,6 +781,20 @@ inline void handleMetricReportDefinitionsGet(
}
inline void
+ handleMetricReportHead(App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& /*id*/)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/MetricReport/MetricReport.json>; rel=describedby");
+}
+
+inline void
handleMetricReportGet(App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& id)
@@ -776,6 +803,9 @@ inline void
{
return;
}
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/MetricReport/MetricReport.json>; rel=describedby");
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, telemetry::service,
@@ -840,9 +870,14 @@ inline void handleMetricReportDelete(
inline void requestRoutesMetricReportDefinitionCollection(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
+ .privileges(redfish::privileges::headMetricReportDefinitionCollection)
+ .methods(boost::beast::http::verb::head)(std::bind_front(
+ handleMetricReportDefinitionCollectionHead, std::ref(app)));
+
+ BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
.privileges(redfish::privileges::getMetricReportDefinitionCollection)
- .methods(boost::beast::http::verb::get)(
- std::bind_front(handleMetricReportDefinitionsGet, std::ref(app)));
+ .methods(boost::beast::http::verb::get)(std::bind_front(
+ handleMetricReportDefinitionCollectionGet, std::ref(app)));
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
.privileges(redfish::privileges::postMetricReportDefinitionCollection)
@@ -895,6 +930,12 @@ inline void requestRoutesMetricReportDefinition(App& app)
BMCWEB_ROUTE(app,
"/redfish/v1/TelemetryService/MetricReportDefinitions/<str>/")
.privileges(redfish::privileges::getMetricReportDefinition)
+ .methods(boost::beast::http::verb::head)(
+ std::bind_front(handleMetricReportHead, std::ref(app)));
+
+ BMCWEB_ROUTE(app,
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/<str>/")
+ .privileges(redfish::privileges::getMetricReportDefinition)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleMetricReportGet, std::ref(app)));