Ed Tanous | a8a5bc1 | 2024-12-02 15:43:16 -0800 | [diff] [blame] | 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 getLog(redfish::registries::heartbeat_event::Index name, |
| 35 | std::span<const std::string_view> args) |
| 36 | { |
| 37 | size_t index = static_cast<size_t>(name); |
| 38 | if (index >= redfish::registries::heartbeat_event::registry.size()) |
| 39 | { |
| 40 | return {}; |
| 41 | } |
| 42 | return getLogFromRegistry(redfish::registries::heartbeat_event::header, |
| 43 | redfish::registries::heartbeat_event::registry, |
| 44 | index, args); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @internal |
| 49 | * @brief Formats RedfishServiceFunctional message into JSON |
| 50 | * |
| 51 | * See header file for more information |
| 52 | * @endinternal |
| 53 | */ |
| 54 | nlohmann::json redfishServiceFunctional() |
| 55 | { |
| 56 | return getLog( |
| 57 | redfish::registries::heartbeat_event::Index::redfishServiceFunctional, |
| 58 | {}); |
| 59 | } |
| 60 | |
| 61 | } // namespace messages |
| 62 | } // namespace redfish |