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