Lukasz Kazmierczak | 07148cf | 2021-08-02 11:08:53 +0200 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "utils/collection.hpp" |
| 4 | #include "utils/telemetry_utils.hpp" |
| 5 | |
| 6 | #include <app.hpp> |
| 7 | #include <registries/privilege_registry.hpp> |
| 8 | |
| 9 | namespace redfish |
| 10 | { |
| 11 | namespace telemetry |
| 12 | { |
| 13 | constexpr const char* triggerInterface = |
| 14 | "xyz.openbmc_project.Telemetry.Trigger"; |
| 15 | constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers"; |
| 16 | |
| 17 | } // namespace telemetry |
| 18 | |
| 19 | inline void requestRoutesTriggerCollection(App& app) |
| 20 | { |
| 21 | BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/Triggers/") |
| 22 | .privileges(redfish::privileges::getTriggersCollection) |
| 23 | .methods(boost::beast::http::verb::get)( |
| 24 | [](const crow::Request&, |
| 25 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
| 26 | asyncResp->res.jsonValue["@odata.type"] = |
| 27 | "#TriggersCollection.TriggersCollection"; |
| 28 | asyncResp->res.jsonValue["@odata.id"] = |
| 29 | "/redfish/v1/TelemetryService/Triggers"; |
| 30 | asyncResp->res.jsonValue["Name"] = "Triggers Collection"; |
| 31 | const std::vector<const char*> interfaces{ |
| 32 | telemetry::triggerInterface}; |
| 33 | collection_util::getCollectionMembers( |
| 34 | asyncResp, telemetry::triggerUri, interfaces, |
| 35 | "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService"); |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | } // namespace redfish |