blob: 74d8bd042821600df2c914294ce01b641e64242c [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,
116 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800117{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500118 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800119 resourceErrorThresholdExceeded,
120 std::to_array({arg1, arg2}));
121}
122
123/**
124 * @internal
125 * @brief Formats ResourceErrorThresholdCleared message into JSON
126 *
127 * See header file for more information
128 * @endinternal
129 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700130nlohmann::json::object_t resourceErrorThresholdCleared(std::string_view arg1,
131 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800132{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500133 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800134 resourceErrorThresholdCleared,
135 std::to_array({arg1, arg2}));
136}
137
138/**
139 * @internal
140 * @brief Formats ResourceWarningThresholdExceeded message into JSON
141 *
142 * See header file for more information
143 * @endinternal
144 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700145nlohmann::json::object_t resourceWarningThresholdExceeded(std::string_view arg1,
146 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800147{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500148 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800149 resourceWarningThresholdExceeded,
150 std::to_array({arg1, arg2}));
151}
152
153/**
154 * @internal
155 * @brief Formats ResourceWarningThresholdCleared message into JSON
156 *
157 * See header file for more information
158 * @endinternal
159 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700160nlohmann::json::object_t resourceWarningThresholdCleared(std::string_view arg1,
161 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800162{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500163 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800164 resourceWarningThresholdCleared,
165 std::to_array({arg1, arg2}));
166}
167
168/**
169 * @internal
170 * @brief Formats ResourceStatusChangedOK message into JSON
171 *
172 * See header file for more information
173 * @endinternal
174 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700175nlohmann::json::object_t resourceStatusChangedOK(std::string_view arg1,
176 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800177{
178 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500179 redfish::registries::ResourceEvent::Index::resourceStatusChangedOK,
Ed Tanous847deee2024-12-02 15:28:10 -0800180 std::to_array({arg1, arg2}));
181}
182
183/**
184 * @internal
185 * @brief Formats ResourceStatusChangedWarning message into JSON
186 *
187 * See header file for more information
188 * @endinternal
189 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700190nlohmann::json::object_t resourceStatusChangedWarning(std::string_view arg1,
191 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800192{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500193 return getLog(
194 redfish::registries::ResourceEvent::Index::resourceStatusChangedWarning,
195 std::to_array({arg1, arg2}));
Ed Tanous847deee2024-12-02 15:28:10 -0800196}
197
198/**
199 * @internal
200 * @brief Formats ResourceStatusChangedCritical message into JSON
201 *
202 * See header file for more information
203 * @endinternal
204 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700205nlohmann::json::object_t resourceStatusChangedCritical(std::string_view arg1,
206 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800207{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500208 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800209 resourceStatusChangedCritical,
210 std::to_array({arg1, arg2}));
211}
212
213/**
214 * @internal
215 * @brief Formats ResourceStateChanged message into JSON
216 *
217 * See header file for more information
218 * @endinternal
219 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700220nlohmann::json::object_t resourceStateChanged(std::string_view arg1,
221 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800222{
223 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500224 redfish::registries::ResourceEvent::Index::resourceStateChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800225 std::to_array({arg1, arg2}));
226}
227
228/**
229 * @internal
230 * @brief Formats ResourcePoweredOn message into JSON
231 *
232 * See header file for more information
233 * @endinternal
234 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700235nlohmann::json::object_t resourcePoweredOn(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800236{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500237 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOn,
Ed Tanous847deee2024-12-02 15:28:10 -0800238 std::to_array({arg1}));
239}
240
241/**
242 * @internal
243 * @brief Formats ResourcePoweringOn message into JSON
244 *
245 * See header file for more information
246 * @endinternal
247 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700248nlohmann::json::object_t resourcePoweringOn(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800249{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500250 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweringOn,
251 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800252}
253
254/**
255 * @internal
256 * @brief Formats ResourcePoweredOff message into JSON
257 *
258 * See header file for more information
259 * @endinternal
260 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700261nlohmann::json::object_t resourcePoweredOff(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800262{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500263 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOff,
264 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800265}
266
267/**
268 * @internal
269 * @brief Formats ResourcePoweringOff message into JSON
270 *
271 * See header file for more information
272 * @endinternal
273 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700274nlohmann::json::object_t resourcePoweringOff(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800275{
276 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500277 redfish::registries::ResourceEvent::Index::resourcePoweringOff,
Ed Tanous847deee2024-12-02 15:28:10 -0800278 std::to_array({arg1}));
279}
280
281/**
282 * @internal
283 * @brief Formats ResourcePaused message into JSON
284 *
285 * See header file for more information
286 * @endinternal
287 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700288nlohmann::json::object_t resourcePaused(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800289{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500290 return getLog(redfish::registries::ResourceEvent::Index::resourcePaused,
Ed Tanous847deee2024-12-02 15:28:10 -0800291 std::to_array({arg1}));
292}
293
294/**
295 * @internal
296 * @brief Formats URIForResourceChanged message into JSON
297 *
298 * See header file for more information
299 * @endinternal
300 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700301nlohmann::json::object_t uRIForResourceChanged()
Ed Tanous847deee2024-12-02 15:28:10 -0800302{
303 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500304 redfish::registries::ResourceEvent::Index::uRIForResourceChanged, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800305}
306
307/**
308 * @internal
309 * @brief Formats ResourceChanged message into JSON
310 *
311 * See header file for more information
312 * @endinternal
313 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700314nlohmann::json::object_t resourceChanged()
Ed Tanous847deee2024-12-02 15:28:10 -0800315{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500316 return getLog(redfish::registries::ResourceEvent::Index::resourceChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800317 {});
318}
319
320/**
321 * @internal
322 * @brief Formats ResourceVersionIncompatible message into JSON
323 *
324 * See header file for more information
325 * @endinternal
326 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700327nlohmann::json::object_t resourceVersionIncompatible(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800328{
329 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500330 redfish::registries::ResourceEvent::Index::resourceVersionIncompatible,
Ed Tanous847deee2024-12-02 15:28:10 -0800331 std::to_array({arg1}));
332}
333
334/**
335 * @internal
336 * @brief Formats ResourceSelfTestFailed message into JSON
337 *
338 * See header file for more information
339 * @endinternal
340 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700341nlohmann::json::object_t resourceSelfTestFailed(std::string_view arg1)
Ed Tanous847deee2024-12-02 15:28:10 -0800342{
343 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500344 redfish::registries::ResourceEvent::Index::resourceSelfTestFailed,
Ed Tanous847deee2024-12-02 15:28:10 -0800345 std::to_array({arg1}));
346}
347
348/**
349 * @internal
350 * @brief Formats ResourceSelfTestCompleted message into JSON
351 *
352 * See header file for more information
353 * @endinternal
354 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700355nlohmann::json::object_t resourceSelfTestCompleted()
Ed Tanous847deee2024-12-02 15:28:10 -0800356{
357 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500358 redfish::registries::ResourceEvent::Index::resourceSelfTestCompleted,
Ed Tanous847deee2024-12-02 15:28:10 -0800359 {});
360}
361
362/**
363 * @internal
364 * @brief Formats TestMessage message into JSON
365 *
366 * See header file for more information
367 * @endinternal
368 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700369nlohmann::json::object_t testMessage()
Ed Tanous847deee2024-12-02 15:28:10 -0800370{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500371 return getLog(redfish::registries::ResourceEvent::Index::testMessage, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800372}
373
374/**
375 * @internal
376 * @brief Formats AggregationSourceDiscovered message into JSON
377 *
378 * See header file for more information
379 * @endinternal
380 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700381nlohmann::json::object_t aggregationSourceDiscovered(std::string_view arg1,
382 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800383{
384 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500385 redfish::registries::ResourceEvent::Index::aggregationSourceDiscovered,
Ed Tanous847deee2024-12-02 15:28:10 -0800386 std::to_array({arg1, arg2}));
387}
388
389/**
390 * @internal
391 * @brief Formats LicenseExpired message into JSON
392 *
393 * See header file for more information
394 * @endinternal
395 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700396nlohmann::json::object_t licenseExpired(std::string_view arg1,
397 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800398{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500399 return getLog(redfish::registries::ResourceEvent::Index::licenseExpired,
Ed Tanous847deee2024-12-02 15:28:10 -0800400 std::to_array({arg1, arg2}));
401}
402
403/**
404 * @internal
405 * @brief Formats LicenseChanged message into JSON
406 *
407 * See header file for more information
408 * @endinternal
409 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700410nlohmann::json::object_t licenseChanged(std::string_view arg1,
411 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800412{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500413 return getLog(redfish::registries::ResourceEvent::Index::licenseChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800414 std::to_array({arg1, arg2}));
415}
416
417/**
418 * @internal
419 * @brief Formats LicenseAdded message into JSON
420 *
421 * See header file for more information
422 * @endinternal
423 */
Ed Tanous10cf50d2025-05-06 16:10:32 -0700424nlohmann::json::object_t licenseAdded(std::string_view arg1,
425 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800426{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500427 return getLog(redfish::registries::ResourceEvent::Index::licenseAdded,
Ed Tanous847deee2024-12-02 15:28:10 -0800428 std::to_array({arg1, arg2}));
429}
430
431} // namespace messages
432} // namespace redfish