blob: 20d045f681cb6e682439ae0bdf62313f41e8b286 [file] [edit]
#ifndef THIRD_PARTY_GBMCWEB_REDFISH_CORE_LIB_CONTROL_H_
#define THIRD_PARTY_GBMCWEB_REDFISH_CORE_LIB_CONTROL_H_
#include <functional>
#include <memory>
#include <string>
#include "app.hpp"
#include "http_request.hpp"
#include "utility.hpp"
#include "async_resp.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include <nlohmann/json.hpp>
namespace redfish {
inline void getControlCollection(
App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& chassisId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp)) {
return;
}
asyncResp->res.jsonValue["@odata.type"] =
"#ControlCollection.v1_0_0.ControlCollection";
asyncResp->res.jsonValue["@odata.id"] = crow::utility::urlFromPieces(
"redfish", "v1", "Chassis", chassisId, "Controls");
asyncResp->res.jsonValue["Name"] = "Control Collection";
asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
asyncResp->res.jsonValue["Members@odata.count"] = 0;
}
inline void requestRoutesControl(App& app) {
BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Controls/")
.privileges(redfish::privileges::getControlCollection)
.methods(boost::beast::http::verb::get)(
std::bind_front(getControlCollection, std::ref(app)));
}
} // namespace redfish
#endif // THIRD_PARTY_GBMCWEB_REDFISH_CORE_LIB_CONTROL_H_