blob: 7a71151732c654cbb1e50ff101d6ba1996406502 [file] [log] [blame]
Sunitha Harish74eec262020-06-25 10:00:01 -05001#pragma once
2
Ed Tanous3ccb3ad2023-01-13 17:40:03 -08003#include "registries/resource_event_message_registry.hpp"
4
Ed Tanous65e4f1f2022-02-08 00:23:54 -08005#include <nlohmann/json.hpp>
Ed Tanous65e4f1f2022-02-08 00:23:54 -08006
Sunitha Harish74eec262020-06-25 10:00:01 -05007namespace redfish
8{
9namespace messages
10{
11
Nan Zhou60a86d62022-08-18 19:30:11 +000012inline nlohmann::json
Ed Tanous65e4f1f2022-02-08 00:23:54 -080013 getLogResourceEvent(redfish::registries::resource_event::Index name,
Ed Tanous26ccae32023-02-16 10:28:44 -080014 std::span<std::string_view> args)
Ed Tanous65e4f1f2022-02-08 00:23:54 -080015{
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 Tanous65176d32020-09-28 19:04:03 -070026inline nlohmann::json resourceChanged()
Sunitha Harish74eec262020-06-25 10:00:01 -050027{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080028 return getLogResourceEvent(
29 redfish::registries::resource_event::Index::resourceChanged, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050030}
31
Ed Tanous65176d32020-09-28 19:04:03 -070032inline nlohmann::json resourceCreated()
Sunitha Harish74eec262020-06-25 10:00:01 -050033{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080034 return getLogResourceEvent(
35 redfish::registries::resource_event::Index::resourceCreated, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050036}
37
Ed Tanous65176d32020-09-28 19:04:03 -070038inline nlohmann::json resourceRemoved()
Sunitha Harish74eec262020-06-25 10:00:01 -050039{
Ed Tanous65e4f1f2022-02-08 00:23:54 -080040 return getLogResourceEvent(
Asmitha Karunanithi535c7602023-03-16 10:43:47 -050041 redfish::registries::resource_event::Index::resourceRemoved, {});
Sunitha Harish74eec262020-06-25 10:00:01 -050042}
43
44} // namespace messages
45} // namespace redfish