xref: /openbmc/bmcweb/features/redfish/src/resource_messages.cpp (revision 847deee3c8bf291c9f0988d9dc1662861651951e)
1*847deee3SEd Tanous /****************************************************************
2*847deee3SEd Tanous  *                 READ THIS WARNING FIRST
3*847deee3SEd Tanous  * This is an auto-generated header which contains definitions
4*847deee3SEd Tanous  * for Redfish DMTF defined messages.
5*847deee3SEd Tanous  * DO NOT modify this registry outside of running the
6*847deee3SEd Tanous  * parse_registries.py script.  The definitions contained within
7*847deee3SEd Tanous  * this file are owned by DMTF.  Any modifications to these files
8*847deee3SEd Tanous  * should be first pushed to the relevant registry in the DMTF
9*847deee3SEd Tanous  * github organization.
10*847deee3SEd Tanous  ***************************************************************/
11*847deee3SEd Tanous #include "resource_messages.hpp"
12*847deee3SEd Tanous 
13*847deee3SEd Tanous #include "registries.hpp"
14*847deee3SEd Tanous #include "registries/resource_event_message_registry.hpp"
15*847deee3SEd Tanous 
16*847deee3SEd Tanous #include <nlohmann/json.hpp>
17*847deee3SEd Tanous 
18*847deee3SEd Tanous #include <array>
19*847deee3SEd Tanous #include <cstddef>
20*847deee3SEd Tanous #include <span>
21*847deee3SEd Tanous #include <string_view>
22*847deee3SEd Tanous 
23*847deee3SEd Tanous // Clang can't seem to decide whether this header needs to be included or not,
24*847deee3SEd Tanous // and is inconsistent.  Include it for now
25*847deee3SEd Tanous // NOLINTNEXTLINE(misc-include-cleaner)
26*847deee3SEd Tanous #include <utility>
27*847deee3SEd Tanous 
28*847deee3SEd Tanous namespace redfish
29*847deee3SEd Tanous {
30*847deee3SEd Tanous 
31*847deee3SEd Tanous namespace messages
32*847deee3SEd Tanous {
33*847deee3SEd Tanous 
34*847deee3SEd Tanous static nlohmann::json getLog(redfish::registries::resource_event::Index name,
35*847deee3SEd Tanous                              std::span<const std::string_view> args)
36*847deee3SEd Tanous {
37*847deee3SEd Tanous     size_t index = static_cast<size_t>(name);
38*847deee3SEd Tanous     if (index >= redfish::registries::resource_event::registry.size())
39*847deee3SEd Tanous     {
40*847deee3SEd Tanous         return {};
41*847deee3SEd Tanous     }
42*847deee3SEd Tanous     return getLogFromRegistry(redfish::registries::resource_event::header,
43*847deee3SEd Tanous                               redfish::registries::resource_event::registry,
44*847deee3SEd Tanous                               index, args);
45*847deee3SEd Tanous }
46*847deee3SEd Tanous 
47*847deee3SEd Tanous /**
48*847deee3SEd Tanous  * @internal
49*847deee3SEd Tanous  * @brief Formats ResourceCreated message into JSON
50*847deee3SEd Tanous  *
51*847deee3SEd Tanous  * See header file for more information
52*847deee3SEd Tanous  * @endinternal
53*847deee3SEd Tanous  */
54*847deee3SEd Tanous nlohmann::json resourceCreated()
55*847deee3SEd Tanous {
56*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourceCreated,
57*847deee3SEd Tanous                   {});
58*847deee3SEd Tanous }
59*847deee3SEd Tanous 
60*847deee3SEd Tanous /**
61*847deee3SEd Tanous  * @internal
62*847deee3SEd Tanous  * @brief Formats ResourceRemoved message into JSON
63*847deee3SEd Tanous  *
64*847deee3SEd Tanous  * See header file for more information
65*847deee3SEd Tanous  * @endinternal
66*847deee3SEd Tanous  */
67*847deee3SEd Tanous nlohmann::json resourceRemoved()
68*847deee3SEd Tanous {
69*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourceRemoved,
70*847deee3SEd Tanous                   {});
71*847deee3SEd Tanous }
72*847deee3SEd Tanous 
73*847deee3SEd Tanous /**
74*847deee3SEd Tanous  * @internal
75*847deee3SEd Tanous  * @brief Formats ResourceErrorsDetected message into JSON
76*847deee3SEd Tanous  *
77*847deee3SEd Tanous  * See header file for more information
78*847deee3SEd Tanous  * @endinternal
79*847deee3SEd Tanous  */
80*847deee3SEd Tanous nlohmann::json resourceErrorsDetected(std::string_view arg1,
81*847deee3SEd Tanous                                       std::string_view arg2)
82*847deee3SEd Tanous {
83*847deee3SEd Tanous     return getLog(
84*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceErrorsDetected,
85*847deee3SEd Tanous         std::to_array({arg1, arg2}));
86*847deee3SEd Tanous }
87*847deee3SEd Tanous 
88*847deee3SEd Tanous /**
89*847deee3SEd Tanous  * @internal
90*847deee3SEd Tanous  * @brief Formats ResourceErrorsCorrected message into JSON
91*847deee3SEd Tanous  *
92*847deee3SEd Tanous  * See header file for more information
93*847deee3SEd Tanous  * @endinternal
94*847deee3SEd Tanous  */
95*847deee3SEd Tanous nlohmann::json resourceErrorsCorrected(std::string_view arg1,
96*847deee3SEd Tanous                                        std::string_view arg2)
97*847deee3SEd Tanous {
98*847deee3SEd Tanous     return getLog(
99*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceErrorsCorrected,
100*847deee3SEd Tanous         std::to_array({arg1, arg2}));
101*847deee3SEd Tanous }
102*847deee3SEd Tanous 
103*847deee3SEd Tanous /**
104*847deee3SEd Tanous  * @internal
105*847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdExceeded message into JSON
106*847deee3SEd Tanous  *
107*847deee3SEd Tanous  * See header file for more information
108*847deee3SEd Tanous  * @endinternal
109*847deee3SEd Tanous  */
110*847deee3SEd Tanous nlohmann::json
111*847deee3SEd Tanous     resourceErrorThresholdExceeded(std::string_view arg1, std::string_view arg2)
112*847deee3SEd Tanous {
113*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
114*847deee3SEd Tanous                       resourceErrorThresholdExceeded,
115*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
116*847deee3SEd Tanous }
117*847deee3SEd Tanous 
118*847deee3SEd Tanous /**
119*847deee3SEd Tanous  * @internal
120*847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdCleared message into JSON
121*847deee3SEd Tanous  *
122*847deee3SEd Tanous  * See header file for more information
123*847deee3SEd Tanous  * @endinternal
124*847deee3SEd Tanous  */
125*847deee3SEd Tanous nlohmann::json
126*847deee3SEd Tanous     resourceErrorThresholdCleared(std::string_view arg1, std::string_view arg2)
127*847deee3SEd Tanous {
128*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
129*847deee3SEd Tanous                       resourceErrorThresholdCleared,
130*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
131*847deee3SEd Tanous }
132*847deee3SEd Tanous 
133*847deee3SEd Tanous /**
134*847deee3SEd Tanous  * @internal
135*847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdExceeded message into JSON
136*847deee3SEd Tanous  *
137*847deee3SEd Tanous  * See header file for more information
138*847deee3SEd Tanous  * @endinternal
139*847deee3SEd Tanous  */
140*847deee3SEd Tanous nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
141*847deee3SEd Tanous                                                 std::string_view arg2)
142*847deee3SEd Tanous {
143*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
144*847deee3SEd Tanous                       resourceWarningThresholdExceeded,
145*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
146*847deee3SEd Tanous }
147*847deee3SEd Tanous 
148*847deee3SEd Tanous /**
149*847deee3SEd Tanous  * @internal
150*847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdCleared message into JSON
151*847deee3SEd Tanous  *
152*847deee3SEd Tanous  * See header file for more information
153*847deee3SEd Tanous  * @endinternal
154*847deee3SEd Tanous  */
155*847deee3SEd Tanous nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
156*847deee3SEd Tanous                                                std::string_view arg2)
157*847deee3SEd Tanous {
158*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
159*847deee3SEd Tanous                       resourceWarningThresholdCleared,
160*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
161*847deee3SEd Tanous }
162*847deee3SEd Tanous 
163*847deee3SEd Tanous /**
164*847deee3SEd Tanous  * @internal
165*847deee3SEd Tanous  * @brief Formats ResourceStatusChangedOK message into JSON
166*847deee3SEd Tanous  *
167*847deee3SEd Tanous  * See header file for more information
168*847deee3SEd Tanous  * @endinternal
169*847deee3SEd Tanous  */
170*847deee3SEd Tanous nlohmann::json resourceStatusChangedOK(std::string_view arg1,
171*847deee3SEd Tanous                                        std::string_view arg2)
172*847deee3SEd Tanous {
173*847deee3SEd Tanous     return getLog(
174*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceStatusChangedOK,
175*847deee3SEd Tanous         std::to_array({arg1, arg2}));
176*847deee3SEd Tanous }
177*847deee3SEd Tanous 
178*847deee3SEd Tanous /**
179*847deee3SEd Tanous  * @internal
180*847deee3SEd Tanous  * @brief Formats ResourceStatusChangedWarning message into JSON
181*847deee3SEd Tanous  *
182*847deee3SEd Tanous  * See header file for more information
183*847deee3SEd Tanous  * @endinternal
184*847deee3SEd Tanous  */
185*847deee3SEd Tanous nlohmann::json
186*847deee3SEd Tanous     resourceStatusChangedWarning(std::string_view arg1, std::string_view arg2)
187*847deee3SEd Tanous {
188*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
189*847deee3SEd Tanous                       resourceStatusChangedWarning,
190*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
191*847deee3SEd Tanous }
192*847deee3SEd Tanous 
193*847deee3SEd Tanous /**
194*847deee3SEd Tanous  * @internal
195*847deee3SEd Tanous  * @brief Formats ResourceStatusChangedCritical message into JSON
196*847deee3SEd Tanous  *
197*847deee3SEd Tanous  * See header file for more information
198*847deee3SEd Tanous  * @endinternal
199*847deee3SEd Tanous  */
200*847deee3SEd Tanous nlohmann::json
201*847deee3SEd Tanous     resourceStatusChangedCritical(std::string_view arg1, std::string_view arg2)
202*847deee3SEd Tanous {
203*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
204*847deee3SEd Tanous                       resourceStatusChangedCritical,
205*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
206*847deee3SEd Tanous }
207*847deee3SEd Tanous 
208*847deee3SEd Tanous /**
209*847deee3SEd Tanous  * @internal
210*847deee3SEd Tanous  * @brief Formats ResourceStateChanged message into JSON
211*847deee3SEd Tanous  *
212*847deee3SEd Tanous  * See header file for more information
213*847deee3SEd Tanous  * @endinternal
214*847deee3SEd Tanous  */
215*847deee3SEd Tanous nlohmann::json resourceStateChanged(std::string_view arg1,
216*847deee3SEd Tanous                                     std::string_view arg2)
217*847deee3SEd Tanous {
218*847deee3SEd Tanous     return getLog(
219*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceStateChanged,
220*847deee3SEd Tanous         std::to_array({arg1, arg2}));
221*847deee3SEd Tanous }
222*847deee3SEd Tanous 
223*847deee3SEd Tanous /**
224*847deee3SEd Tanous  * @internal
225*847deee3SEd Tanous  * @brief Formats ResourcePoweredOn message into JSON
226*847deee3SEd Tanous  *
227*847deee3SEd Tanous  * See header file for more information
228*847deee3SEd Tanous  * @endinternal
229*847deee3SEd Tanous  */
230*847deee3SEd Tanous nlohmann::json resourcePoweredOn(std::string_view arg1)
231*847deee3SEd Tanous {
232*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourcePoweredOn,
233*847deee3SEd Tanous                   std::to_array({arg1}));
234*847deee3SEd Tanous }
235*847deee3SEd Tanous 
236*847deee3SEd Tanous /**
237*847deee3SEd Tanous  * @internal
238*847deee3SEd Tanous  * @brief Formats ResourcePoweringOn message into JSON
239*847deee3SEd Tanous  *
240*847deee3SEd Tanous  * See header file for more information
241*847deee3SEd Tanous  * @endinternal
242*847deee3SEd Tanous  */
243*847deee3SEd Tanous nlohmann::json resourcePoweringOn(std::string_view arg1)
244*847deee3SEd Tanous {
245*847deee3SEd Tanous     return getLog(
246*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourcePoweringOn,
247*847deee3SEd Tanous         std::to_array({arg1}));
248*847deee3SEd Tanous }
249*847deee3SEd Tanous 
250*847deee3SEd Tanous /**
251*847deee3SEd Tanous  * @internal
252*847deee3SEd Tanous  * @brief Formats ResourcePoweredOff message into JSON
253*847deee3SEd Tanous  *
254*847deee3SEd Tanous  * See header file for more information
255*847deee3SEd Tanous  * @endinternal
256*847deee3SEd Tanous  */
257*847deee3SEd Tanous nlohmann::json resourcePoweredOff(std::string_view arg1)
258*847deee3SEd Tanous {
259*847deee3SEd Tanous     return getLog(
260*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourcePoweredOff,
261*847deee3SEd Tanous         std::to_array({arg1}));
262*847deee3SEd Tanous }
263*847deee3SEd Tanous 
264*847deee3SEd Tanous /**
265*847deee3SEd Tanous  * @internal
266*847deee3SEd Tanous  * @brief Formats ResourcePoweringOff message into JSON
267*847deee3SEd Tanous  *
268*847deee3SEd Tanous  * See header file for more information
269*847deee3SEd Tanous  * @endinternal
270*847deee3SEd Tanous  */
271*847deee3SEd Tanous nlohmann::json resourcePoweringOff(std::string_view arg1)
272*847deee3SEd Tanous {
273*847deee3SEd Tanous     return getLog(
274*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourcePoweringOff,
275*847deee3SEd Tanous         std::to_array({arg1}));
276*847deee3SEd Tanous }
277*847deee3SEd Tanous 
278*847deee3SEd Tanous /**
279*847deee3SEd Tanous  * @internal
280*847deee3SEd Tanous  * @brief Formats ResourcePaused message into JSON
281*847deee3SEd Tanous  *
282*847deee3SEd Tanous  * See header file for more information
283*847deee3SEd Tanous  * @endinternal
284*847deee3SEd Tanous  */
285*847deee3SEd Tanous nlohmann::json resourcePaused(std::string_view arg1)
286*847deee3SEd Tanous {
287*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourcePaused,
288*847deee3SEd Tanous                   std::to_array({arg1}));
289*847deee3SEd Tanous }
290*847deee3SEd Tanous 
291*847deee3SEd Tanous /**
292*847deee3SEd Tanous  * @internal
293*847deee3SEd Tanous  * @brief Formats URIForResourceChanged message into JSON
294*847deee3SEd Tanous  *
295*847deee3SEd Tanous  * See header file for more information
296*847deee3SEd Tanous  * @endinternal
297*847deee3SEd Tanous  */
298*847deee3SEd Tanous nlohmann::json uRIForResourceChanged()
299*847deee3SEd Tanous {
300*847deee3SEd Tanous     return getLog(
301*847deee3SEd Tanous         redfish::registries::resource_event::Index::uRIForResourceChanged, {});
302*847deee3SEd Tanous }
303*847deee3SEd Tanous 
304*847deee3SEd Tanous /**
305*847deee3SEd Tanous  * @internal
306*847deee3SEd Tanous  * @brief Formats ResourceChanged message into JSON
307*847deee3SEd Tanous  *
308*847deee3SEd Tanous  * See header file for more information
309*847deee3SEd Tanous  * @endinternal
310*847deee3SEd Tanous  */
311*847deee3SEd Tanous nlohmann::json resourceChanged()
312*847deee3SEd Tanous {
313*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourceChanged,
314*847deee3SEd Tanous                   {});
315*847deee3SEd Tanous }
316*847deee3SEd Tanous 
317*847deee3SEd Tanous /**
318*847deee3SEd Tanous  * @internal
319*847deee3SEd Tanous  * @brief Formats ResourceVersionIncompatible message into JSON
320*847deee3SEd Tanous  *
321*847deee3SEd Tanous  * See header file for more information
322*847deee3SEd Tanous  * @endinternal
323*847deee3SEd Tanous  */
324*847deee3SEd Tanous nlohmann::json resourceVersionIncompatible(std::string_view arg1)
325*847deee3SEd Tanous {
326*847deee3SEd Tanous     return getLog(
327*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceVersionIncompatible,
328*847deee3SEd Tanous         std::to_array({arg1}));
329*847deee3SEd Tanous }
330*847deee3SEd Tanous 
331*847deee3SEd Tanous /**
332*847deee3SEd Tanous  * @internal
333*847deee3SEd Tanous  * @brief Formats ResourceSelfTestFailed message into JSON
334*847deee3SEd Tanous  *
335*847deee3SEd Tanous  * See header file for more information
336*847deee3SEd Tanous  * @endinternal
337*847deee3SEd Tanous  */
338*847deee3SEd Tanous nlohmann::json resourceSelfTestFailed(std::string_view arg1)
339*847deee3SEd Tanous {
340*847deee3SEd Tanous     return getLog(
341*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceSelfTestFailed,
342*847deee3SEd Tanous         std::to_array({arg1}));
343*847deee3SEd Tanous }
344*847deee3SEd Tanous 
345*847deee3SEd Tanous /**
346*847deee3SEd Tanous  * @internal
347*847deee3SEd Tanous  * @brief Formats ResourceSelfTestCompleted message into JSON
348*847deee3SEd Tanous  *
349*847deee3SEd Tanous  * See header file for more information
350*847deee3SEd Tanous  * @endinternal
351*847deee3SEd Tanous  */
352*847deee3SEd Tanous nlohmann::json resourceSelfTestCompleted()
353*847deee3SEd Tanous {
354*847deee3SEd Tanous     return getLog(
355*847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceSelfTestCompleted,
356*847deee3SEd Tanous         {});
357*847deee3SEd Tanous }
358*847deee3SEd Tanous 
359*847deee3SEd Tanous /**
360*847deee3SEd Tanous  * @internal
361*847deee3SEd Tanous  * @brief Formats TestMessage message into JSON
362*847deee3SEd Tanous  *
363*847deee3SEd Tanous  * See header file for more information
364*847deee3SEd Tanous  * @endinternal
365*847deee3SEd Tanous  */
366*847deee3SEd Tanous nlohmann::json testMessage()
367*847deee3SEd Tanous {
368*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::testMessage, {});
369*847deee3SEd Tanous }
370*847deee3SEd Tanous 
371*847deee3SEd Tanous /**
372*847deee3SEd Tanous  * @internal
373*847deee3SEd Tanous  * @brief Formats AggregationSourceDiscovered message into JSON
374*847deee3SEd Tanous  *
375*847deee3SEd Tanous  * See header file for more information
376*847deee3SEd Tanous  * @endinternal
377*847deee3SEd Tanous  */
378*847deee3SEd Tanous nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
379*847deee3SEd Tanous                                            std::string_view arg2)
380*847deee3SEd Tanous {
381*847deee3SEd Tanous     return getLog(
382*847deee3SEd Tanous         redfish::registries::resource_event::Index::aggregationSourceDiscovered,
383*847deee3SEd Tanous         std::to_array({arg1, arg2}));
384*847deee3SEd Tanous }
385*847deee3SEd Tanous 
386*847deee3SEd Tanous /**
387*847deee3SEd Tanous  * @internal
388*847deee3SEd Tanous  * @brief Formats LicenseExpired message into JSON
389*847deee3SEd Tanous  *
390*847deee3SEd Tanous  * See header file for more information
391*847deee3SEd Tanous  * @endinternal
392*847deee3SEd Tanous  */
393*847deee3SEd Tanous nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2)
394*847deee3SEd Tanous {
395*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::licenseExpired,
396*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
397*847deee3SEd Tanous }
398*847deee3SEd Tanous 
399*847deee3SEd Tanous /**
400*847deee3SEd Tanous  * @internal
401*847deee3SEd Tanous  * @brief Formats LicenseChanged message into JSON
402*847deee3SEd Tanous  *
403*847deee3SEd Tanous  * See header file for more information
404*847deee3SEd Tanous  * @endinternal
405*847deee3SEd Tanous  */
406*847deee3SEd Tanous nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2)
407*847deee3SEd Tanous {
408*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::licenseChanged,
409*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
410*847deee3SEd Tanous }
411*847deee3SEd Tanous 
412*847deee3SEd Tanous /**
413*847deee3SEd Tanous  * @internal
414*847deee3SEd Tanous  * @brief Formats LicenseAdded message into JSON
415*847deee3SEd Tanous  *
416*847deee3SEd Tanous  * See header file for more information
417*847deee3SEd Tanous  * @endinternal
418*847deee3SEd Tanous  */
419*847deee3SEd Tanous nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2)
420*847deee3SEd Tanous {
421*847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::licenseAdded,
422*847deee3SEd Tanous                   std::to_array({arg1, arg2}));
423*847deee3SEd Tanous }
424*847deee3SEd Tanous 
425*847deee3SEd Tanous } // namespace messages
426*847deee3SEd Tanous } // namespace redfish
427