xref: /openbmc/bmcweb/features/redfish/lib/service_root.hpp (revision 8338891aa2c5424c52fe3e0bea320172a5aedda3)
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>
19*8338891aSJohn 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 
26*8338891aSJohn Edward Broadbent inline void
27*8338891aSJohn Edward Broadbent     handleServiceRootGet(const crow::Request&,
28*8338891aSJohn Edward Broadbent                          const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
291abe55efSEd Tanous {
30*8338891aSJohn Edward Broadbent 
317e860f15SJohn Edward Broadbent     std::string uuid = persistent_data::getConfig().systemUuid;
32*8338891aSJohn Edward Broadbent     asyncResp->res.jsonValue["@odata.type"] = "#ServiceRoot.v1_5_0.ServiceRoot";
338d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1";
348d1b46d7Szhanghch05     asyncResp->res.jsonValue["Id"] = "RootService";
358d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Root Service";
368d1b46d7Szhanghch05     asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0";
378d1b46d7Szhanghch05     asyncResp->res.jsonValue["Links"]["Sessions"] = {
380f74e643SEd Tanous         {"@odata.id", "/redfish/v1/SessionService/Sessions"}};
398d1b46d7Szhanghch05     asyncResp->res.jsonValue["AccountService"] = {
400f74e643SEd Tanous         {"@odata.id", "/redfish/v1/AccountService"}};
418d1b46d7Szhanghch05     asyncResp->res.jsonValue["Chassis"] = {
428d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Chassis"}};
438d1b46d7Szhanghch05     asyncResp->res.jsonValue["JsonSchemas"] = {
440f74e643SEd Tanous         {"@odata.id", "/redfish/v1/JsonSchemas"}};
458d1b46d7Szhanghch05     asyncResp->res.jsonValue["Managers"] = {
468d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Managers"}};
478d1b46d7Szhanghch05     asyncResp->res.jsonValue["SessionService"] = {
488d3cae6bSGunnar Mills         {"@odata.id", "/redfish/v1/SessionService"}};
498d1b46d7Szhanghch05     asyncResp->res.jsonValue["Systems"] = {
508d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Systems"}};
518d1b46d7Szhanghch05     asyncResp->res.jsonValue["Registries"] = {
528d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/Registries"}};
530f74e643SEd Tanous 
548d1b46d7Szhanghch05     asyncResp->res.jsonValue["UpdateService"] = {
550f74e643SEd Tanous         {"@odata.id", "/redfish/v1/UpdateService"}};
568d1b46d7Szhanghch05     asyncResp->res.jsonValue["UUID"] = uuid;
578d1b46d7Szhanghch05     asyncResp->res.jsonValue["CertificateService"] = {
585968caeeSMarri Devender Rao         {"@odata.id", "/redfish/v1/CertificateService"}};
598d1b46d7Szhanghch05     asyncResp->res.jsonValue["Tasks"] = {
608d1b46d7Szhanghch05         {"@odata.id", "/redfish/v1/TaskService"}};
618d1b46d7Szhanghch05     asyncResp->res.jsonValue["EventService"] = {
62e5aaf047SAppaRao Puli         {"@odata.id", "/redfish/v1/EventService"}};
638d1b46d7Szhanghch05     asyncResp->res.jsonValue["TelemetryService"] = {
64081ebf06SWludzik, Jozef         {"@odata.id", "/redfish/v1/TelemetryService"}};
65*8338891aSJohn Edward Broadbent }
66*8338891aSJohn Edward Broadbent 
67*8338891aSJohn Edward Broadbent inline void requestRoutesServiceRoot(App& app)
68*8338891aSJohn Edward Broadbent {
69*8338891aSJohn Edward Broadbent     BMCWEB_ROUTE(app, "/redfish/v1/")
70*8338891aSJohn Edward Broadbent         .privileges(redfish::privileges::getServiceRoot)
71*8338891aSJohn Edward Broadbent         .methods(boost::beast::http::verb::get)(handleServiceRootGet);
72b6df6dc7SBorawski.Lukasz }
733602e232SEd Tanous 
74b6df6dc7SBorawski.Lukasz } // namespace redfish
75