xref: /openbmc/bmcweb/redfish-core/src/heartbeat_messages.cpp (revision 2ca561945f9c518e4916cd23c194f89816fdbeee)
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 <cstdint>
27 // NOLINTNEXTLINE(misc-include-cleaner)
28 #include <string>
29 // NOLINTNEXTLINE(misc-include-cleaner)
30 #include <utility>
31 
32 namespace redfish
33 {
34 
35 namespace messages
36 {
37 
getLog(redfish::registries::HeartbeatEvent::Index name,std::span<const std::string_view> args)38 static nlohmann::json::object_t getLog(
39     redfish::registries::HeartbeatEvent::Index name,
40     std::span<const std::string_view> args)
41 {
42     size_t index = static_cast<size_t>(name);
43     if (index >= redfish::registries::HeartbeatEvent::registry.size())
44     {
45         return {};
46     }
47     return getLogFromRegistry(redfish::registries::HeartbeatEvent::header,
48                               redfish::registries::HeartbeatEvent::registry,
49                               index, args);
50 }
51 
52 /**
53  * @internal
54  * @brief Formats RedfishServiceFunctional message into JSON
55  *
56  * See header file for more information
57  * @endinternal
58  */
redfishServiceFunctional()59 nlohmann::json::object_t redfishServiceFunctional()
60 {
61     return getLog(
62         redfish::registries::HeartbeatEvent::Index::redfishServiceFunctional,
63         {});
64 }
65 
66 } // namespace messages
67 } // namespace redfish
68