blob: b33c80f27f64b0cf141ee6578b3421b1fad168e1 [file] [log] [blame]
Lewanczyk, Dawid08777fb2018-03-22 23:33:49 +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#include "sensors.hpp"
20
21namespace redfish {
22
23class Thermal : public Node {
24 public:
25 Thermal(CrowApp& app)
26 : Node((app), "/redfish/v1/Chassis/<str>/Thermal/", std::string()) {
27 Node::json["@odata.type"] = "#Thermal.v1_2_0.Thermal";
28 Node::json["@odata.context"] = "/redfish/v1/$metadata#Thermal.Thermal";
29 Node::json["Id"] = "Thermal";
30 Node::json["Name"] = "Thermal";
31
32 entityPrivileges = {{crow::HTTPMethod::GET, {{"Login"}}},
33 {crow::HTTPMethod::HEAD, {{"Login"}}},
34 {crow::HTTPMethod::PATCH, {{"ConfigureManager"}}},
35 {crow::HTTPMethod::PUT, {{"ConfigureManager"}}},
36 {crow::HTTPMethod::DELETE, {{"ConfigureManager"}}},
37 {crow::HTTPMethod::POST, {{"ConfigureManager"}}}};
38 }
39
40 private:
41 void doGet(crow::response& res, const crow::request& req,
42 const std::vector<std::string>& params) override {
43 if (params.size() != 1) {
44 res.code = static_cast<int>(HttpRespCode::INTERNAL_ERROR);
45 res.end();
46 return;
47 }
48 const std::string& chassis_name = params[0];
49
50 res.json_value = Node::json;
51 auto asyncResp = std::make_shared<AsyncResp>(
52 res, chassis_name,
53 std::initializer_list<const char*>{
54 "/xyz/openbmc_project/Sensors/fan",
55 "/xyz/openbmc_project/Sensors/temperature"});
56 getChassisData(asyncResp);
57 }
58};
59
60} // namespace redfish