| #pragma once |
| |
| #include "utils/collection.hpp" |
| #include "utils/telemetry_utils.hpp" |
| |
| #include <app.hpp> |
| #include <registries/privilege_registry.hpp> |
| |
| namespace redfish |
| { |
| namespace telemetry |
| { |
| constexpr const char* triggerInterface = |
| "xyz.openbmc_project.Telemetry.Trigger"; |
| constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers"; |
| |
| } // namespace telemetry |
| |
| inline void requestRoutesTriggerCollection(App& app) |
| { |
| BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/Triggers/") |
| .privileges(redfish::privileges::getTriggersCollection) |
| .methods(boost::beast::http::verb::get)( |
| [](const crow::Request&, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
| asyncResp->res.jsonValue["@odata.type"] = |
| "#TriggersCollection.TriggersCollection"; |
| asyncResp->res.jsonValue["@odata.id"] = |
| "/redfish/v1/TelemetryService/Triggers"; |
| asyncResp->res.jsonValue["Name"] = "Triggers Collection"; |
| const std::vector<const char*> interfaces{ |
| telemetry::triggerInterface}; |
| collection_util::getCollectionMembers( |
| asyncResp, telemetry::triggerUri, interfaces, |
| "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService"); |
| }); |
| } |
| |
| } // namespace redfish |