blob: c57d3e7797f574f15d187c9ccd0305b9b8212fb6 [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
18#include "node.hpp"
19
20namespace redfish {
21
22class ServiceRoot : public Node {
23 public:
Ed Tanous3ebd75f2018-03-05 18:20:01 -080024 ServiceRoot(CrowApp& app) : Node(app, "/redfish/v1/") {
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010025 Node::json["@odata.type"] = "#ServiceRoot.v1_1_1.ServiceRoot";
26 Node::json["@odata.id"] = "/redfish/v1/";
27 Node::json["@odata.context"] =
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010028 "/redfish/v1/$metadata#ServiceRoot.ServiceRoot";
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010029 Node::json["Id"] = "RootService";
30 Node::json["Name"] = "Root Service";
31 Node::json["RedfishVersion"] = "1.1.0";
32 Node::json["Links"]["Sessions"] = {
33 {"@odata.id", "/redfish/v1/SessionService/Sessions"}};
34 Node::json["UUID"] =
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010035 app.template get_middleware<crow::PersistentData::Middleware>()
36 .system_uuid;
Ed Tanous3ebd75f2018-03-05 18:20:01 -080037
38 entityPrivileges = {{crow::HTTPMethod::GET, {}},
39 {crow::HTTPMethod::HEAD, {}},
40 {crow::HTTPMethod::PATCH, {{"ConfigureComponents"}}},
41 {crow::HTTPMethod::PUT, {{"ConfigureComponents"}}},
42 {crow::HTTPMethod::DELETE, {{"ConfigureComponents"}}},
43 {crow::HTTPMethod::POST, {{"ConfigureComponents"}}}};
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010044 }
45
46 private:
47 void doGet(crow::response& res, const crow::request& req,
48 const std::vector<std::string>& params) override {
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +010049 res.json_value = Node::json;
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010050 res.end();
51 }
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010052};
53
54} // namespace redfish