| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -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 "task_messages.hpp" |
| 12 | |
| 13 | #include "registries.hpp" |
| 14 | #include "registries/task_event_message_registry.hpp" |
| 15 | |
| 16 | #include <nlohmann/json.hpp> |
| 17 | |
| 18 | #include <array> |
| 19 | #include <cstddef> |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 20 | #include <span> |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 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) |
| Ed Tanous | 2ca5619 | 2025-09-16 13:19:08 -0700 | [diff] [blame^] | 26 | #include <cstdint> |
| 27 | // NOLINTNEXTLINE(misc-include-cleaner) |
| 28 | #include <string> |
| 29 | // NOLINTNEXTLINE(misc-include-cleaner) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 30 | #include <utility> |
| 31 | |
| 32 | namespace redfish |
| 33 | { |
| 34 | |
| 35 | namespace messages |
| 36 | { |
| 37 | |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 38 | static nlohmann::json::object_t getLog( |
| 39 | redfish::registries::TaskEvent::Index name, |
| 40 | std::span<const std::string_view> args) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 41 | { |
| 42 | size_t index = static_cast<size_t>(name); |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 43 | if (index >= redfish::registries::TaskEvent::registry.size()) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 44 | { |
| 45 | return {}; |
| 46 | } |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 47 | return getLogFromRegistry(redfish::registries::TaskEvent::header, |
| 48 | redfish::registries::TaskEvent::registry, index, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 49 | args); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @internal |
| 54 | * @brief Formats TaskStarted message into JSON |
| 55 | * |
| 56 | * See header file for more information |
| 57 | * @endinternal |
| 58 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 59 | nlohmann::json::object_t taskStarted(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 60 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 61 | return getLog(redfish::registries::TaskEvent::Index::taskStarted, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 62 | std::to_array({arg1})); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * @internal |
| 67 | * @brief Formats TaskCompletedOK message into JSON |
| 68 | * |
| 69 | * See header file for more information |
| 70 | * @endinternal |
| 71 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 72 | nlohmann::json::object_t taskCompletedOK(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 73 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 74 | return getLog(redfish::registries::TaskEvent::Index::taskCompletedOK, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 75 | std::to_array({arg1})); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @internal |
| 80 | * @brief Formats TaskCompletedWarning message into JSON |
| 81 | * |
| 82 | * See header file for more information |
| 83 | * @endinternal |
| 84 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 85 | nlohmann::json::object_t taskCompletedWarning(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 86 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 87 | return getLog(redfish::registries::TaskEvent::Index::taskCompletedWarning, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 88 | std::to_array({arg1})); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @internal |
| 93 | * @brief Formats TaskAborted message into JSON |
| 94 | * |
| 95 | * See header file for more information |
| 96 | * @endinternal |
| 97 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 98 | nlohmann::json::object_t taskAborted(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 99 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 100 | return getLog(redfish::registries::TaskEvent::Index::taskAborted, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 101 | std::to_array({arg1})); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @internal |
| 106 | * @brief Formats TaskCancelled message into JSON |
| 107 | * |
| 108 | * See header file for more information |
| 109 | * @endinternal |
| 110 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 111 | nlohmann::json::object_t taskCancelled(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 112 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 113 | return getLog(redfish::registries::TaskEvent::Index::taskCancelled, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 114 | std::to_array({arg1})); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @internal |
| 119 | * @brief Formats TaskRemoved message into JSON |
| 120 | * |
| 121 | * See header file for more information |
| 122 | * @endinternal |
| 123 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 124 | nlohmann::json::object_t taskRemoved(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 125 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 126 | return getLog(redfish::registries::TaskEvent::Index::taskRemoved, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 127 | std::to_array({arg1})); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @internal |
| 132 | * @brief Formats TaskPaused message into JSON |
| 133 | * |
| 134 | * See header file for more information |
| 135 | * @endinternal |
| 136 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 137 | nlohmann::json::object_t taskPaused(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 138 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 139 | return getLog(redfish::registries::TaskEvent::Index::taskPaused, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 140 | std::to_array({arg1})); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * @internal |
| 145 | * @brief Formats TaskResumed message into JSON |
| 146 | * |
| 147 | * See header file for more information |
| 148 | * @endinternal |
| 149 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 150 | nlohmann::json::object_t taskResumed(std::string_view arg1) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 151 | { |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 152 | return getLog(redfish::registries::TaskEvent::Index::taskResumed, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 153 | std::to_array({arg1})); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * @internal |
| 158 | * @brief Formats TaskProgressChanged message into JSON |
| 159 | * |
| 160 | * See header file for more information |
| 161 | * @endinternal |
| 162 | */ |
| Ed Tanous | 10cf50d | 2025-05-06 16:10:32 -0700 | [diff] [blame] | 163 | nlohmann::json::object_t taskProgressChanged(std::string_view arg1, |
| 164 | uint64_t arg2) |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 165 | { |
| 166 | std::string arg2Str = std::to_string(arg2); |
| Patrick Williams | 4a102cd | 2025-02-27 14:52:54 -0500 | [diff] [blame] | 167 | return getLog(redfish::registries::TaskEvent::Index::taskProgressChanged, |
| Ed Tanous | f175c28 | 2024-12-02 15:12:50 -0800 | [diff] [blame] | 168 | std::to_array<std::string_view>({arg1, arg2Str})); |
| 169 | } |
| 170 | |
| 171 | } // namespace messages |
| 172 | } // namespace redfish |