blob: e66ae6fc93e4d224e489c8b86db54b142324207b [file] [log] [blame]
Sunitha Harish74eec262020-06-25 10:00:01 -05001#pragma once
2
Ed Tanous65e4f1f2022-02-08 00:23:54 -08003#include <nlohmann/json.hpp>
4#include <registries/resource_event_message_registry.hpp>
5
Sunitha Harish74eec262020-06-25 10:00:01 -05006namespace redfish
7{
8namespace messages
9{
10
Ed Tanous65e4f1f2022-02-08 00:23:54 -080011nlohmann::json
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 Tanous65176d32020-09-28 19:04:03 -070025inline nlohmann::json resourceChanged()
Sunitha Harish74eec262020-06-25 10:00:01 -050026{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080027 return getLogResourceEvent(
28 redfish::registries::resource_event::Index::resourceChanged, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050029}
30
Ed Tanous65176d32020-09-28 19:04:03 -070031inline nlohmann::json resourceCreated()
Sunitha Harish74eec262020-06-25 10:00:01 -050032{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080033 return getLogResourceEvent(
34 redfish::registries::resource_event::Index::resourceCreated, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050035}
36
Ed Tanous65176d32020-09-28 19:04:03 -070037inline nlohmann::json resourceRemoved()
Sunitha Harish74eec262020-06-25 10:00:01 -050038{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080039 return getLogResourceEvent(
40 redfish::registries::resource_event::Index::resourceCreated, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050041}
42
43} // namespace messages
44} // namespace redfish