Ed Tanous | 6c06898 | 2023-02-07 15:44:38 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "app.hpp" |
| 4 | #include "error_messages.hpp" |
| 5 | #include "http_request.hpp" |
| 6 | #include "http_response.hpp" |
| 7 | #include "query.hpp" |
| 8 | #include "registries/privilege_registry.hpp" |
| 9 | |
| 10 | #include <nlohmann/json.hpp> |
| 11 | |
| 12 | #include <functional> |
| 13 | #include <memory> |
| 14 | |
| 15 | namespace redfish |
| 16 | { |
| 17 | |
| 18 | inline void handleAggregationServiceHead( |
| 19 | App& app, const crow::Request& req, |
| 20 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| 21 | { |
| 22 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 23 | { |
| 24 | return; |
| 25 | } |
| 26 | asyncResp->res.addHeader( |
| 27 | boost::beast::http::field::link, |
| 28 | "</redfish/v1/JsonSchemas/AggregationService/AggregationService.json>; rel=describedby"); |
| 29 | } |
| 30 | |
| 31 | inline void handleAggregationServiceGet( |
| 32 | App& app, const crow::Request& req, |
| 33 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| 34 | { |
| 35 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 36 | { |
| 37 | return; |
| 38 | } |
| 39 | asyncResp->res.addHeader( |
| 40 | boost::beast::http::field::link, |
| 41 | "</redfish/v1/JsonSchemas/AggregationService/AggregationService.json>; rel=describedby"); |
| 42 | nlohmann::json& json = asyncResp->res.jsonValue; |
| 43 | json["@odata.id"] = "/redfish/v1/AggregationService"; |
| 44 | json["@odata.type"] = "#AggregationService.v1_0_1.AggregationService"; |
| 45 | json["Id"] = "AggregationService"; |
| 46 | json["Name"] = "Aggregation Service"; |
| 47 | json["Description"] = "Aggregation Service"; |
| 48 | json["ServiceEnabled"] = true; |
| 49 | } |
| 50 | |
| 51 | inline void requestAggregationServiceRoutes(App& app) |
| 52 | { |
| 53 | BMCWEB_ROUTE(app, "/redfish/v1/AggregationService/") |
| 54 | .privileges(redfish::privileges::headAggregationService) |
| 55 | .methods(boost::beast::http::verb::head)( |
| 56 | std::bind_front(handleAggregationServiceHead, std::ref(app))); |
| 57 | BMCWEB_ROUTE(app, "/redfish/v1/AggregationService/") |
| 58 | .privileges(redfish::privileges::getAggregationService) |
| 59 | .methods(boost::beast::http::verb::get)( |
| 60 | std::bind_front(handleAggregationServiceGet, std::ref(app))); |
| 61 | } |
| 62 | |
| 63 | } // namespace redfish |