blob: 55fa8ee9e91d485ae7ae1d242d6841a5db40e7ee [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)
26#include <utility>
27
28namespace redfish
29{
30
31namespace messages
32{
33
Patrick Williams4a102cd2025-02-27 14:52:54 -050034static nlohmann::json getLog(redfish::registries::ResourceEvent::Index name,
Ed Tanous847deee2024-12-02 15:28:10 -080035 std::span<const std::string_view> args)
36{
37 size_t index = static_cast<size_t>(name);
Patrick Williams4a102cd2025-02-27 14:52:54 -050038 if (index >= redfish::registries::ResourceEvent::registry.size())
Ed Tanous847deee2024-12-02 15:28:10 -080039 {
40 return {};
41 }
Patrick Williams4a102cd2025-02-27 14:52:54 -050042 return getLogFromRegistry(redfish::registries::ResourceEvent::header,
43 redfish::registries::ResourceEvent::registry,
Ed Tanous847deee2024-12-02 15:28:10 -080044 index, args);
45}
46
47/**
48 * @internal
49 * @brief Formats ResourceCreated message into JSON
50 *
51 * See header file for more information
52 * @endinternal
53 */
54nlohmann::json resourceCreated()
55{
Patrick Williams4a102cd2025-02-27 14:52:54 -050056 return getLog(redfish::registries::ResourceEvent::Index::resourceCreated,
Ed Tanous847deee2024-12-02 15:28:10 -080057 {});
58}
59
60/**
61 * @internal
62 * @brief Formats ResourceRemoved message into JSON
63 *
64 * See header file for more information
65 * @endinternal
66 */
67nlohmann::json resourceRemoved()
68{
Patrick Williams4a102cd2025-02-27 14:52:54 -050069 return getLog(redfish::registries::ResourceEvent::Index::resourceRemoved,
Ed Tanous847deee2024-12-02 15:28:10 -080070 {});
71}
72
73/**
74 * @internal
75 * @brief Formats ResourceErrorsDetected message into JSON
76 *
77 * See header file for more information
78 * @endinternal
79 */
80nlohmann::json resourceErrorsDetected(std::string_view arg1,
81 std::string_view arg2)
82{
83 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -050084 redfish::registries::ResourceEvent::Index::resourceErrorsDetected,
Ed Tanous847deee2024-12-02 15:28:10 -080085 std::to_array({arg1, arg2}));
86}
87
88/**
89 * @internal
90 * @brief Formats ResourceErrorsCorrected message into JSON
91 *
92 * See header file for more information
93 * @endinternal
94 */
95nlohmann::json resourceErrorsCorrected(std::string_view arg1,
96 std::string_view arg2)
97{
98 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -050099 redfish::registries::ResourceEvent::Index::resourceErrorsCorrected,
Ed Tanous847deee2024-12-02 15:28:10 -0800100 std::to_array({arg1, arg2}));
101}
102
103/**
104 * @internal
105 * @brief Formats ResourceErrorThresholdExceeded message into JSON
106 *
107 * See header file for more information
108 * @endinternal
109 */
Patrick Williams504af5a2025-02-03 14:29:03 -0500110nlohmann::json resourceErrorThresholdExceeded(std::string_view arg1,
111 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800112{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500113 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800114 resourceErrorThresholdExceeded,
115 std::to_array({arg1, arg2}));
116}
117
118/**
119 * @internal
120 * @brief Formats ResourceErrorThresholdCleared message into JSON
121 *
122 * See header file for more information
123 * @endinternal
124 */
Patrick Williams504af5a2025-02-03 14:29:03 -0500125nlohmann::json resourceErrorThresholdCleared(std::string_view arg1,
126 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800127{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500128 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800129 resourceErrorThresholdCleared,
130 std::to_array({arg1, arg2}));
131}
132
133/**
134 * @internal
135 * @brief Formats ResourceWarningThresholdExceeded message into JSON
136 *
137 * See header file for more information
138 * @endinternal
139 */
140nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
141 std::string_view arg2)
142{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500143 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800144 resourceWarningThresholdExceeded,
145 std::to_array({arg1, arg2}));
146}
147
148/**
149 * @internal
150 * @brief Formats ResourceWarningThresholdCleared message into JSON
151 *
152 * See header file for more information
153 * @endinternal
154 */
155nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
156 std::string_view arg2)
157{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500158 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800159 resourceWarningThresholdCleared,
160 std::to_array({arg1, arg2}));
161}
162
163/**
164 * @internal
165 * @brief Formats ResourceStatusChangedOK message into JSON
166 *
167 * See header file for more information
168 * @endinternal
169 */
170nlohmann::json resourceStatusChangedOK(std::string_view arg1,
171 std::string_view arg2)
172{
173 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500174 redfish::registries::ResourceEvent::Index::resourceStatusChangedOK,
Ed Tanous847deee2024-12-02 15:28:10 -0800175 std::to_array({arg1, arg2}));
176}
177
178/**
179 * @internal
180 * @brief Formats ResourceStatusChangedWarning message into JSON
181 *
182 * See header file for more information
183 * @endinternal
184 */
Patrick Williams504af5a2025-02-03 14:29:03 -0500185nlohmann::json resourceStatusChangedWarning(std::string_view arg1,
186 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800187{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500188 return getLog(
189 redfish::registries::ResourceEvent::Index::resourceStatusChangedWarning,
190 std::to_array({arg1, arg2}));
Ed Tanous847deee2024-12-02 15:28:10 -0800191}
192
193/**
194 * @internal
195 * @brief Formats ResourceStatusChangedCritical message into JSON
196 *
197 * See header file for more information
198 * @endinternal
199 */
Patrick Williams504af5a2025-02-03 14:29:03 -0500200nlohmann::json resourceStatusChangedCritical(std::string_view arg1,
201 std::string_view arg2)
Ed Tanous847deee2024-12-02 15:28:10 -0800202{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500203 return getLog(redfish::registries::ResourceEvent::Index::
Ed Tanous847deee2024-12-02 15:28:10 -0800204 resourceStatusChangedCritical,
205 std::to_array({arg1, arg2}));
206}
207
208/**
209 * @internal
210 * @brief Formats ResourceStateChanged message into JSON
211 *
212 * See header file for more information
213 * @endinternal
214 */
215nlohmann::json resourceStateChanged(std::string_view arg1,
216 std::string_view arg2)
217{
218 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500219 redfish::registries::ResourceEvent::Index::resourceStateChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800220 std::to_array({arg1, arg2}));
221}
222
223/**
224 * @internal
225 * @brief Formats ResourcePoweredOn message into JSON
226 *
227 * See header file for more information
228 * @endinternal
229 */
230nlohmann::json resourcePoweredOn(std::string_view arg1)
231{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500232 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOn,
Ed Tanous847deee2024-12-02 15:28:10 -0800233 std::to_array({arg1}));
234}
235
236/**
237 * @internal
238 * @brief Formats ResourcePoweringOn message into JSON
239 *
240 * See header file for more information
241 * @endinternal
242 */
243nlohmann::json resourcePoweringOn(std::string_view arg1)
244{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500245 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweringOn,
246 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800247}
248
249/**
250 * @internal
251 * @brief Formats ResourcePoweredOff message into JSON
252 *
253 * See header file for more information
254 * @endinternal
255 */
256nlohmann::json resourcePoweredOff(std::string_view arg1)
257{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500258 return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOff,
259 std::to_array({arg1}));
Ed Tanous847deee2024-12-02 15:28:10 -0800260}
261
262/**
263 * @internal
264 * @brief Formats ResourcePoweringOff message into JSON
265 *
266 * See header file for more information
267 * @endinternal
268 */
269nlohmann::json resourcePoweringOff(std::string_view arg1)
270{
271 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500272 redfish::registries::ResourceEvent::Index::resourcePoweringOff,
Ed Tanous847deee2024-12-02 15:28:10 -0800273 std::to_array({arg1}));
274}
275
276/**
277 * @internal
278 * @brief Formats ResourcePaused message into JSON
279 *
280 * See header file for more information
281 * @endinternal
282 */
283nlohmann::json resourcePaused(std::string_view arg1)
284{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500285 return getLog(redfish::registries::ResourceEvent::Index::resourcePaused,
Ed Tanous847deee2024-12-02 15:28:10 -0800286 std::to_array({arg1}));
287}
288
289/**
290 * @internal
291 * @brief Formats URIForResourceChanged message into JSON
292 *
293 * See header file for more information
294 * @endinternal
295 */
296nlohmann::json uRIForResourceChanged()
297{
298 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500299 redfish::registries::ResourceEvent::Index::uRIForResourceChanged, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800300}
301
302/**
303 * @internal
304 * @brief Formats ResourceChanged message into JSON
305 *
306 * See header file for more information
307 * @endinternal
308 */
309nlohmann::json resourceChanged()
310{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500311 return getLog(redfish::registries::ResourceEvent::Index::resourceChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800312 {});
313}
314
315/**
316 * @internal
317 * @brief Formats ResourceVersionIncompatible message into JSON
318 *
319 * See header file for more information
320 * @endinternal
321 */
322nlohmann::json resourceVersionIncompatible(std::string_view arg1)
323{
324 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500325 redfish::registries::ResourceEvent::Index::resourceVersionIncompatible,
Ed Tanous847deee2024-12-02 15:28:10 -0800326 std::to_array({arg1}));
327}
328
329/**
330 * @internal
331 * @brief Formats ResourceSelfTestFailed message into JSON
332 *
333 * See header file for more information
334 * @endinternal
335 */
336nlohmann::json resourceSelfTestFailed(std::string_view arg1)
337{
338 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500339 redfish::registries::ResourceEvent::Index::resourceSelfTestFailed,
Ed Tanous847deee2024-12-02 15:28:10 -0800340 std::to_array({arg1}));
341}
342
343/**
344 * @internal
345 * @brief Formats ResourceSelfTestCompleted message into JSON
346 *
347 * See header file for more information
348 * @endinternal
349 */
350nlohmann::json resourceSelfTestCompleted()
351{
352 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500353 redfish::registries::ResourceEvent::Index::resourceSelfTestCompleted,
Ed Tanous847deee2024-12-02 15:28:10 -0800354 {});
355}
356
357/**
358 * @internal
359 * @brief Formats TestMessage message into JSON
360 *
361 * See header file for more information
362 * @endinternal
363 */
364nlohmann::json testMessage()
365{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500366 return getLog(redfish::registries::ResourceEvent::Index::testMessage, {});
Ed Tanous847deee2024-12-02 15:28:10 -0800367}
368
369/**
370 * @internal
371 * @brief Formats AggregationSourceDiscovered message into JSON
372 *
373 * See header file for more information
374 * @endinternal
375 */
376nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
377 std::string_view arg2)
378{
379 return getLog(
Patrick Williams4a102cd2025-02-27 14:52:54 -0500380 redfish::registries::ResourceEvent::Index::aggregationSourceDiscovered,
Ed Tanous847deee2024-12-02 15:28:10 -0800381 std::to_array({arg1, arg2}));
382}
383
384/**
385 * @internal
386 * @brief Formats LicenseExpired message into JSON
387 *
388 * See header file for more information
389 * @endinternal
390 */
391nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2)
392{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500393 return getLog(redfish::registries::ResourceEvent::Index::licenseExpired,
Ed Tanous847deee2024-12-02 15:28:10 -0800394 std::to_array({arg1, arg2}));
395}
396
397/**
398 * @internal
399 * @brief Formats LicenseChanged message into JSON
400 *
401 * See header file for more information
402 * @endinternal
403 */
404nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2)
405{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500406 return getLog(redfish::registries::ResourceEvent::Index::licenseChanged,
Ed Tanous847deee2024-12-02 15:28:10 -0800407 std::to_array({arg1, arg2}));
408}
409
410/**
411 * @internal
412 * @brief Formats LicenseAdded message into JSON
413 *
414 * See header file for more information
415 * @endinternal
416 */
417nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2)
418{
Patrick Williams4a102cd2025-02-27 14:52:54 -0500419 return getLog(redfish::registries::ResourceEvent::Index::licenseAdded,
Ed Tanous847deee2024-12-02 15:28:10 -0800420 std::to_array({arg1, arg2}));
421}
422
423} // namespace messages
424} // namespace redfish