xref: /openbmc/bmcweb/features/redfish/lib/service_root.hpp (revision 9c929bea78857633f2b71b356abf4aa4b1ac56d2)
1b6df6dc7SBorawski.Lukasz /*
2b6df6dc7SBorawski.Lukasz // Copyright (c) 2018 Intel Corporation
3b6df6dc7SBorawski.Lukasz //
4b6df6dc7SBorawski.Lukasz // Licensed under the Apache License, Version 2.0 (the "License");
5b6df6dc7SBorawski.Lukasz // you may not use this file except in compliance with the License.
6b6df6dc7SBorawski.Lukasz // You may obtain a copy of the License at
7b6df6dc7SBorawski.Lukasz //
8b6df6dc7SBorawski.Lukasz //      http://www.apache.org/licenses/LICENSE-2.0
9b6df6dc7SBorawski.Lukasz //
10b6df6dc7SBorawski.Lukasz // Unless required by applicable law or agreed to in writing, software
11b6df6dc7SBorawski.Lukasz // distributed under the License is distributed on an "AS IS" BASIS,
12b6df6dc7SBorawski.Lukasz // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b6df6dc7SBorawski.Lukasz // See the License for the specific language governing permissions and
14b6df6dc7SBorawski.Lukasz // limitations under the License.
15b6df6dc7SBorawski.Lukasz */
16b6df6dc7SBorawski.Lukasz #pragma once
17b6df6dc7SBorawski.Lukasz 
187e860f15SJohn Edward Broadbent #include <app.hpp>
198338891aSJohn Edward Broadbent #include <persistent_data.hpp>
20ed398213SEd Tanous #include <registries/privilege_registry.hpp>
217bffdb7eSBernard Wong #include <utils/systemd_utils.hpp>
22b6df6dc7SBorawski.Lukasz 
231abe55efSEd Tanous namespace redfish
241abe55efSEd Tanous {
251abe55efSEd Tanous 
268338891aSJohn Edward Broadbent inline void
278338891aSJohn Edward Broadbent     handleServiceRootGet(const crow::Request&,
288338891aSJohn Edward Broadbent                          const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
291abe55efSEd Tanous {
308338891aSJohn Edward Broadbent 
317e860f15SJohn Edward Broadbent     std::string uuid = persistent_data::getConfig().systemUuid;
32*9c929beaSShantappa Teekappanavar     asyncResp->res.jsonValue["@odata.type"] =
33*9c929beaSShantappa Teekappanavar         "#ServiceRoot.v1_11_0.ServiceRoot";
348d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1";
358d1b46d7Szhanghch05     asyncResp->res.jsonValue["Id"] = "RootService";
368d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Root Service";
378d1b46d7Szhanghch05     asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0";
388d1b46d7Szhanghch05     asyncResp->res.jsonValue["Links"]["Sessions"] = {
390f74e643SEd Tanous         {"@odata.id", "/redfish/v1/SessionService/Sessions"}};
408d1b46d7Szhanghch05     asyncResp->res.jsonValue["AccountService"] = {
410f74e643SEd Tanous         {"@odata.id", "/redfish/v1/AccountService"}};
428d1b46d7Szhanghch05     asyncResp->res.jsonValue["Chassis"] = {
438d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Chassis"}};
448d1b46d7Szhanghch05     asyncResp->res.jsonValue["JsonSchemas"] = {
450f74e643SEd Tanous         {"@odata.id", "/redfish/v1/JsonSchemas"}};
468d1b46d7Szhanghch05     asyncResp->res.jsonValue["Managers"] = {
478d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Managers"}};
488d1b46d7Szhanghch05     asyncResp->res.jsonValue["SessionService"] = {
498d3cae6bSGunnar Mills         {"@odata.id", "/redfish/v1/SessionService"}};
508d1b46d7Szhanghch05     asyncResp->res.jsonValue["Systems"] = {
518d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Systems"}};
528d1b46d7Szhanghch05     asyncResp->res.jsonValue["Registries"] = {
538d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Registries"}};
540f74e643SEd Tanous 
558d1b46d7Szhanghch05     asyncResp->res.jsonValue["UpdateService"] = {
560f74e643SEd Tanous         {"@odata.id", "/redfish/v1/UpdateService"}};
578d1b46d7Szhanghch05     asyncResp->res.jsonValue["UUID"] = uuid;
588d1b46d7Szhanghch05     asyncResp->res.jsonValue["CertificateService"] = {
595968caeeSMarri Devender Rao         {"@odata.id", "/redfish/v1/CertificateService"}};
608d1b46d7Szhanghch05     asyncResp->res.jsonValue["Tasks"] = {
618d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/TaskService"}};
628d1b46d7Szhanghch05     asyncResp->res.jsonValue["EventService"] = {
63e5aaf047SAppaRao Puli         {"@odata.id", "/redfish/v1/EventService"}};
648d1b46d7Szhanghch05     asyncResp->res.jsonValue["TelemetryService"] = {
65081ebf06SWludzik, Jozef         {"@odata.id", "/redfish/v1/TelemetryService"}};
66*9c929beaSShantappa Teekappanavar     asyncResp->res.jsonValue["Cables"] = {{"@odata.id", "/redfish/v1/Cables"}};
678338891aSJohn Edward Broadbent }
688338891aSJohn Edward Broadbent 
698338891aSJohn Edward Broadbent inline void requestRoutesServiceRoot(App& app)
708338891aSJohn Edward Broadbent {
718338891aSJohn Edward Broadbent     BMCWEB_ROUTE(app, "/redfish/v1/")
728338891aSJohn Edward Broadbent         .privileges(redfish::privileges::getServiceRoot)
738338891aSJohn Edward Broadbent         .methods(boost::beast::http::verb::get)(handleServiceRootGet);
74b6df6dc7SBorawski.Lukasz }
753602e232SEd Tanous 
76b6df6dc7SBorawski.Lukasz } // namespace redfish
77