blob: bbe0887049696e8673a1507be605bba874b1f1c3 [file] [log] [blame]
Lukasz Kazmierczak07148cf2021-08-02 11:08:53 +02001#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
9namespace redfish
10{
11namespace telemetry
12{
13constexpr const char* triggerInterface =
14 "xyz.openbmc_project.Telemetry.Trigger";
15constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers";
16
17} // namespace telemetry
18
19inline 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