Lewanczyk, Dawid | 88d16c9 | 2018-02-02 14:51:09 +0100 | [diff] [blame^] | 1 | /* |
| 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 | |
| 20 | namespace redfish { |
| 21 | |
| 22 | class AccountService : public Node { |
| 23 | public: |
| 24 | template <typename CrowApp, typename PrivilegeProvider> |
| 25 | AccountService(CrowApp& app, PrivilegeProvider& provider) |
| 26 | : Node(app, provider, "#AccountService.v1_1_0.AccountService", |
| 27 | "/redfish/v1/AccountService/") { |
| 28 | nodeJson["@odata.id"] = "/redfish/v1/AccountService"; |
| 29 | nodeJson["@odata.type"] = "#AccountService.v1_1_0.AccountService"; |
| 30 | nodeJson["@odata.context"] = |
| 31 | "/redfish/v1/$metadata#AccountService.AccountService"; |
| 32 | nodeJson["Id"] = "AccountService"; |
| 33 | nodeJson["Description"] = "BMC User Accounts"; |
| 34 | nodeJson["Name"] = "Account Service"; |
| 35 | nodeJson["Status"]["State"] = "Enabled"; |
| 36 | nodeJson["Status"]["Health"] = "OK"; |
| 37 | nodeJson["Status"]["HealthRollup"] = "OK"; |
| 38 | nodeJson["ServiceEnabled"] = true; |
| 39 | nodeJson["MinPasswordLength"] = 1; |
| 40 | nodeJson["MaxPasswordLength"] = 20; |
| 41 | nodeJson["Accounts"]["@odata.id"] = "/redfish/v1/AccountService/Accounts"; |
| 42 | nodeJson["Roles"]["@odata.id"] = "/redfish/v1/AccountService/Roles"; |
| 43 | } |
| 44 | |
| 45 | private: |
| 46 | void doGet(crow::response& res, const crow::request& req, |
| 47 | const std::vector<std::string>& params) override { |
| 48 | res.json_value = nodeJson; |
| 49 | res.end(); |
| 50 | } |
| 51 | |
| 52 | nlohmann::json nodeJson; |
| 53 | }; |
| 54 | |
| 55 | } // namespace redfish |