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 22b6df6dc7SBorawski.Lukasz class ServiceRoot : public Node { 23b6df6dc7SBorawski.Lukasz public: 243ebd75f7SEd Tanous ServiceRoot(CrowApp& app) : Node(app, "/redfish/v1/") { 25c1a46bd2SBorawski.Lukasz Node::json["@odata.type"] = "#ServiceRoot.v1_1_1.ServiceRoot"; 26c1a46bd2SBorawski.Lukasz Node::json["@odata.id"] = "/redfish/v1/"; 27c1a46bd2SBorawski.Lukasz Node::json["@odata.context"] = 28b6df6dc7SBorawski.Lukasz "/redfish/v1/$metadata#ServiceRoot.ServiceRoot"; 29c1a46bd2SBorawski.Lukasz Node::json["Id"] = "RootService"; 30c1a46bd2SBorawski.Lukasz Node::json["Name"] = "Root Service"; 31c1a46bd2SBorawski.Lukasz Node::json["RedfishVersion"] = "1.1.0"; 32c1a46bd2SBorawski.Lukasz Node::json["Links"]["Sessions"] = { 33c1a46bd2SBorawski.Lukasz {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 34c1a46bd2SBorawski.Lukasz Node::json["UUID"] = 35b6df6dc7SBorawski.Lukasz app.template get_middleware<crow::PersistentData::Middleware>() 36b6df6dc7SBorawski.Lukasz .system_uuid; 373ebd75f7SEd Tanous 38*e0d918bcSEd Tanous entityPrivileges = {{boost::beast::http::verb::get, {}}, 39*e0d918bcSEd Tanous {boost::beast::http::verb::head, {}}, 40*e0d918bcSEd Tanous {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}, 41*e0d918bcSEd Tanous {boost::beast::http::verb::put, {{"ConfigureComponents"}}}, 42*e0d918bcSEd Tanous {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, 43*e0d918bcSEd Tanous {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; 44b6df6dc7SBorawski.Lukasz } 45b6df6dc7SBorawski.Lukasz 46b6df6dc7SBorawski.Lukasz private: 47b6df6dc7SBorawski.Lukasz void doGet(crow::response& res, const crow::request& req, 48b6df6dc7SBorawski.Lukasz const std::vector<std::string>& params) override { 49c1a46bd2SBorawski.Lukasz res.json_value = Node::json; 50b6df6dc7SBorawski.Lukasz res.end(); 51b6df6dc7SBorawski.Lukasz } 52b6df6dc7SBorawski.Lukasz }; 53b6df6dc7SBorawski.Lukasz 54b6df6dc7SBorawski.Lukasz } // namespace redfish 55