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 18 #include <app.hpp> 19 #include <registries/privilege_registry.hpp> 20 #include <utils/systemd_utils.hpp> 21 22 namespace redfish 23 { 24 25 inline void requestRoutesServiceRoot(App& app) 26 { 27 std::string uuid = persistent_data::getConfig().systemUuid; 28 BMCWEB_ROUTE(app, "/redfish/v1/") 29 .privileges(redfish::privileges::getServiceRoot) 30 .methods(boost::beast::http::verb::get)( 31 [uuid](const crow::Request&, 32 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { 33 asyncResp->res.jsonValue["@odata.type"] = 34 "#ServiceRoot.v1_5_0.ServiceRoot"; 35 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; 36 asyncResp->res.jsonValue["Id"] = "RootService"; 37 asyncResp->res.jsonValue["Name"] = "Root Service"; 38 asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; 39 asyncResp->res.jsonValue["Links"]["Sessions"] = { 40 {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 41 asyncResp->res.jsonValue["AccountService"] = { 42 {"@odata.id", "/redfish/v1/AccountService"}}; 43 asyncResp->res.jsonValue["Chassis"] = { 44 {"@odata.id", "/redfish/v1/Chassis"}}; 45 asyncResp->res.jsonValue["JsonSchemas"] = { 46 {"@odata.id", "/redfish/v1/JsonSchemas"}}; 47 asyncResp->res.jsonValue["Managers"] = { 48 {"@odata.id", "/redfish/v1/Managers"}}; 49 asyncResp->res.jsonValue["SessionService"] = { 50 {"@odata.id", "/redfish/v1/SessionService"}}; 51 asyncResp->res.jsonValue["Systems"] = { 52 {"@odata.id", "/redfish/v1/Systems"}}; 53 asyncResp->res.jsonValue["Registries"] = { 54 {"@odata.id", "/redfish/v1/Registries"}}; 55 56 asyncResp->res.jsonValue["UpdateService"] = { 57 {"@odata.id", "/redfish/v1/UpdateService"}}; 58 asyncResp->res.jsonValue["UUID"] = uuid; 59 asyncResp->res.jsonValue["CertificateService"] = { 60 {"@odata.id", "/redfish/v1/CertificateService"}}; 61 asyncResp->res.jsonValue["Tasks"] = { 62 {"@odata.id", "/redfish/v1/TaskService"}}; 63 asyncResp->res.jsonValue["EventService"] = { 64 {"@odata.id", "/redfish/v1/EventService"}}; 65 asyncResp->res.jsonValue["TelemetryService"] = { 66 {"@odata.id", "/redfish/v1/TelemetryService"}}; 67 }); 68 } 69 70 } // namespace redfish 71