xref: /openbmc/bmcweb/features/redfish/src/heartbeat_messages.cpp (revision 10cf50dca112b27176dc5734126983ad37ba2c04)
1 /****************************************************************
2  *                 READ THIS WARNING FIRST
3  * This is an auto-generated header which contains definitions
4  * for Redfish DMTF defined messages.
5  * DO NOT modify this registry outside of running the
6  * parse_registries.py script.  The definitions contained within
7  * this file are owned by DMTF.  Any modifications to these files
8  * should be first pushed to the relevant registry in the DMTF
9  * github organization.
10  ***************************************************************/
11 #include "heartbeat_messages.hpp"
12 
13 #include "registries.hpp"
14 #include "registries/heartbeat_event_message_registry.hpp"
15 
16 #include <nlohmann/json.hpp>
17 
18 #include <array>
19 #include <cstddef>
20 #include <span>
21 #include <string_view>
22 
23 // Clang can't seem to decide whether this header needs to be included or not,
24 // and is inconsistent.  Include it for now
25 // NOLINTNEXTLINE(misc-include-cleaner)
26 #include <utility>
27 
28 namespace redfish
29 {
30 
31 namespace messages
32 {
33 
34 static nlohmann::json::object_t getLog(
35     redfish::registries::HeartbeatEvent::Index name,
36     std::span<const std::string_view> args)
37 {
38     size_t index = static_cast<size_t>(name);
39     if (index >= redfish::registries::HeartbeatEvent::registry.size())
40     {
41         return {};
42     }
43     return getLogFromRegistry(redfish::registries::HeartbeatEvent::header,
44                               redfish::registries::HeartbeatEvent::registry,
45                               index, args);
46 }
47 
48 /**
49  * @internal
50  * @brief Formats RedfishServiceFunctional message into JSON
51  *
52  * See header file for more information
53  * @endinternal
54  */
55 nlohmann::json::object_t redfishServiceFunctional()
56 {
57     return getLog(
58         redfish::registries::HeartbeatEvent::Index::redfishServiceFunctional,
59         {});
60 }
61 
62 } // namespace messages
63 } // namespace redfish
64