xref: /openbmc/bmcweb/redfish-core/src/resource_messages.cpp (revision 504af5a0568171b72caf13234cc81380b261fa21)
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 
getLog(redfish::registries::resource_event::Index name,std::span<const std::string_view> args)34847deee3SEd Tanous static nlohmann::json getLog(redfish::registries::resource_event::Index name,
35847deee3SEd Tanous                              std::span<const std::string_view> args)
36847deee3SEd Tanous {
37847deee3SEd Tanous     size_t index = static_cast<size_t>(name);
38847deee3SEd Tanous     if (index >= redfish::registries::resource_event::registry.size())
39847deee3SEd Tanous     {
40847deee3SEd Tanous         return {};
41847deee3SEd Tanous     }
42847deee3SEd Tanous     return getLogFromRegistry(redfish::registries::resource_event::header,
43847deee3SEd Tanous                               redfish::registries::resource_event::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  */
resourceCreated()54847deee3SEd Tanous nlohmann::json resourceCreated()
55847deee3SEd Tanous {
56847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceRemoved()67847deee3SEd Tanous nlohmann::json resourceRemoved()
68847deee3SEd Tanous {
69847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceErrorsDetected(std::string_view arg1,std::string_view arg2)80847deee3SEd Tanous nlohmann::json resourceErrorsDetected(std::string_view arg1,
81847deee3SEd Tanous                                       std::string_view arg2)
82847deee3SEd Tanous {
83847deee3SEd Tanous     return getLog(
84847deee3SEd Tanous         redfish::registries::resource_event::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  */
resourceErrorsCorrected(std::string_view arg1,std::string_view arg2)95847deee3SEd Tanous nlohmann::json resourceErrorsCorrected(std::string_view arg1,
96847deee3SEd Tanous                                        std::string_view arg2)
97847deee3SEd Tanous {
98847deee3SEd Tanous     return getLog(
99847deee3SEd Tanous         redfish::registries::resource_event::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  */
resourceErrorThresholdExceeded(std::string_view arg1,std::string_view arg2)110*504af5a0SPatrick Williams nlohmann::json resourceErrorThresholdExceeded(std::string_view arg1,
111*504af5a0SPatrick Williams                                               std::string_view arg2)
112847deee3SEd Tanous {
113847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceErrorThresholdCleared(std::string_view arg1,std::string_view arg2)125*504af5a0SPatrick Williams nlohmann::json resourceErrorThresholdCleared(std::string_view arg1,
126*504af5a0SPatrick Williams                                              std::string_view arg2)
127847deee3SEd Tanous {
128847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceWarningThresholdExceeded(std::string_view arg1,std::string_view arg2)140847deee3SEd Tanous nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
141847deee3SEd Tanous                                                 std::string_view arg2)
142847deee3SEd Tanous {
143847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceWarningThresholdCleared(std::string_view arg1,std::string_view arg2)155847deee3SEd Tanous nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
156847deee3SEd Tanous                                                std::string_view arg2)
157847deee3SEd Tanous {
158847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceStatusChangedOK(std::string_view arg1,std::string_view arg2)170847deee3SEd Tanous nlohmann::json resourceStatusChangedOK(std::string_view arg1,
171847deee3SEd Tanous                                        std::string_view arg2)
172847deee3SEd Tanous {
173847deee3SEd Tanous     return getLog(
174847deee3SEd Tanous         redfish::registries::resource_event::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  */
resourceStatusChangedWarning(std::string_view arg1,std::string_view arg2)185*504af5a0SPatrick Williams nlohmann::json resourceStatusChangedWarning(std::string_view arg1,
186*504af5a0SPatrick Williams                                             std::string_view arg2)
187847deee3SEd Tanous {
188847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::
189847deee3SEd Tanous                       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  */
resourceStatusChangedCritical(std::string_view arg1,std::string_view arg2)200*504af5a0SPatrick Williams nlohmann::json resourceStatusChangedCritical(std::string_view arg1,
201*504af5a0SPatrick Williams                                              std::string_view arg2)
202847deee3SEd Tanous {
203847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourceStateChanged(std::string_view arg1,std::string_view arg2)215847deee3SEd Tanous nlohmann::json resourceStateChanged(std::string_view arg1,
216847deee3SEd Tanous                                     std::string_view arg2)
217847deee3SEd Tanous {
218847deee3SEd Tanous     return getLog(
219847deee3SEd Tanous         redfish::registries::resource_event::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  */
resourcePoweredOn(std::string_view arg1)230847deee3SEd Tanous nlohmann::json resourcePoweredOn(std::string_view arg1)
231847deee3SEd Tanous {
232847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
resourcePoweringOn(std::string_view arg1)243847deee3SEd Tanous nlohmann::json resourcePoweringOn(std::string_view arg1)
244847deee3SEd Tanous {
245847deee3SEd Tanous     return getLog(
246847deee3SEd Tanous         redfish::registries::resource_event::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  */
resourcePoweredOff(std::string_view arg1)257847deee3SEd Tanous nlohmann::json resourcePoweredOff(std::string_view arg1)
258847deee3SEd Tanous {
259847deee3SEd Tanous     return getLog(
260847deee3SEd Tanous         redfish::registries::resource_event::Index::resourcePoweredOff,
261847deee3SEd Tanous         std::to_array({arg1}));
262847deee3SEd Tanous }
263847deee3SEd Tanous 
264847deee3SEd Tanous /**
265847deee3SEd Tanous  * @internal
266847deee3SEd Tanous  * @brief Formats ResourcePoweringOff message into JSON
267847deee3SEd Tanous  *
268847deee3SEd Tanous  * See header file for more information
269847deee3SEd Tanous  * @endinternal
270847deee3SEd Tanous  */
resourcePoweringOff(std::string_view arg1)271847deee3SEd Tanous nlohmann::json resourcePoweringOff(std::string_view arg1)
272847deee3SEd Tanous {
273847deee3SEd Tanous     return getLog(
274847deee3SEd Tanous         redfish::registries::resource_event::Index::resourcePoweringOff,
275847deee3SEd Tanous         std::to_array({arg1}));
276847deee3SEd Tanous }
277847deee3SEd Tanous 
278847deee3SEd Tanous /**
279847deee3SEd Tanous  * @internal
280847deee3SEd Tanous  * @brief Formats ResourcePaused message into JSON
281847deee3SEd Tanous  *
282847deee3SEd Tanous  * See header file for more information
283847deee3SEd Tanous  * @endinternal
284847deee3SEd Tanous  */
resourcePaused(std::string_view arg1)285847deee3SEd Tanous nlohmann::json resourcePaused(std::string_view arg1)
286847deee3SEd Tanous {
287847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourcePaused,
288847deee3SEd Tanous                   std::to_array({arg1}));
289847deee3SEd Tanous }
290847deee3SEd Tanous 
291847deee3SEd Tanous /**
292847deee3SEd Tanous  * @internal
293847deee3SEd Tanous  * @brief Formats URIForResourceChanged message into JSON
294847deee3SEd Tanous  *
295847deee3SEd Tanous  * See header file for more information
296847deee3SEd Tanous  * @endinternal
297847deee3SEd Tanous  */
uRIForResourceChanged()298847deee3SEd Tanous nlohmann::json uRIForResourceChanged()
299847deee3SEd Tanous {
300847deee3SEd Tanous     return getLog(
301847deee3SEd Tanous         redfish::registries::resource_event::Index::uRIForResourceChanged, {});
302847deee3SEd Tanous }
303847deee3SEd Tanous 
304847deee3SEd Tanous /**
305847deee3SEd Tanous  * @internal
306847deee3SEd Tanous  * @brief Formats ResourceChanged message into JSON
307847deee3SEd Tanous  *
308847deee3SEd Tanous  * See header file for more information
309847deee3SEd Tanous  * @endinternal
310847deee3SEd Tanous  */
resourceChanged()311847deee3SEd Tanous nlohmann::json resourceChanged()
312847deee3SEd Tanous {
313847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::resourceChanged,
314847deee3SEd Tanous                   {});
315847deee3SEd Tanous }
316847deee3SEd Tanous 
317847deee3SEd Tanous /**
318847deee3SEd Tanous  * @internal
319847deee3SEd Tanous  * @brief Formats ResourceVersionIncompatible message into JSON
320847deee3SEd Tanous  *
321847deee3SEd Tanous  * See header file for more information
322847deee3SEd Tanous  * @endinternal
323847deee3SEd Tanous  */
resourceVersionIncompatible(std::string_view arg1)324847deee3SEd Tanous nlohmann::json resourceVersionIncompatible(std::string_view arg1)
325847deee3SEd Tanous {
326847deee3SEd Tanous     return getLog(
327847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceVersionIncompatible,
328847deee3SEd Tanous         std::to_array({arg1}));
329847deee3SEd Tanous }
330847deee3SEd Tanous 
331847deee3SEd Tanous /**
332847deee3SEd Tanous  * @internal
333847deee3SEd Tanous  * @brief Formats ResourceSelfTestFailed message into JSON
334847deee3SEd Tanous  *
335847deee3SEd Tanous  * See header file for more information
336847deee3SEd Tanous  * @endinternal
337847deee3SEd Tanous  */
resourceSelfTestFailed(std::string_view arg1)338847deee3SEd Tanous nlohmann::json resourceSelfTestFailed(std::string_view arg1)
339847deee3SEd Tanous {
340847deee3SEd Tanous     return getLog(
341847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceSelfTestFailed,
342847deee3SEd Tanous         std::to_array({arg1}));
343847deee3SEd Tanous }
344847deee3SEd Tanous 
345847deee3SEd Tanous /**
346847deee3SEd Tanous  * @internal
347847deee3SEd Tanous  * @brief Formats ResourceSelfTestCompleted message into JSON
348847deee3SEd Tanous  *
349847deee3SEd Tanous  * See header file for more information
350847deee3SEd Tanous  * @endinternal
351847deee3SEd Tanous  */
resourceSelfTestCompleted()352847deee3SEd Tanous nlohmann::json resourceSelfTestCompleted()
353847deee3SEd Tanous {
354847deee3SEd Tanous     return getLog(
355847deee3SEd Tanous         redfish::registries::resource_event::Index::resourceSelfTestCompleted,
356847deee3SEd Tanous         {});
357847deee3SEd Tanous }
358847deee3SEd Tanous 
359847deee3SEd Tanous /**
360847deee3SEd Tanous  * @internal
361847deee3SEd Tanous  * @brief Formats TestMessage message into JSON
362847deee3SEd Tanous  *
363847deee3SEd Tanous  * See header file for more information
364847deee3SEd Tanous  * @endinternal
365847deee3SEd Tanous  */
testMessage()366847deee3SEd Tanous nlohmann::json testMessage()
367847deee3SEd Tanous {
368847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::testMessage, {});
369847deee3SEd Tanous }
370847deee3SEd Tanous 
371847deee3SEd Tanous /**
372847deee3SEd Tanous  * @internal
373847deee3SEd Tanous  * @brief Formats AggregationSourceDiscovered message into JSON
374847deee3SEd Tanous  *
375847deee3SEd Tanous  * See header file for more information
376847deee3SEd Tanous  * @endinternal
377847deee3SEd Tanous  */
aggregationSourceDiscovered(std::string_view arg1,std::string_view arg2)378847deee3SEd Tanous nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
379847deee3SEd Tanous                                            std::string_view arg2)
380847deee3SEd Tanous {
381847deee3SEd Tanous     return getLog(
382847deee3SEd Tanous         redfish::registries::resource_event::Index::aggregationSourceDiscovered,
383847deee3SEd Tanous         std::to_array({arg1, arg2}));
384847deee3SEd Tanous }
385847deee3SEd Tanous 
386847deee3SEd Tanous /**
387847deee3SEd Tanous  * @internal
388847deee3SEd Tanous  * @brief Formats LicenseExpired message into JSON
389847deee3SEd Tanous  *
390847deee3SEd Tanous  * See header file for more information
391847deee3SEd Tanous  * @endinternal
392847deee3SEd Tanous  */
licenseExpired(std::string_view arg1,std::string_view arg2)393847deee3SEd Tanous nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2)
394847deee3SEd Tanous {
395847deee3SEd Tanous     return getLog(redfish::registries::resource_event::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  */
licenseChanged(std::string_view arg1,std::string_view arg2)406847deee3SEd Tanous nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2)
407847deee3SEd Tanous {
408847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::licenseChanged,
409847deee3SEd Tanous                   std::to_array({arg1, arg2}));
410847deee3SEd Tanous }
411847deee3SEd Tanous 
412847deee3SEd Tanous /**
413847deee3SEd Tanous  * @internal
414847deee3SEd Tanous  * @brief Formats LicenseAdded message into JSON
415847deee3SEd Tanous  *
416847deee3SEd Tanous  * See header file for more information
417847deee3SEd Tanous  * @endinternal
418847deee3SEd Tanous  */
licenseAdded(std::string_view arg1,std::string_view arg2)419847deee3SEd Tanous nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2)
420847deee3SEd Tanous {
421847deee3SEd Tanous     return getLog(redfish::registries::resource_event::Index::licenseAdded,
422847deee3SEd Tanous                   std::to_array({arg1, arg2}));
423847deee3SEd Tanous }
424847deee3SEd Tanous 
425847deee3SEd Tanous } // namespace messages
426847deee3SEd Tanous } // namespace redfish
427