xref: /openbmc/bmcweb/features/redfish/src/resource_messages.cpp (revision 4a102cd48c588d32c0a4d6610b4a9ed616f255f3)
1847deee3SEd Tanous /****************************************************************
2847deee3SEd Tanous  *                 READ THIS WARNING FIRST
3847deee3SEd Tanous  * This is an auto-generated header which contains definitions
4847deee3SEd Tanous  * for Redfish DMTF defined messages.
5847deee3SEd Tanous  * DO NOT modify this registry outside of running the
6847deee3SEd Tanous  * parse_registries.py script.  The definitions contained within
7847deee3SEd Tanous  * this file are owned by DMTF.  Any modifications to these files
8847deee3SEd Tanous  * should be first pushed to the relevant registry in the DMTF
9847deee3SEd Tanous  * github organization.
10847deee3SEd Tanous  ***************************************************************/
11847deee3SEd Tanous #include "resource_messages.hpp"
12847deee3SEd Tanous 
13847deee3SEd Tanous #include "registries.hpp"
14847deee3SEd Tanous #include "registries/resource_event_message_registry.hpp"
15847deee3SEd Tanous 
16847deee3SEd Tanous #include <nlohmann/json.hpp>
17847deee3SEd Tanous 
18847deee3SEd Tanous #include <array>
19847deee3SEd Tanous #include <cstddef>
20847deee3SEd Tanous #include <span>
21847deee3SEd Tanous #include <string_view>
22847deee3SEd Tanous 
23847deee3SEd Tanous // Clang can't seem to decide whether this header needs to be included or not,
24847deee3SEd Tanous // and is inconsistent.  Include it for now
25847deee3SEd Tanous // NOLINTNEXTLINE(misc-include-cleaner)
26847deee3SEd Tanous #include <utility>
27847deee3SEd Tanous 
28847deee3SEd Tanous namespace redfish
29847deee3SEd Tanous {
30847deee3SEd Tanous 
31847deee3SEd Tanous namespace messages
32847deee3SEd Tanous {
33847deee3SEd Tanous 
34*4a102cd4SPatrick Williams static nlohmann::json getLog(redfish::registries::ResourceEvent::Index name,
35847deee3SEd Tanous                              std::span<const std::string_view> args)
36847deee3SEd Tanous {
37847deee3SEd Tanous     size_t index = static_cast<size_t>(name);
38*4a102cd4SPatrick Williams     if (index >= redfish::registries::ResourceEvent::registry.size())
39847deee3SEd Tanous     {
40847deee3SEd Tanous         return {};
41847deee3SEd Tanous     }
42*4a102cd4SPatrick Williams     return getLogFromRegistry(redfish::registries::ResourceEvent::header,
43*4a102cd4SPatrick Williams                               redfish::registries::ResourceEvent::registry,
44847deee3SEd Tanous                               index, args);
45847deee3SEd Tanous }
46847deee3SEd Tanous 
47847deee3SEd Tanous /**
48847deee3SEd Tanous  * @internal
49847deee3SEd Tanous  * @brief Formats ResourceCreated message into JSON
50847deee3SEd Tanous  *
51847deee3SEd Tanous  * See header file for more information
52847deee3SEd Tanous  * @endinternal
53847deee3SEd Tanous  */
54847deee3SEd Tanous nlohmann::json resourceCreated()
55847deee3SEd Tanous {
56*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceCreated,
57847deee3SEd Tanous                   {});
58847deee3SEd Tanous }
59847deee3SEd Tanous 
60847deee3SEd Tanous /**
61847deee3SEd Tanous  * @internal
62847deee3SEd Tanous  * @brief Formats ResourceRemoved message into JSON
63847deee3SEd Tanous  *
64847deee3SEd Tanous  * See header file for more information
65847deee3SEd Tanous  * @endinternal
66847deee3SEd Tanous  */
67847deee3SEd Tanous nlohmann::json resourceRemoved()
68847deee3SEd Tanous {
69*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceRemoved,
70847deee3SEd Tanous                   {});
71847deee3SEd Tanous }
72847deee3SEd Tanous 
73847deee3SEd Tanous /**
74847deee3SEd Tanous  * @internal
75847deee3SEd Tanous  * @brief Formats ResourceErrorsDetected message into JSON
76847deee3SEd Tanous  *
77847deee3SEd Tanous  * See header file for more information
78847deee3SEd Tanous  * @endinternal
79847deee3SEd Tanous  */
80847deee3SEd Tanous nlohmann::json resourceErrorsDetected(std::string_view arg1,
81847deee3SEd Tanous                                       std::string_view arg2)
82847deee3SEd Tanous {
83847deee3SEd Tanous     return getLog(
84*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceErrorsDetected,
85847deee3SEd Tanous         std::to_array({arg1, arg2}));
86847deee3SEd Tanous }
87847deee3SEd Tanous 
88847deee3SEd Tanous /**
89847deee3SEd Tanous  * @internal
90847deee3SEd Tanous  * @brief Formats ResourceErrorsCorrected message into JSON
91847deee3SEd Tanous  *
92847deee3SEd Tanous  * See header file for more information
93847deee3SEd Tanous  * @endinternal
94847deee3SEd Tanous  */
95847deee3SEd Tanous nlohmann::json resourceErrorsCorrected(std::string_view arg1,
96847deee3SEd Tanous                                        std::string_view arg2)
97847deee3SEd Tanous {
98847deee3SEd Tanous     return getLog(
99*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceErrorsCorrected,
100847deee3SEd Tanous         std::to_array({arg1, arg2}));
101847deee3SEd Tanous }
102847deee3SEd Tanous 
103847deee3SEd Tanous /**
104847deee3SEd Tanous  * @internal
105847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdExceeded message into JSON
106847deee3SEd Tanous  *
107847deee3SEd Tanous  * See header file for more information
108847deee3SEd Tanous  * @endinternal
109847deee3SEd Tanous  */
110504af5a0SPatrick Williams nlohmann::json resourceErrorThresholdExceeded(std::string_view arg1,
111504af5a0SPatrick Williams                                               std::string_view arg2)
112847deee3SEd Tanous {
113*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
114847deee3SEd Tanous                       resourceErrorThresholdExceeded,
115847deee3SEd Tanous                   std::to_array({arg1, arg2}));
116847deee3SEd Tanous }
117847deee3SEd Tanous 
118847deee3SEd Tanous /**
119847deee3SEd Tanous  * @internal
120847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdCleared message into JSON
121847deee3SEd Tanous  *
122847deee3SEd Tanous  * See header file for more information
123847deee3SEd Tanous  * @endinternal
124847deee3SEd Tanous  */
125504af5a0SPatrick Williams nlohmann::json resourceErrorThresholdCleared(std::string_view arg1,
126504af5a0SPatrick Williams                                              std::string_view arg2)
127847deee3SEd Tanous {
128*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
129847deee3SEd Tanous                       resourceErrorThresholdCleared,
130847deee3SEd Tanous                   std::to_array({arg1, arg2}));
131847deee3SEd Tanous }
132847deee3SEd Tanous 
133847deee3SEd Tanous /**
134847deee3SEd Tanous  * @internal
135847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdExceeded message into JSON
136847deee3SEd Tanous  *
137847deee3SEd Tanous  * See header file for more information
138847deee3SEd Tanous  * @endinternal
139847deee3SEd Tanous  */
140847deee3SEd Tanous nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
141847deee3SEd Tanous                                                 std::string_view arg2)
142847deee3SEd Tanous {
143*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
144847deee3SEd Tanous                       resourceWarningThresholdExceeded,
145847deee3SEd Tanous                   std::to_array({arg1, arg2}));
146847deee3SEd Tanous }
147847deee3SEd Tanous 
148847deee3SEd Tanous /**
149847deee3SEd Tanous  * @internal
150847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdCleared message into JSON
151847deee3SEd Tanous  *
152847deee3SEd Tanous  * See header file for more information
153847deee3SEd Tanous  * @endinternal
154847deee3SEd Tanous  */
155847deee3SEd Tanous nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
156847deee3SEd Tanous                                                std::string_view arg2)
157847deee3SEd Tanous {
158*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
159847deee3SEd Tanous                       resourceWarningThresholdCleared,
160847deee3SEd Tanous                   std::to_array({arg1, arg2}));
161847deee3SEd Tanous }
162847deee3SEd Tanous 
163847deee3SEd Tanous /**
164847deee3SEd Tanous  * @internal
165847deee3SEd Tanous  * @brief Formats ResourceStatusChangedOK message into JSON
166847deee3SEd Tanous  *
167847deee3SEd Tanous  * See header file for more information
168847deee3SEd Tanous  * @endinternal
169847deee3SEd Tanous  */
170847deee3SEd Tanous nlohmann::json resourceStatusChangedOK(std::string_view arg1,
171847deee3SEd Tanous                                        std::string_view arg2)
172847deee3SEd Tanous {
173847deee3SEd Tanous     return getLog(
174*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStatusChangedOK,
175847deee3SEd Tanous         std::to_array({arg1, arg2}));
176847deee3SEd Tanous }
177847deee3SEd Tanous 
178847deee3SEd Tanous /**
179847deee3SEd Tanous  * @internal
180847deee3SEd Tanous  * @brief Formats ResourceStatusChangedWarning message into JSON
181847deee3SEd Tanous  *
182847deee3SEd Tanous  * See header file for more information
183847deee3SEd Tanous  * @endinternal
184847deee3SEd Tanous  */
185504af5a0SPatrick Williams nlohmann::json resourceStatusChangedWarning(std::string_view arg1,
186504af5a0SPatrick Williams                                             std::string_view arg2)
187847deee3SEd Tanous {
188*4a102cd4SPatrick Williams     return getLog(
189*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStatusChangedWarning,
190847deee3SEd Tanous         std::to_array({arg1, arg2}));
191847deee3SEd Tanous }
192847deee3SEd Tanous 
193847deee3SEd Tanous /**
194847deee3SEd Tanous  * @internal
195847deee3SEd Tanous  * @brief Formats ResourceStatusChangedCritical message into JSON
196847deee3SEd Tanous  *
197847deee3SEd Tanous  * See header file for more information
198847deee3SEd Tanous  * @endinternal
199847deee3SEd Tanous  */
200504af5a0SPatrick Williams nlohmann::json resourceStatusChangedCritical(std::string_view arg1,
201504af5a0SPatrick Williams                                              std::string_view arg2)
202847deee3SEd Tanous {
203*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
204847deee3SEd Tanous                       resourceStatusChangedCritical,
205847deee3SEd Tanous                   std::to_array({arg1, arg2}));
206847deee3SEd Tanous }
207847deee3SEd Tanous 
208847deee3SEd Tanous /**
209847deee3SEd Tanous  * @internal
210847deee3SEd Tanous  * @brief Formats ResourceStateChanged message into JSON
211847deee3SEd Tanous  *
212847deee3SEd Tanous  * See header file for more information
213847deee3SEd Tanous  * @endinternal
214847deee3SEd Tanous  */
215847deee3SEd Tanous nlohmann::json resourceStateChanged(std::string_view arg1,
216847deee3SEd Tanous                                     std::string_view arg2)
217847deee3SEd Tanous {
218847deee3SEd Tanous     return getLog(
219*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStateChanged,
220847deee3SEd Tanous         std::to_array({arg1, arg2}));
221847deee3SEd Tanous }
222847deee3SEd Tanous 
223847deee3SEd Tanous /**
224847deee3SEd Tanous  * @internal
225847deee3SEd Tanous  * @brief Formats ResourcePoweredOn message into JSON
226847deee3SEd Tanous  *
227847deee3SEd Tanous  * See header file for more information
228847deee3SEd Tanous  * @endinternal
229847deee3SEd Tanous  */
230847deee3SEd Tanous nlohmann::json resourcePoweredOn(std::string_view arg1)
231847deee3SEd Tanous {
232*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOn,
233847deee3SEd Tanous                   std::to_array({arg1}));
234847deee3SEd Tanous }
235847deee3SEd Tanous 
236847deee3SEd Tanous /**
237847deee3SEd Tanous  * @internal
238847deee3SEd Tanous  * @brief Formats ResourcePoweringOn message into JSON
239847deee3SEd Tanous  *
240847deee3SEd Tanous  * See header file for more information
241847deee3SEd Tanous  * @endinternal
242847deee3SEd Tanous  */
243847deee3SEd Tanous nlohmann::json resourcePoweringOn(std::string_view arg1)
244847deee3SEd Tanous {
245*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweringOn,
246847deee3SEd Tanous                   std::to_array({arg1}));
247847deee3SEd Tanous }
248847deee3SEd Tanous 
249847deee3SEd Tanous /**
250847deee3SEd Tanous  * @internal
251847deee3SEd Tanous  * @brief Formats ResourcePoweredOff message into JSON
252847deee3SEd Tanous  *
253847deee3SEd Tanous  * See header file for more information
254847deee3SEd Tanous  * @endinternal
255847deee3SEd Tanous  */
256847deee3SEd Tanous nlohmann::json resourcePoweredOff(std::string_view arg1)
257847deee3SEd Tanous {
258*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOff,
259847deee3SEd Tanous                   std::to_array({arg1}));
260847deee3SEd Tanous }
261847deee3SEd Tanous 
262847deee3SEd Tanous /**
263847deee3SEd Tanous  * @internal
264847deee3SEd Tanous  * @brief Formats ResourcePoweringOff message into JSON
265847deee3SEd Tanous  *
266847deee3SEd Tanous  * See header file for more information
267847deee3SEd Tanous  * @endinternal
268847deee3SEd Tanous  */
269847deee3SEd Tanous nlohmann::json resourcePoweringOff(std::string_view arg1)
270847deee3SEd Tanous {
271847deee3SEd Tanous     return getLog(
272*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourcePoweringOff,
273847deee3SEd Tanous         std::to_array({arg1}));
274847deee3SEd Tanous }
275847deee3SEd Tanous 
276847deee3SEd Tanous /**
277847deee3SEd Tanous  * @internal
278847deee3SEd Tanous  * @brief Formats ResourcePaused message into JSON
279847deee3SEd Tanous  *
280847deee3SEd Tanous  * See header file for more information
281847deee3SEd Tanous  * @endinternal
282847deee3SEd Tanous  */
283847deee3SEd Tanous nlohmann::json resourcePaused(std::string_view arg1)
284847deee3SEd Tanous {
285*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePaused,
286847deee3SEd Tanous                   std::to_array({arg1}));
287847deee3SEd Tanous }
288847deee3SEd Tanous 
289847deee3SEd Tanous /**
290847deee3SEd Tanous  * @internal
291847deee3SEd Tanous  * @brief Formats URIForResourceChanged message into JSON
292847deee3SEd Tanous  *
293847deee3SEd Tanous  * See header file for more information
294847deee3SEd Tanous  * @endinternal
295847deee3SEd Tanous  */
296847deee3SEd Tanous nlohmann::json uRIForResourceChanged()
297847deee3SEd Tanous {
298847deee3SEd Tanous     return getLog(
299*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::uRIForResourceChanged, {});
300847deee3SEd Tanous }
301847deee3SEd Tanous 
302847deee3SEd Tanous /**
303847deee3SEd Tanous  * @internal
304847deee3SEd Tanous  * @brief Formats ResourceChanged message into JSON
305847deee3SEd Tanous  *
306847deee3SEd Tanous  * See header file for more information
307847deee3SEd Tanous  * @endinternal
308847deee3SEd Tanous  */
309847deee3SEd Tanous nlohmann::json resourceChanged()
310847deee3SEd Tanous {
311*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceChanged,
312847deee3SEd Tanous                   {});
313847deee3SEd Tanous }
314847deee3SEd Tanous 
315847deee3SEd Tanous /**
316847deee3SEd Tanous  * @internal
317847deee3SEd Tanous  * @brief Formats ResourceVersionIncompatible message into JSON
318847deee3SEd Tanous  *
319847deee3SEd Tanous  * See header file for more information
320847deee3SEd Tanous  * @endinternal
321847deee3SEd Tanous  */
322847deee3SEd Tanous nlohmann::json resourceVersionIncompatible(std::string_view arg1)
323847deee3SEd Tanous {
324847deee3SEd Tanous     return getLog(
325*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceVersionIncompatible,
326847deee3SEd Tanous         std::to_array({arg1}));
327847deee3SEd Tanous }
328847deee3SEd Tanous 
329847deee3SEd Tanous /**
330847deee3SEd Tanous  * @internal
331847deee3SEd Tanous  * @brief Formats ResourceSelfTestFailed message into JSON
332847deee3SEd Tanous  *
333847deee3SEd Tanous  * See header file for more information
334847deee3SEd Tanous  * @endinternal
335847deee3SEd Tanous  */
336847deee3SEd Tanous nlohmann::json resourceSelfTestFailed(std::string_view arg1)
337847deee3SEd Tanous {
338847deee3SEd Tanous     return getLog(
339*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceSelfTestFailed,
340847deee3SEd Tanous         std::to_array({arg1}));
341847deee3SEd Tanous }
342847deee3SEd Tanous 
343847deee3SEd Tanous /**
344847deee3SEd Tanous  * @internal
345847deee3SEd Tanous  * @brief Formats ResourceSelfTestCompleted message into JSON
346847deee3SEd Tanous  *
347847deee3SEd Tanous  * See header file for more information
348847deee3SEd Tanous  * @endinternal
349847deee3SEd Tanous  */
350847deee3SEd Tanous nlohmann::json resourceSelfTestCompleted()
351847deee3SEd Tanous {
352847deee3SEd Tanous     return getLog(
353*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceSelfTestCompleted,
354847deee3SEd Tanous         {});
355847deee3SEd Tanous }
356847deee3SEd Tanous 
357847deee3SEd Tanous /**
358847deee3SEd Tanous  * @internal
359847deee3SEd Tanous  * @brief Formats TestMessage message into JSON
360847deee3SEd Tanous  *
361847deee3SEd Tanous  * See header file for more information
362847deee3SEd Tanous  * @endinternal
363847deee3SEd Tanous  */
364847deee3SEd Tanous nlohmann::json testMessage()
365847deee3SEd Tanous {
366*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::testMessage, {});
367847deee3SEd Tanous }
368847deee3SEd Tanous 
369847deee3SEd Tanous /**
370847deee3SEd Tanous  * @internal
371847deee3SEd Tanous  * @brief Formats AggregationSourceDiscovered message into JSON
372847deee3SEd Tanous  *
373847deee3SEd Tanous  * See header file for more information
374847deee3SEd Tanous  * @endinternal
375847deee3SEd Tanous  */
376847deee3SEd Tanous nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
377847deee3SEd Tanous                                            std::string_view arg2)
378847deee3SEd Tanous {
379847deee3SEd Tanous     return getLog(
380*4a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::aggregationSourceDiscovered,
381847deee3SEd Tanous         std::to_array({arg1, arg2}));
382847deee3SEd Tanous }
383847deee3SEd Tanous 
384847deee3SEd Tanous /**
385847deee3SEd Tanous  * @internal
386847deee3SEd Tanous  * @brief Formats LicenseExpired message into JSON
387847deee3SEd Tanous  *
388847deee3SEd Tanous  * See header file for more information
389847deee3SEd Tanous  * @endinternal
390847deee3SEd Tanous  */
391847deee3SEd Tanous nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2)
392847deee3SEd Tanous {
393*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseExpired,
394847deee3SEd Tanous                   std::to_array({arg1, arg2}));
395847deee3SEd Tanous }
396847deee3SEd Tanous 
397847deee3SEd Tanous /**
398847deee3SEd Tanous  * @internal
399847deee3SEd Tanous  * @brief Formats LicenseChanged message into JSON
400847deee3SEd Tanous  *
401847deee3SEd Tanous  * See header file for more information
402847deee3SEd Tanous  * @endinternal
403847deee3SEd Tanous  */
404847deee3SEd Tanous nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2)
405847deee3SEd Tanous {
406*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseChanged,
407847deee3SEd Tanous                   std::to_array({arg1, arg2}));
408847deee3SEd Tanous }
409847deee3SEd Tanous 
410847deee3SEd Tanous /**
411847deee3SEd Tanous  * @internal
412847deee3SEd Tanous  * @brief Formats LicenseAdded message into JSON
413847deee3SEd Tanous  *
414847deee3SEd Tanous  * See header file for more information
415847deee3SEd Tanous  * @endinternal
416847deee3SEd Tanous  */
417847deee3SEd Tanous nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2)
418847deee3SEd Tanous {
419*4a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseAdded,
420847deee3SEd Tanous                   std::to_array({arg1, arg2}));
421847deee3SEd Tanous }
422847deee3SEd Tanous 
423847deee3SEd Tanous } // namespace messages
424847deee3SEd Tanous } // namespace redfish
425