Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ed Tanous | 65e4f1f | 2022-02-08 00:23:54 -0800 | [diff] [blame] | 3 | #include <nlohmann/json.hpp> |
| 4 | #include <registries/resource_event_message_registry.hpp> |
| 5 | |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 6 | namespace redfish |
| 7 | { |
| 8 | namespace messages |
| 9 | { |
| 10 | |
Nan Zhou | 60a86d6 | 2022-08-18 19:30:11 +0000 | [diff] [blame^] | 11 | inline nlohmann::json |
Ed Tanous | 65e4f1f | 2022-02-08 00:23:54 -0800 | [diff] [blame] | 12 | getLogResourceEvent(redfish::registries::resource_event::Index name, |
| 13 | std::span<const std::string_view> args) |
| 14 | { |
| 15 | size_t index = static_cast<size_t>(name); |
| 16 | if (index >= redfish::registries::resource_event::registry.size()) |
| 17 | { |
| 18 | return {}; |
| 19 | } |
| 20 | return getLogFromRegistry(redfish::registries::resource_event::header, |
| 21 | redfish::registries::resource_event::registry, |
| 22 | index, args); |
| 23 | } |
| 24 | |
Ed Tanous | 65176d3 | 2020-09-28 19:04:03 -0700 | [diff] [blame] | 25 | inline nlohmann::json resourceChanged() |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 26 | { |
Ed Tanous | 65e4f1f | 2022-02-08 00:23:54 -0800 | [diff] [blame] | 27 | return getLogResourceEvent( |
| 28 | redfish::registries::resource_event::Index::resourceChanged, {}); |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 29 | } |
| 30 | |
Ed Tanous | 65176d3 | 2020-09-28 19:04:03 -0700 | [diff] [blame] | 31 | inline nlohmann::json resourceCreated() |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 32 | { |
Ed Tanous | 65e4f1f | 2022-02-08 00:23:54 -0800 | [diff] [blame] | 33 | return getLogResourceEvent( |
| 34 | redfish::registries::resource_event::Index::resourceCreated, {}); |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 35 | } |
| 36 | |
Ed Tanous | 65176d3 | 2020-09-28 19:04:03 -0700 | [diff] [blame] | 37 | inline nlohmann::json resourceRemoved() |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 38 | { |
Ed Tanous | 65e4f1f | 2022-02-08 00:23:54 -0800 | [diff] [blame] | 39 | return getLogResourceEvent( |
| 40 | redfish::registries::resource_event::Index::resourceCreated, {}); |
Sunitha Harish | 74eec26 | 2020-06-25 10:00:01 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | } // namespace messages |
| 44 | } // namespace redfish |