xref: /openbmc/bmcweb/features/redfish/src/resource_messages.cpp (revision 10cf50dca112b27176dc5734126983ad37ba2c04)
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*10cf50dcSEd Tanous static nlohmann::json::object_t getLog(
35*10cf50dcSEd Tanous     redfish::registries::ResourceEvent::Index name,
36847deee3SEd Tanous     std::span<const std::string_view> args)
37847deee3SEd Tanous {
38847deee3SEd Tanous     size_t index = static_cast<size_t>(name);
394a102cd4SPatrick Williams     if (index >= redfish::registries::ResourceEvent::registry.size())
40847deee3SEd Tanous     {
41847deee3SEd Tanous         return {};
42847deee3SEd Tanous     }
434a102cd4SPatrick Williams     return getLogFromRegistry(redfish::registries::ResourceEvent::header,
444a102cd4SPatrick Williams                               redfish::registries::ResourceEvent::registry,
45847deee3SEd Tanous                               index, args);
46847deee3SEd Tanous }
47847deee3SEd Tanous 
48847deee3SEd Tanous /**
49847deee3SEd Tanous  * @internal
50847deee3SEd Tanous  * @brief Formats ResourceCreated message into JSON
51847deee3SEd Tanous  *
52847deee3SEd Tanous  * See header file for more information
53847deee3SEd Tanous  * @endinternal
54847deee3SEd Tanous  */
55*10cf50dcSEd Tanous nlohmann::json::object_t resourceCreated()
56847deee3SEd Tanous {
574a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceCreated,
58847deee3SEd Tanous                   {});
59847deee3SEd Tanous }
60847deee3SEd Tanous 
61847deee3SEd Tanous /**
62847deee3SEd Tanous  * @internal
63847deee3SEd Tanous  * @brief Formats ResourceRemoved message into JSON
64847deee3SEd Tanous  *
65847deee3SEd Tanous  * See header file for more information
66847deee3SEd Tanous  * @endinternal
67847deee3SEd Tanous  */
68*10cf50dcSEd Tanous nlohmann::json::object_t resourceRemoved()
69847deee3SEd Tanous {
704a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceRemoved,
71847deee3SEd Tanous                   {});
72847deee3SEd Tanous }
73847deee3SEd Tanous 
74847deee3SEd Tanous /**
75847deee3SEd Tanous  * @internal
76847deee3SEd Tanous  * @brief Formats ResourceErrorsDetected message into JSON
77847deee3SEd Tanous  *
78847deee3SEd Tanous  * See header file for more information
79847deee3SEd Tanous  * @endinternal
80847deee3SEd Tanous  */
81*10cf50dcSEd Tanous nlohmann::json::object_t resourceErrorsDetected(std::string_view arg1,
82847deee3SEd Tanous                                                 std::string_view arg2)
83847deee3SEd Tanous {
84847deee3SEd Tanous     return getLog(
854a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceErrorsDetected,
86847deee3SEd Tanous         std::to_array({arg1, arg2}));
87847deee3SEd Tanous }
88847deee3SEd Tanous 
89847deee3SEd Tanous /**
90847deee3SEd Tanous  * @internal
91847deee3SEd Tanous  * @brief Formats ResourceErrorsCorrected message into JSON
92847deee3SEd Tanous  *
93847deee3SEd Tanous  * See header file for more information
94847deee3SEd Tanous  * @endinternal
95847deee3SEd Tanous  */
96*10cf50dcSEd Tanous nlohmann::json::object_t resourceErrorsCorrected(std::string_view arg1,
97847deee3SEd Tanous                                                  std::string_view arg2)
98847deee3SEd Tanous {
99847deee3SEd Tanous     return getLog(
1004a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceErrorsCorrected,
101847deee3SEd Tanous         std::to_array({arg1, arg2}));
102847deee3SEd Tanous }
103847deee3SEd Tanous 
104847deee3SEd Tanous /**
105847deee3SEd Tanous  * @internal
106847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdExceeded message into JSON
107847deee3SEd Tanous  *
108847deee3SEd Tanous  * See header file for more information
109847deee3SEd Tanous  * @endinternal
110847deee3SEd Tanous  */
111*10cf50dcSEd Tanous nlohmann::json::object_t resourceErrorThresholdExceeded(std::string_view arg1,
112504af5a0SPatrick Williams                                                         std::string_view arg2)
113847deee3SEd Tanous {
1144a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
115847deee3SEd Tanous                       resourceErrorThresholdExceeded,
116847deee3SEd Tanous                   std::to_array({arg1, arg2}));
117847deee3SEd Tanous }
118847deee3SEd Tanous 
119847deee3SEd Tanous /**
120847deee3SEd Tanous  * @internal
121847deee3SEd Tanous  * @brief Formats ResourceErrorThresholdCleared message into JSON
122847deee3SEd Tanous  *
123847deee3SEd Tanous  * See header file for more information
124847deee3SEd Tanous  * @endinternal
125847deee3SEd Tanous  */
126*10cf50dcSEd Tanous nlohmann::json::object_t resourceErrorThresholdCleared(std::string_view arg1,
127504af5a0SPatrick Williams                                                        std::string_view arg2)
128847deee3SEd Tanous {
1294a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
130847deee3SEd Tanous                       resourceErrorThresholdCleared,
131847deee3SEd Tanous                   std::to_array({arg1, arg2}));
132847deee3SEd Tanous }
133847deee3SEd Tanous 
134847deee3SEd Tanous /**
135847deee3SEd Tanous  * @internal
136847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdExceeded message into JSON
137847deee3SEd Tanous  *
138847deee3SEd Tanous  * See header file for more information
139847deee3SEd Tanous  * @endinternal
140847deee3SEd Tanous  */
141*10cf50dcSEd Tanous nlohmann::json::object_t resourceWarningThresholdExceeded(std::string_view arg1,
142847deee3SEd Tanous                                                           std::string_view arg2)
143847deee3SEd Tanous {
1444a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
145847deee3SEd Tanous                       resourceWarningThresholdExceeded,
146847deee3SEd Tanous                   std::to_array({arg1, arg2}));
147847deee3SEd Tanous }
148847deee3SEd Tanous 
149847deee3SEd Tanous /**
150847deee3SEd Tanous  * @internal
151847deee3SEd Tanous  * @brief Formats ResourceWarningThresholdCleared message into JSON
152847deee3SEd Tanous  *
153847deee3SEd Tanous  * See header file for more information
154847deee3SEd Tanous  * @endinternal
155847deee3SEd Tanous  */
156*10cf50dcSEd Tanous nlohmann::json::object_t resourceWarningThresholdCleared(std::string_view arg1,
157847deee3SEd Tanous                                                          std::string_view arg2)
158847deee3SEd Tanous {
1594a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
160847deee3SEd Tanous                       resourceWarningThresholdCleared,
161847deee3SEd Tanous                   std::to_array({arg1, arg2}));
162847deee3SEd Tanous }
163847deee3SEd Tanous 
164847deee3SEd Tanous /**
165847deee3SEd Tanous  * @internal
166847deee3SEd Tanous  * @brief Formats ResourceStatusChangedOK message into JSON
167847deee3SEd Tanous  *
168847deee3SEd Tanous  * See header file for more information
169847deee3SEd Tanous  * @endinternal
170847deee3SEd Tanous  */
171*10cf50dcSEd Tanous nlohmann::json::object_t resourceStatusChangedOK(std::string_view arg1,
172847deee3SEd Tanous                                                  std::string_view arg2)
173847deee3SEd Tanous {
174847deee3SEd Tanous     return getLog(
1754a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStatusChangedOK,
176847deee3SEd Tanous         std::to_array({arg1, arg2}));
177847deee3SEd Tanous }
178847deee3SEd Tanous 
179847deee3SEd Tanous /**
180847deee3SEd Tanous  * @internal
181847deee3SEd Tanous  * @brief Formats ResourceStatusChangedWarning message into JSON
182847deee3SEd Tanous  *
183847deee3SEd Tanous  * See header file for more information
184847deee3SEd Tanous  * @endinternal
185847deee3SEd Tanous  */
186*10cf50dcSEd Tanous nlohmann::json::object_t resourceStatusChangedWarning(std::string_view arg1,
187504af5a0SPatrick Williams                                                       std::string_view arg2)
188847deee3SEd Tanous {
1894a102cd4SPatrick Williams     return getLog(
1904a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStatusChangedWarning,
191847deee3SEd Tanous         std::to_array({arg1, arg2}));
192847deee3SEd Tanous }
193847deee3SEd Tanous 
194847deee3SEd Tanous /**
195847deee3SEd Tanous  * @internal
196847deee3SEd Tanous  * @brief Formats ResourceStatusChangedCritical message into JSON
197847deee3SEd Tanous  *
198847deee3SEd Tanous  * See header file for more information
199847deee3SEd Tanous  * @endinternal
200847deee3SEd Tanous  */
201*10cf50dcSEd Tanous nlohmann::json::object_t resourceStatusChangedCritical(std::string_view arg1,
202504af5a0SPatrick Williams                                                        std::string_view arg2)
203847deee3SEd Tanous {
2044a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::
205847deee3SEd Tanous                       resourceStatusChangedCritical,
206847deee3SEd Tanous                   std::to_array({arg1, arg2}));
207847deee3SEd Tanous }
208847deee3SEd Tanous 
209847deee3SEd Tanous /**
210847deee3SEd Tanous  * @internal
211847deee3SEd Tanous  * @brief Formats ResourceStateChanged message into JSON
212847deee3SEd Tanous  *
213847deee3SEd Tanous  * See header file for more information
214847deee3SEd Tanous  * @endinternal
215847deee3SEd Tanous  */
216*10cf50dcSEd Tanous nlohmann::json::object_t resourceStateChanged(std::string_view arg1,
217847deee3SEd Tanous                                               std::string_view arg2)
218847deee3SEd Tanous {
219847deee3SEd Tanous     return getLog(
2204a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceStateChanged,
221847deee3SEd Tanous         std::to_array({arg1, arg2}));
222847deee3SEd Tanous }
223847deee3SEd Tanous 
224847deee3SEd Tanous /**
225847deee3SEd Tanous  * @internal
226847deee3SEd Tanous  * @brief Formats ResourcePoweredOn message into JSON
227847deee3SEd Tanous  *
228847deee3SEd Tanous  * See header file for more information
229847deee3SEd Tanous  * @endinternal
230847deee3SEd Tanous  */
231*10cf50dcSEd Tanous nlohmann::json::object_t resourcePoweredOn(std::string_view arg1)
232847deee3SEd Tanous {
2334a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOn,
234847deee3SEd Tanous                   std::to_array({arg1}));
235847deee3SEd Tanous }
236847deee3SEd Tanous 
237847deee3SEd Tanous /**
238847deee3SEd Tanous  * @internal
239847deee3SEd Tanous  * @brief Formats ResourcePoweringOn message into JSON
240847deee3SEd Tanous  *
241847deee3SEd Tanous  * See header file for more information
242847deee3SEd Tanous  * @endinternal
243847deee3SEd Tanous  */
244*10cf50dcSEd Tanous nlohmann::json::object_t resourcePoweringOn(std::string_view arg1)
245847deee3SEd Tanous {
2464a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweringOn,
247847deee3SEd Tanous                   std::to_array({arg1}));
248847deee3SEd Tanous }
249847deee3SEd Tanous 
250847deee3SEd Tanous /**
251847deee3SEd Tanous  * @internal
252847deee3SEd Tanous  * @brief Formats ResourcePoweredOff message into JSON
253847deee3SEd Tanous  *
254847deee3SEd Tanous  * See header file for more information
255847deee3SEd Tanous  * @endinternal
256847deee3SEd Tanous  */
257*10cf50dcSEd Tanous nlohmann::json::object_t resourcePoweredOff(std::string_view arg1)
258847deee3SEd Tanous {
2594a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePoweredOff,
260847deee3SEd Tanous                   std::to_array({arg1}));
261847deee3SEd Tanous }
262847deee3SEd Tanous 
263847deee3SEd Tanous /**
264847deee3SEd Tanous  * @internal
265847deee3SEd Tanous  * @brief Formats ResourcePoweringOff message into JSON
266847deee3SEd Tanous  *
267847deee3SEd Tanous  * See header file for more information
268847deee3SEd Tanous  * @endinternal
269847deee3SEd Tanous  */
270*10cf50dcSEd Tanous nlohmann::json::object_t resourcePoweringOff(std::string_view arg1)
271847deee3SEd Tanous {
272847deee3SEd Tanous     return getLog(
2734a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourcePoweringOff,
274847deee3SEd Tanous         std::to_array({arg1}));
275847deee3SEd Tanous }
276847deee3SEd Tanous 
277847deee3SEd Tanous /**
278847deee3SEd Tanous  * @internal
279847deee3SEd Tanous  * @brief Formats ResourcePaused message into JSON
280847deee3SEd Tanous  *
281847deee3SEd Tanous  * See header file for more information
282847deee3SEd Tanous  * @endinternal
283847deee3SEd Tanous  */
284*10cf50dcSEd Tanous nlohmann::json::object_t resourcePaused(std::string_view arg1)
285847deee3SEd Tanous {
2864a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourcePaused,
287847deee3SEd Tanous                   std::to_array({arg1}));
288847deee3SEd Tanous }
289847deee3SEd Tanous 
290847deee3SEd Tanous /**
291847deee3SEd Tanous  * @internal
292847deee3SEd Tanous  * @brief Formats URIForResourceChanged message into JSON
293847deee3SEd Tanous  *
294847deee3SEd Tanous  * See header file for more information
295847deee3SEd Tanous  * @endinternal
296847deee3SEd Tanous  */
297*10cf50dcSEd Tanous nlohmann::json::object_t uRIForResourceChanged()
298847deee3SEd Tanous {
299847deee3SEd Tanous     return getLog(
3004a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::uRIForResourceChanged, {});
301847deee3SEd Tanous }
302847deee3SEd Tanous 
303847deee3SEd Tanous /**
304847deee3SEd Tanous  * @internal
305847deee3SEd Tanous  * @brief Formats ResourceChanged message into JSON
306847deee3SEd Tanous  *
307847deee3SEd Tanous  * See header file for more information
308847deee3SEd Tanous  * @endinternal
309847deee3SEd Tanous  */
310*10cf50dcSEd Tanous nlohmann::json::object_t resourceChanged()
311847deee3SEd Tanous {
3124a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::resourceChanged,
313847deee3SEd Tanous                   {});
314847deee3SEd Tanous }
315847deee3SEd Tanous 
316847deee3SEd Tanous /**
317847deee3SEd Tanous  * @internal
318847deee3SEd Tanous  * @brief Formats ResourceVersionIncompatible message into JSON
319847deee3SEd Tanous  *
320847deee3SEd Tanous  * See header file for more information
321847deee3SEd Tanous  * @endinternal
322847deee3SEd Tanous  */
323*10cf50dcSEd Tanous nlohmann::json::object_t resourceVersionIncompatible(std::string_view arg1)
324847deee3SEd Tanous {
325847deee3SEd Tanous     return getLog(
3264a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceVersionIncompatible,
327847deee3SEd Tanous         std::to_array({arg1}));
328847deee3SEd Tanous }
329847deee3SEd Tanous 
330847deee3SEd Tanous /**
331847deee3SEd Tanous  * @internal
332847deee3SEd Tanous  * @brief Formats ResourceSelfTestFailed message into JSON
333847deee3SEd Tanous  *
334847deee3SEd Tanous  * See header file for more information
335847deee3SEd Tanous  * @endinternal
336847deee3SEd Tanous  */
337*10cf50dcSEd Tanous nlohmann::json::object_t resourceSelfTestFailed(std::string_view arg1)
338847deee3SEd Tanous {
339847deee3SEd Tanous     return getLog(
3404a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceSelfTestFailed,
341847deee3SEd Tanous         std::to_array({arg1}));
342847deee3SEd Tanous }
343847deee3SEd Tanous 
344847deee3SEd Tanous /**
345847deee3SEd Tanous  * @internal
346847deee3SEd Tanous  * @brief Formats ResourceSelfTestCompleted message into JSON
347847deee3SEd Tanous  *
348847deee3SEd Tanous  * See header file for more information
349847deee3SEd Tanous  * @endinternal
350847deee3SEd Tanous  */
351*10cf50dcSEd Tanous nlohmann::json::object_t resourceSelfTestCompleted()
352847deee3SEd Tanous {
353847deee3SEd Tanous     return getLog(
3544a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::resourceSelfTestCompleted,
355847deee3SEd Tanous         {});
356847deee3SEd Tanous }
357847deee3SEd Tanous 
358847deee3SEd Tanous /**
359847deee3SEd Tanous  * @internal
360847deee3SEd Tanous  * @brief Formats TestMessage message into JSON
361847deee3SEd Tanous  *
362847deee3SEd Tanous  * See header file for more information
363847deee3SEd Tanous  * @endinternal
364847deee3SEd Tanous  */
365*10cf50dcSEd Tanous nlohmann::json::object_t testMessage()
366847deee3SEd Tanous {
3674a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::testMessage, {});
368847deee3SEd Tanous }
369847deee3SEd Tanous 
370847deee3SEd Tanous /**
371847deee3SEd Tanous  * @internal
372847deee3SEd Tanous  * @brief Formats AggregationSourceDiscovered message into JSON
373847deee3SEd Tanous  *
374847deee3SEd Tanous  * See header file for more information
375847deee3SEd Tanous  * @endinternal
376847deee3SEd Tanous  */
377*10cf50dcSEd Tanous nlohmann::json::object_t aggregationSourceDiscovered(std::string_view arg1,
378847deee3SEd Tanous                                                      std::string_view arg2)
379847deee3SEd Tanous {
380847deee3SEd Tanous     return getLog(
3814a102cd4SPatrick Williams         redfish::registries::ResourceEvent::Index::aggregationSourceDiscovered,
382847deee3SEd Tanous         std::to_array({arg1, arg2}));
383847deee3SEd Tanous }
384847deee3SEd Tanous 
385847deee3SEd Tanous /**
386847deee3SEd Tanous  * @internal
387847deee3SEd Tanous  * @brief Formats LicenseExpired message into JSON
388847deee3SEd Tanous  *
389847deee3SEd Tanous  * See header file for more information
390847deee3SEd Tanous  * @endinternal
391847deee3SEd Tanous  */
392*10cf50dcSEd Tanous nlohmann::json::object_t licenseExpired(std::string_view arg1,
393*10cf50dcSEd Tanous                                         std::string_view arg2)
394847deee3SEd Tanous {
3954a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseExpired,
396847deee3SEd Tanous                   std::to_array({arg1, arg2}));
397847deee3SEd Tanous }
398847deee3SEd Tanous 
399847deee3SEd Tanous /**
400847deee3SEd Tanous  * @internal
401847deee3SEd Tanous  * @brief Formats LicenseChanged message into JSON
402847deee3SEd Tanous  *
403847deee3SEd Tanous  * See header file for more information
404847deee3SEd Tanous  * @endinternal
405847deee3SEd Tanous  */
406*10cf50dcSEd Tanous nlohmann::json::object_t licenseChanged(std::string_view arg1,
407*10cf50dcSEd Tanous                                         std::string_view arg2)
408847deee3SEd Tanous {
4094a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseChanged,
410847deee3SEd Tanous                   std::to_array({arg1, arg2}));
411847deee3SEd Tanous }
412847deee3SEd Tanous 
413847deee3SEd Tanous /**
414847deee3SEd Tanous  * @internal
415847deee3SEd Tanous  * @brief Formats LicenseAdded message into JSON
416847deee3SEd Tanous  *
417847deee3SEd Tanous  * See header file for more information
418847deee3SEd Tanous  * @endinternal
419847deee3SEd Tanous  */
420*10cf50dcSEd Tanous nlohmann::json::object_t licenseAdded(std::string_view arg1,
421*10cf50dcSEd Tanous                                       std::string_view arg2)
422847deee3SEd Tanous {
4234a102cd4SPatrick Williams     return getLog(redfish::registries::ResourceEvent::Index::licenseAdded,
424847deee3SEd Tanous                   std::to_array({arg1, arg2}));
425847deee3SEd Tanous }
426847deee3SEd Tanous 
427847deee3SEd Tanous } // namespace messages
428847deee3SEd Tanous } // namespace redfish
429