| #include "tlbmc/redfish/routes/service_root.h" |
| |
| #include "nlohmann/json.hpp" |
| #include "tlbmc/redfish/app.h" |
| #include "tlbmc/redfish/request.h" |
| #include "tlbmc/redfish/response.h" |
| |
| namespace milotic_tlbmc::service_root { |
| |
| namespace { |
| |
| void HandleRedfish(const RedfishRequest& req, RedfishResponse& resp) { |
| resp.SetKeyInJsonBody("/v1"_json_pointer, "/redfish/v1"); |
| } |
| |
| void HandleRedfishV1(const RedfishRequest& req, RedfishResponse& resp) { |
| resp.SetKeyInJsonBody("/@odata.id", "/redfish/v1"); |
| resp.SetKeyInJsonBody("/@odata.type", "#ServiceRoot.v1_14_0.ServiceRoot"); |
| resp.SetKeyInJsonBody("/@odata.version", "4.0"); |
| resp.SetKeyInJsonBody("/RedfishVersion", "1.14.0"); |
| resp.SetKeyInJsonBody("/Name", "Root Service"); |
| resp.SetKeyInJsonBody("/Chassis/@odata.id", "/redfish/v1/Chassis"); |
| resp.SetKeyInJsonBody("/Id", "RootService"); |
| resp.SetKeyInJsonBody("/Oem/tlbmc/TlBMCService", "/redfish/tlbmc"); |
| } |
| |
| } // namespace |
| |
| void RegisterRoutes(RedfishApp& app) { |
| TLBMC_ROUTE(app, "/redfish/") |
| .methods(boost::beast::http::verb::get)(HandleRedfish); |
| |
| TLBMC_ROUTE(app, "/redfish/v1/") |
| .methods(boost::beast::http::verb::get)(HandleRedfishV1); |
| } |
| |
| } // namespace milotic_tlbmc::service_root |