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