1 #pragma once
2 
3 #include <app.hpp>
4 #include <async_resp.hpp>
5 #include <http_request.hpp>
6 #include <nlohmann/json.hpp>
7 #include <privileges.hpp>
8 #include <routing.hpp>
9 
10 #include <string>
11 
12 namespace redfish
13 {
14 
15 /**
16  * handleManagerDiagnosticData supports ManagerDiagnosticData.
17  * It retrieves BMC health information from various DBus resources and returns
18  * the information through the response.
19  */
20 inline void handleManagerDiagnosticDataGet(
21     crow::App& app, const crow::Request& req,
22     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
23 {
24     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
25     {
26         return;
27     }
28     asyncResp->res.jsonValue["@odata.type"] =
29         "#ManagerDiagnosticData.v1_0_0.ManagerDiagnosticData";
30     asyncResp->res.jsonValue["@odata.id"] =
31         "/redfish/v1/Managers/bmc/ManagerDiagnosticData";
32     asyncResp->res.jsonValue["Id"] = "ManagerDiagnosticData";
33     asyncResp->res.jsonValue["Name"] = "Manager Diagnostic Data";
34 }
35 
36 inline void requestRoutesManagerDiagnosticData(App& app)
37 {
38     BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/ManagerDiagnosticData")
39         .privileges(redfish::privileges::getManagerDiagnosticData)
40         .methods(boost::beast::http::verb::get)(
41             std::bind_front(handleManagerDiagnosticDataGet, std::ref(app)));
42 }
43 
44 } // namespace redfish
45