Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 18 | #include <app.hpp> |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 19 | #include <persistent_data.hpp> |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 20 | #include <registries/privilege_registry.hpp> |
Bernard Wong | 7bffdb7 | 2019-03-20 16:17:21 +0800 | [diff] [blame] | 21 | #include <utils/systemd_utils.hpp> |
Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 22 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 23 | namespace redfish |
| 24 | { |
Ed Tanous | 3ebd75f | 2018-03-05 18:20:01 -0800 | [diff] [blame] | 25 | |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 26 | inline void |
Ed Tanous | 104f09c | 2022-01-25 09:56:04 -0800 | [diff] [blame] | 27 | handleServiceRootGet(const crow::Request& /*req*/, |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 28 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| 29 | { |
| 30 | |
| 31 | std::string uuid = persistent_data::getConfig().systemUuid; |
Shantappa Teekappanavar | 9c929be | 2021-12-16 19:02:52 -0600 | [diff] [blame] | 32 | asyncResp->res.jsonValue["@odata.type"] = |
| 33 | "#ServiceRoot.v1_11_0.ServiceRoot"; |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 34 | asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; |
| 35 | asyncResp->res.jsonValue["Id"] = "RootService"; |
| 36 | asyncResp->res.jsonValue["Name"] = "Root Service"; |
| 37 | asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; |
| 38 | asyncResp->res.jsonValue["Links"]["Sessions"] = { |
| 39 | {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; |
| 40 | asyncResp->res.jsonValue["AccountService"] = { |
| 41 | {"@odata.id", "/redfish/v1/AccountService"}}; |
| 42 | asyncResp->res.jsonValue["Chassis"] = { |
| 43 | {"@odata.id", "/redfish/v1/Chassis"}}; |
| 44 | asyncResp->res.jsonValue["JsonSchemas"] = { |
| 45 | {"@odata.id", "/redfish/v1/JsonSchemas"}}; |
| 46 | asyncResp->res.jsonValue["Managers"] = { |
| 47 | {"@odata.id", "/redfish/v1/Managers"}}; |
| 48 | asyncResp->res.jsonValue["SessionService"] = { |
| 49 | {"@odata.id", "/redfish/v1/SessionService"}}; |
| 50 | asyncResp->res.jsonValue["Systems"] = { |
| 51 | {"@odata.id", "/redfish/v1/Systems"}}; |
| 52 | asyncResp->res.jsonValue["Registries"] = { |
| 53 | {"@odata.id", "/redfish/v1/Registries"}}; |
| 54 | |
| 55 | asyncResp->res.jsonValue["UpdateService"] = { |
| 56 | {"@odata.id", "/redfish/v1/UpdateService"}}; |
| 57 | asyncResp->res.jsonValue["UUID"] = uuid; |
| 58 | asyncResp->res.jsonValue["CertificateService"] = { |
| 59 | {"@odata.id", "/redfish/v1/CertificateService"}}; |
| 60 | asyncResp->res.jsonValue["Tasks"] = { |
| 61 | {"@odata.id", "/redfish/v1/TaskService"}}; |
| 62 | asyncResp->res.jsonValue["EventService"] = { |
| 63 | {"@odata.id", "/redfish/v1/EventService"}}; |
| 64 | asyncResp->res.jsonValue["TelemetryService"] = { |
| 65 | {"@odata.id", "/redfish/v1/TelemetryService"}}; |
Shantappa Teekappanavar | 9c929be | 2021-12-16 19:02:52 -0600 | [diff] [blame] | 66 | asyncResp->res.jsonValue["Cables"] = {{"@odata.id", "/redfish/v1/Cables"}}; |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 67 | } |
| 68 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 69 | inline void requestRoutesServiceRoot(App& app) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 70 | { |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 71 | BMCWEB_ROUTE(app, "/redfish/v1/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 72 | .privileges(redfish::privileges::getServiceRoot) |
John Edward Broadbent | 8338891 | 2021-06-29 10:46:46 -0700 | [diff] [blame] | 73 | .methods(boost::beast::http::verb::get)(handleServiceRootGet); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 74 | } |
Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 75 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 76 | } // namespace redfish |