summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redfish-core/lib/thermal_subsystem.hpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/redfish-core/lib/thermal_subsystem.hpp b/redfish-core/lib/thermal_subsystem.hpp
index 390b294206..d86e3c30db 100644
--- a/redfish-core/lib/thermal_subsystem.hpp
+++ b/redfish-core/lib/thermal_subsystem.hpp
@@ -24,6 +24,10 @@ inline void doThermalSubsystemCollection(
messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
return;
}
+
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/ThermalSubsystem/ThermalSubsystem.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.type"] =
"#ThermalSubsystem.v1_0_0.ThermalSubsystem";
asyncResp->res.jsonValue["Name"] = "Thermal Subsystem";
@@ -36,16 +40,40 @@ inline void doThermalSubsystemCollection(
asyncResp->res.jsonValue["Status"]["Health"] = "OK";
}
+inline void handleThermalSubsystemCollectionHead(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+
+ auto respHandler = [asyncResp, chassisId](
+ const std::optional<std::string>& validChassisPath) {
+ if (!validChassisPath)
+ {
+ messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/ThermalSubsystem/ThermalSubsystem.json>; rel=describedby");
+ };
+ redfish::chassis_utils::getValidChassisPath(asyncResp, chassisId,
+ std::bind_front(respHandler));
+}
+
inline void handleThermalSubsystemCollectionGet(
App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param)
+ const std::string& chassisId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- const std::string& chassisId = param;
redfish::chassis_utils::getValidChassisPath(
asyncResp, chassisId,
@@ -55,6 +83,11 @@ inline void handleThermalSubsystemCollectionGet(
inline void requestRoutesThermalSubsystem(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/")
+ .privileges(redfish::privileges::headThermalSubsystem)
+ .methods(boost::beast::http::verb::head)(std::bind_front(
+ handleThermalSubsystemCollectionHead, std::ref(app)));
+
+ BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/")
.privileges(redfish::privileges::getThermalSubsystem)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleThermalSubsystemCollectionGet, std::ref(app)));