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