blob: 67fa51c921d92b4bc3383494219b7a6df2813087 [file] [log] [blame]
Ed Tanous847deee2024-12-02 15:28:10 -08001/****************************************************************
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 "resource_messages.hpp"
12
13#include "registries.hpp"
14#include "registries/resource_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)
Ed Tanous2ca56192025-09-16 13:19:08 -070026#include <cstdint>
27// NOLINTNEXTLINE(misc-include-cleaner)
28#include <string>
29// NOLINTNEXTLINE(misc-include-cleaner)
Ed Tanous847deee2024-12-02 15:28:10 -080030#include <utility>
31
32namespace redfish
33{
34
35namespace messages
36{
37
Ed Tanous10cf50d2025-05-06 16:10:32 -070038static nlohmann::json::object_t getLog(
39 redfish::registries::ResourceEvent::Index name,
40 std::span<const std::string_view> args)
Ed Tanous847deee2024-12-02 15:28:10 -080041{
42 size_t index = static_cast<size_t>(name);
Patrick Williams4a102cd2025-02-27 14:52:54 -050043 if (index >= redfish::registries::ResourceEvent::registry.size())
Ed Tanous847deee2024-12-02 15:28:10 -080044 {
45 return {};
46 }
Patrick Williams4a102cd2025-02-27 14:52:54 -050047 return getLogFromRegistry(redfish::registries::ResourceEvent::header,
48 redfish::registries::ResourceEvent::registry,
Ed Tanous847deee2024-12-02 15:28:10 -080049 index, args);
50}
51
52/**
53 * @internal
54 * @brief Formats ResourceCreated message into JSON
55 *
56 * See header file for more information
57 * @endinternal
58 */
Ed Tanous10cf50d2025-05-06 16:10:32 -070059nlohmann::json::object_t resourceCreated()
Ed Tanous847deee2024-12-02 15:28:10 -080060{
Patrick Williams4a102cd2025-02-27 14:52:54 -050061 return getLog(redfish::registries::ResourceEvent::Index::resourceCreated,
Ed Tanous847deee2024-12-02 15:28:10 -080062 {});
63}
64
65/**
66 * @internal
67 * @brief Formats ResourceRemoved message into JSON
68 *
69 * See header file for more information
70 * @endinternal
71 */
Ed Tanous10cf50d2025-05-06 16:10:32 -070072nlohmann::json::object_t resourceRemoved()
Ed Tanous847deee2024-12-02 15:28:10 -080073{
Patrick Williams4a102cd2025-02-27 14:52:54 -050074 return getLog(redfish::registries::ResourceEvent::Index::resourceRemoved,
Ed Tanous847deee2024-12-02 15:28:10 -080075 {});
76}
77
78/**
79 * @internal
80 * @brief Formats ResourceErrorsDetected message into JSON
81 *
82 * See header file for more information
83 * @endinternal
84 */
Ed Tanous10cf50d2025-05-06 16:10:32 -070085nlohmann::json::object_t resourceErrorsDetected(std::string_view arg1,
86 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -080087{
88 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -050089 redfish::registries::ResourceEvent::Index::resourceErrorsDetected,
Ed Tanous847deee2024-12-02 15:28:10 -080090 std::to_array({arg1, arg2}));
91}
92
93/**
94 * @internal
95 * @brief Formats ResourceErrorsCorrected message into JSON
96 *
97 * See header file for more information
98 * @endinternal
99 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700100nlohmann::json::object_t resourceErrorsCorrected(std::string_view arg1,
101 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800102{
103 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500104 redfish::registries::ResourceEvent::Index::resourceErrorsCorrected,
Ed Tanous847deee2024-12-02 15:28:10 -0800105 std::to_array({arg1, arg2}));
106}
107
108/**
109 * @internal
110 * @brief Formats ResourceErrorThresholdExceeded message into JSON
111 *
112 * See header file for more information
113 * @endinternal
114 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700115nlohmann::json::object_t resourceErrorThresholdExceeded(std::string_view arg1,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700116 uint64_t arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800117{
Ed Tanouse8f66f02025-10-08 15:42:52 -0700118 std::string arg2Str = std::to_string(arg2);
Patrick Williams4a102cd2025-02-27 14:52:54 -0500119 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800120 resourceErrorThresholdExceeded,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700121 std::to_array<std::string_view>({arg1, arg2Str}));
Ed Tanous847deee2024-12-02 15:28:10 -0800122}
123
124/**
125 * @internal
126 * @brief Formats ResourceErrorThresholdCleared message into JSON
127 *
128 * See header file for more information
129 * @endinternal
130 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700131nlohmann::json::object_t resourceErrorThresholdCleared(std::string_view arg1,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700132 uint64_t arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800133{
Ed Tanouse8f66f02025-10-08 15:42:52 -0700134 std::string arg2Str = std::to_string(arg2);
Patrick Williams4a102cd2025-02-27 14:52:54 -0500135 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800136 resourceErrorThresholdCleared,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700137 std::to_array<std::string_view>({arg1, arg2Str}));
Ed Tanous847deee2024-12-02 15:28:10 -0800138}
139
140/**
141 * @internal
142 * @brief Formats ResourceWarningThresholdExceeded message into JSON
143 *
144 * See header file for more information
145 * @endinternal
146 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700147nlohmann::json::object_t resourceWarningThresholdExceeded(std::string_view arg1,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700148 uint64_t arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800149{
Ed Tanouse8f66f02025-10-08 15:42:52 -0700150 std::string arg2Str = std::to_string(arg2);
Patrick Williams4a102cd2025-02-27 14:52:54 -0500151 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800152 resourceWarningThresholdExceeded,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700153 std::to_array<std::string_view>({arg1, arg2Str}));
Ed Tanous847deee2024-12-02 15:28:10 -0800154}
155
156/**
157 * @internal
158 * @brief Formats ResourceWarningThresholdCleared message into JSON
159 *
160 * See header file for more information
161 * @endinternal
162 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700163nlohmann::json::object_t resourceWarningThresholdCleared(std::string_view arg1,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700164 uint64_t arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800165{
Ed Tanouse8f66f02025-10-08 15:42:52 -0700166 std::string arg2Str = std::to_string(arg2);
Patrick Williams4a102cd2025-02-27 14:52:54 -0500167 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800168 resourceWarningThresholdCleared,
Ed Tanouse8f66f02025-10-08 15:42:52 -0700169 std::to_array<std::string_view>({arg1, arg2Str}));
Ed Tanous847deee2024-12-02 15:28:10 -0800170}
171
172/**
173 * @internal
174 * @brief Formats ResourceStatusChangedOK message into JSON
175 *
176 * See header file for more information
177 * @endinternal
178 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700179nlohmann::json::object_t resourceStatusChangedOK(std::string_view arg1,
180 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800181{
182 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500183 redfish::registries::ResourceEvent::Index::resourceStatusChangedOK,
Ed Tanous847deee2024-12-02 15:28:10 -0800184 std::to_array({arg1, arg2}));
185}
186
187/**
188 * @internal
189 * @brief Formats ResourceStatusChangedWarning message into JSON
190 *
191 * See header file for more information
192 * @endinternal
193 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700194nlohmann::json::object_t resourceStatusChangedWarning(std::string_view arg1,
195 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800196{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500197 return getLog(
198 redfish::registries::ResourceEvent::Index::resourceStatusChangedWarning,
199 std::to_array({arg1, arg2}));
Ed Tanous847deee2024-12-02 15:28:10 -0800200}
201
202/**
203 * @internal
204 * @brief Formats ResourceStatusChangedCritical message into JSON
205 *
206 * See header file for more information
207 * @endinternal
208 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700209nlohmann::json::object_t resourceStatusChangedCritical(std::string_view arg1,
210 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800211{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500212 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800213 resourceStatusChangedCritical,
214 std::to_array({arg1, arg2}));
215}
216
217/**
218 * @internal
219 * @brief Formats ResourceStateChanged message into JSON
220 *
221 * See header file for more information
222 * @endinternal
223 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700224nlohmann::json::object_t resourceStateChanged(std::string_view arg1,
225 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800226{
227 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500228 redfish::registries::ResourceEvent::Index::resourceStateChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800229 std::to_array({arg1, arg2}));
230}
231
232/**
233 * @internal
234 * @brief Formats ResourcePoweredOn message into JSON
235 *
236 * See header file for more information
237 * @endinternal
238 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700239nlohmann::json::object_t resourcePoweredOn(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800240{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500241 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOn,
Ed Tanous847deee2024-12-02 15:28:10 -0800242 std::to_array({arg1}));
243}
244
245/**
246 * @internal
247 * @brief Formats ResourcePoweringOn message into JSON
248 *
249 * See header file for more information
250 * @endinternal
251 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700252nlohmann::json::object_t resourcePoweringOn(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800253{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500254 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweringOn,
255 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800256}
257
258/**
259 * @internal
260 * @brief Formats ResourcePoweredOff message into JSON
261 *
262 * See header file for more information
263 * @endinternal
264 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700265nlohmann::json::object_t resourcePoweredOff(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800266{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500267 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOff,
268 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800269}
270
271/**
272 * @internal
273 * @brief Formats ResourcePoweringOff message into JSON
274 *
275 * See header file for more information
276 * @endinternal
277 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700278nlohmann::json::object_t resourcePoweringOff(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800279{
280 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500281 redfish::registries::ResourceEvent::Index::resourcePoweringOff,
Ed Tanous847deee2024-12-02 15:28:10 -0800282 std::to_array({arg1}));
283}
284
285/**
286 * @internal
287 * @brief Formats ResourcePaused message into JSON
288 *
289 * See header file for more information
290 * @endinternal
291 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700292nlohmann::json::object_t resourcePaused(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800293{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500294 return getLog(redfish::registries::ResourceEvent::Index::resourcePaused,
Ed Tanous847deee2024-12-02 15:28:10 -0800295 std::to_array({arg1}));
296}
297
298/**
299 * @internal
300 * @brief Formats URIForResourceChanged message into JSON
301 *
302 * See header file for more information
303 * @endinternal
304 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700305nlohmann::json::object_t uRIForResourceChanged()
Ed Tanous847deee2024-12-02 15:28:10 -0800306{
307 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500308 redfish::registries::ResourceEvent::Index::uRIForResourceChanged, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800309}
310
311/**
312 * @internal
313 * @brief Formats ResourceChanged message into JSON
314 *
315 * See header file for more information
316 * @endinternal
317 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700318nlohmann::json::object_t resourceChanged()
Ed Tanous847deee2024-12-02 15:28:10 -0800319{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500320 return getLog(redfish::registries::ResourceEvent::Index::resourceChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800321 {});
322}
323
324/**
325 * @internal
326 * @brief Formats ResourceVersionIncompatible message into JSON
327 *
328 * See header file for more information
329 * @endinternal
330 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700331nlohmann::json::object_t resourceVersionIncompatible(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800332{
333 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500334 redfish::registries::ResourceEvent::Index::resourceVersionIncompatible,
Ed Tanous847deee2024-12-02 15:28:10 -0800335 std::to_array({arg1}));
336}
337
338/**
339 * @internal
340 * @brief Formats ResourceSelfTestFailed message into JSON
341 *
342 * See header file for more information
343 * @endinternal
344 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700345nlohmann::json::object_t resourceSelfTestFailed(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800346{
347 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500348 redfish::registries::ResourceEvent::Index::resourceSelfTestFailed,
Ed Tanous847deee2024-12-02 15:28:10 -0800349 std::to_array({arg1}));
350}
351
352/**
353 * @internal
354 * @brief Formats ResourceSelfTestCompleted message into JSON
355 *
356 * See header file for more information
357 * @endinternal
358 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700359nlohmann::json::object_t resourceSelfTestCompleted()
Ed Tanous847deee2024-12-02 15:28:10 -0800360{
361 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500362 redfish::registries::ResourceEvent::Index::resourceSelfTestCompleted,
Ed Tanous847deee2024-12-02 15:28:10 -0800363 {});
364}
365
366/**
367 * @internal
368 * @brief Formats TestMessage message into JSON
369 *
370 * See header file for more information
371 * @endinternal
372 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700373nlohmann::json::object_t testMessage()
Ed Tanous847deee2024-12-02 15:28:10 -0800374{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500375 return getLog(redfish::registries::ResourceEvent::Index::testMessage, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800376}
377
378/**
379 * @internal
380 * @brief Formats AggregationSourceDiscovered message into JSON
381 *
382 * See header file for more information
383 * @endinternal
384 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700385nlohmann::json::object_t aggregationSourceDiscovered(std::string_view arg1,
386 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800387{
388 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500389 redfish::registries::ResourceEvent::Index::aggregationSourceDiscovered,
Ed Tanous847deee2024-12-02 15:28:10 -0800390 std::to_array({arg1, arg2}));
391}
392
393/**
394 * @internal
395 * @brief Formats LicenseExpired message into JSON
396 *
397 * See header file for more information
398 * @endinternal
399 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700400nlohmann::json::object_t licenseExpired(std::string_view arg1,
401 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800402{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500403 return getLog(redfish::registries::ResourceEvent::Index::licenseExpired,
Ed Tanous847deee2024-12-02 15:28:10 -0800404 std::to_array({arg1, arg2}));
405}
406
407/**
408 * @internal
409 * @brief Formats LicenseChanged message into JSON
410 *
411 * See header file for more information
412 * @endinternal
413 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700414nlohmann::json::object_t licenseChanged(std::string_view arg1,
415 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800416{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500417 return getLog(redfish::registries::ResourceEvent::Index::licenseChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800418 std::to_array({arg1, arg2}));
419}
420
421/**
422 * @internal
423 * @brief Formats LicenseAdded message into JSON
424 *
425 * See header file for more information
426 * @endinternal
427 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700428nlohmann::json::object_t licenseAdded(std::string_view arg1,
429 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800430{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500431 return getLog(redfish::registries::ResourceEvent::Index::licenseAdded,
Ed Tanous847deee2024-12-02 15:28:10 -0800432 std::to_array({arg1, arg2}));
433}
434
435} // namespace messages
436} // namespace redfish