blob: 677814169ad64d2e50b89167198e089a20bd85ec [file] [log] [blame]
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +01001/*
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 Broadbent7e860f12021-04-08 15:57:16 -070018#include <app.hpp>
Ed Tanoused398212021-06-09 17:05:54 -070019#include <registries/privilege_registry.hpp>
Bernard Wong7bffdb72019-03-20 16:17:21 +080020#include <utils/systemd_utils.hpp>
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010021
Ed Tanous1abe55e2018-09-05 08:30:59 -070022namespace redfish
23{
Ed Tanous3ebd75f2018-03-05 18:20:01 -080024
John Edward Broadbent7e860f12021-04-08 15:57:16 -070025inline void requestRoutesServiceRoot(App& app)
Ed Tanous1abe55e2018-09-05 08:30:59 -070026{
John Edward Broadbent7e860f12021-04-08 15:57:16 -070027 std::string uuid = persistent_data::getConfig().systemUuid;
28 BMCWEB_ROUTE(app, "/redfish/v1/")
Ed Tanoused398212021-06-09 17:05:54 -070029 .privileges(redfish::privileges::getServiceRoot)
John Edward Broadbent7e860f12021-04-08 15:57:16 -070030 .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"}};
John Edward Broadbent7e860f12021-04-08 15:57:16 -070051 asyncResp->res.jsonValue["Systems"] = {
52 {"@odata.id", "/redfish/v1/Systems"}};
53 asyncResp->res.jsonValue["Registries"] = {
54 {"@odata.id", "/redfish/v1/Registries"}};
Ed Tanous1abe55e2018-09-05 08:30:59 -070055
John Edward Broadbent7e860f12021-04-08 15:57:16 -070056 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}
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010069
Ed Tanous1abe55e2018-09-05 08:30:59 -070070} // namespace redfish