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 18b6df6dc7SBorawski.Lukasz #include "node.hpp" 19b6df6dc7SBorawski.Lukasz 20b6df6dc7SBorawski.Lukasz namespace redfish { 21b6df6dc7SBorawski.Lukasz 2243a095abSBorawski.Lukasz static OperationMap serviceRootOpMap = { 2343a095abSBorawski.Lukasz {crow::HTTPMethod::GET, {{}}}, 2443a095abSBorawski.Lukasz {crow::HTTPMethod::HEAD, {{}}}, 2543a095abSBorawski.Lukasz {crow::HTTPMethod::PATCH, {{"ConfigureComponents"}}}, 2643a095abSBorawski.Lukasz {crow::HTTPMethod::PUT, {{"ConfigureComponents"}}}, 2743a095abSBorawski.Lukasz {crow::HTTPMethod::DELETE, {{"ConfigureComponents"}}}, 2843a095abSBorawski.Lukasz {crow::HTTPMethod::POST, {{"ConfigureComponents"}}}}; 2943a095abSBorawski.Lukasz 30b6df6dc7SBorawski.Lukasz class ServiceRoot : public Node { 31b6df6dc7SBorawski.Lukasz public: 3243a095abSBorawski.Lukasz ServiceRoot(CrowApp& app) 3343a095abSBorawski.Lukasz : Node(app, EntityPrivileges(std::move(serviceRootOpMap)), 3443a095abSBorawski.Lukasz "/redfish/v1/") { 35*c1a46bd2SBorawski.Lukasz Node::json["@odata.type"] = "#ServiceRoot.v1_1_1.ServiceRoot"; 36*c1a46bd2SBorawski.Lukasz Node::json["@odata.id"] = "/redfish/v1/"; 37*c1a46bd2SBorawski.Lukasz Node::json["@odata.context"] = 38b6df6dc7SBorawski.Lukasz "/redfish/v1/$metadata#ServiceRoot.ServiceRoot"; 39*c1a46bd2SBorawski.Lukasz Node::json["Id"] = "RootService"; 40*c1a46bd2SBorawski.Lukasz Node::json["Name"] = "Root Service"; 41*c1a46bd2SBorawski.Lukasz Node::json["RedfishVersion"] = "1.1.0"; 42*c1a46bd2SBorawski.Lukasz Node::json["Links"]["Sessions"] = { 43*c1a46bd2SBorawski.Lukasz {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 44*c1a46bd2SBorawski.Lukasz Node::json["UUID"] = 45b6df6dc7SBorawski.Lukasz app.template get_middleware<crow::PersistentData::Middleware>() 46b6df6dc7SBorawski.Lukasz .system_uuid; 47b6df6dc7SBorawski.Lukasz } 48b6df6dc7SBorawski.Lukasz 49b6df6dc7SBorawski.Lukasz private: 50b6df6dc7SBorawski.Lukasz void doGet(crow::response& res, const crow::request& req, 51b6df6dc7SBorawski.Lukasz const std::vector<std::string>& params) override { 52b6df6dc7SBorawski.Lukasz res.add_header("Content-Type", "application/json"); 53*c1a46bd2SBorawski.Lukasz res.json_value = Node::json; 54b6df6dc7SBorawski.Lukasz res.end(); 55b6df6dc7SBorawski.Lukasz } 56b6df6dc7SBorawski.Lukasz }; 57b6df6dc7SBorawski.Lukasz 58b6df6dc7SBorawski.Lukasz } // namespace redfish 59