xref: /openbmc/bmcweb/redfish-core/src/error_messages.cpp (revision e8f66f0b0df2a483822b0c51b67c5b4e71c1d74b)
1 /****************************************************************
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 "error_messages.hpp"
12 
13 #include "error_message_utils.hpp"
14 #include "http_response.hpp"
15 #include "logging.hpp"
16 #include "registries.hpp"
17 #include "registries/base_message_registry.hpp"
18 
19 #include <boost/beast/http/field.hpp>
20 #include <boost/beast/http/status.hpp>
21 #include <boost/url/url_view_base.hpp>
22 #include <nlohmann/json.hpp>
23 
24 #include <array>
25 #include <cstddef>
26 #include <source_location>
27 #include <span>
28 #include <string_view>
29 
30 // Clang can't seem to decide whether this header needs to be included or not,
31 // and is inconsistent.  Include it for now
32 // NOLINTNEXTLINE(misc-include-cleaner)
33 #include <cstdint>
34 // NOLINTNEXTLINE(misc-include-cleaner)
35 #include <string>
36 // NOLINTNEXTLINE(misc-include-cleaner)
37 #include <utility>
38 
39 namespace redfish
40 {
41 
42 namespace messages
43 {
44 
getLog(redfish::registries::Base::Index name,std::span<const std::string_view> args)45 static nlohmann::json::object_t getLog(redfish::registries::Base::Index name,
46                                        std::span<const std::string_view> args)
47 {
48     size_t index = static_cast<size_t>(name);
49     if (index >= redfish::registries::Base::registry.size())
50     {
51         return {};
52     }
53     return getLogFromRegistry(redfish::registries::Base::header,
54                               redfish::registries::Base::registry, index, args);
55 }
56 
57 /**
58  * @internal
59  * @brief Formats Success message into JSON
60  *
61  * See header file for more information
62  * @endinternal
63  */
success()64 nlohmann::json::object_t success()
65 {
66     return getLog(redfish::registries::Base::Index::success, {});
67 }
68 
success(crow::Response & res)69 void success(crow::Response& res)
70 {
71     addMessageToJsonRoot(res.jsonValue, success());
72 }
73 
74 /**
75  * @internal
76  * @brief Formats GeneralError message into JSON
77  *
78  * See header file for more information
79  * @endinternal
80  */
generalError()81 nlohmann::json::object_t generalError()
82 {
83     return getLog(redfish::registries::Base::Index::generalError, {});
84 }
85 
generalError(crow::Response & res)86 void generalError(crow::Response& res)
87 {
88     res.result(boost::beast::http::status::internal_server_error);
89     addMessageToErrorJson(res.jsonValue, generalError());
90 }
91 
92 /**
93  * @internal
94  * @brief Formats Created message into JSON
95  *
96  * See header file for more information
97  * @endinternal
98  */
created()99 nlohmann::json::object_t created()
100 {
101     return getLog(redfish::registries::Base::Index::created, {});
102 }
103 
created(crow::Response & res)104 void created(crow::Response& res)
105 {
106     res.result(boost::beast::http::status::created);
107     addMessageToJsonRoot(res.jsonValue, created());
108 }
109 
110 /**
111  * @internal
112  * @brief Formats NoOperation message into JSON
113  *
114  * See header file for more information
115  * @endinternal
116  */
noOperation()117 nlohmann::json::object_t noOperation()
118 {
119     return getLog(redfish::registries::Base::Index::noOperation, {});
120 }
121 
noOperation(crow::Response & res)122 void noOperation(crow::Response& res)
123 {
124     res.result(boost::beast::http::status::bad_request);
125     addMessageToErrorJson(res.jsonValue, noOperation());
126 }
127 
128 /**
129  * @internal
130  * @brief Formats PropertyDuplicate message into JSON
131  *
132  * See header file for more information
133  * @endinternal
134  */
propertyDuplicate(std::string_view arg1)135 nlohmann::json::object_t propertyDuplicate(std::string_view arg1)
136 {
137     return getLog(redfish::registries::Base::Index::propertyDuplicate,
138                   std::to_array({arg1}));
139 }
140 
propertyDuplicate(crow::Response & res,std::string_view arg1)141 void propertyDuplicate(crow::Response& res, std::string_view arg1)
142 {
143     res.result(boost::beast::http::status::bad_request);
144     addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1);
145 }
146 
147 /**
148  * @internal
149  * @brief Formats PropertyUnknown message into JSON
150  *
151  * See header file for more information
152  * @endinternal
153  */
propertyUnknown(std::string_view arg1)154 nlohmann::json::object_t propertyUnknown(std::string_view arg1)
155 {
156     return getLog(redfish::registries::Base::Index::propertyUnknown,
157                   std::to_array({arg1}));
158 }
159 
propertyUnknown(crow::Response & res,std::string_view arg1)160 void propertyUnknown(crow::Response& res, std::string_view arg1)
161 {
162     res.result(boost::beast::http::status::bad_request);
163     addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1));
164 }
165 
166 /**
167  * @internal
168  * @brief Formats PropertyValueTypeError message into JSON
169  *
170  * See header file for more information
171  * @endinternal
172  */
propertyValueTypeError(const nlohmann::json & arg1,std::string_view arg2)173 nlohmann::json::object_t propertyValueTypeError(const nlohmann::json& arg1,
174                                                 std::string_view arg2)
175 {
176     std::string arg1Str =
177         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
178     return getLog(redfish::registries::Base::Index::propertyValueTypeError,
179                   std::to_array<std::string_view>({arg1Str, arg2}));
180 }
181 
propertyValueTypeError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)182 void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
183                             std::string_view arg2)
184 {
185     res.result(boost::beast::http::status::bad_request);
186     addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
187 }
188 
189 /**
190  * @internal
191  * @brief Formats PropertyValueFormatError message into JSON
192  *
193  * See header file for more information
194  * @endinternal
195  */
propertyValueFormatError(const nlohmann::json & arg1,std::string_view arg2)196 nlohmann::json::object_t propertyValueFormatError(const nlohmann::json& arg1,
197                                                   std::string_view arg2)
198 {
199     std::string arg1Str =
200         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
201     return getLog(redfish::registries::Base::Index::propertyValueFormatError,
202                   std::to_array<std::string_view>({arg1Str, arg2}));
203 }
204 
propertyValueFormatError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)205 void propertyValueFormatError(crow::Response& res, const nlohmann::json& arg1,
206                               std::string_view arg2)
207 {
208     res.result(boost::beast::http::status::bad_request);
209     addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2);
210 }
211 
212 /**
213  * @internal
214  * @brief Formats PropertyValueNotInList message into JSON
215  *
216  * See header file for more information
217  * @endinternal
218  */
propertyValueNotInList(const nlohmann::json & arg1,std::string_view arg2)219 nlohmann::json::object_t propertyValueNotInList(const nlohmann::json& arg1,
220                                                 std::string_view arg2)
221 {
222     std::string arg1Str =
223         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
224     return getLog(redfish::registries::Base::Index::propertyValueNotInList,
225                   std::to_array<std::string_view>({arg1Str, arg2}));
226 }
227 
propertyValueNotInList(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)228 void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1,
229                             std::string_view arg2)
230 {
231     res.result(boost::beast::http::status::bad_request);
232     addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2);
233 }
234 
235 /**
236  * @internal
237  * @brief Formats PropertyValueOutOfRange message into JSON
238  *
239  * See header file for more information
240  * @endinternal
241  */
propertyValueOutOfRange(const nlohmann::json & arg1,std::string_view arg2)242 nlohmann::json::object_t propertyValueOutOfRange(const nlohmann::json& arg1,
243                                                  std::string_view arg2)
244 {
245     std::string arg1Str =
246         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
247     return getLog(redfish::registries::Base::Index::propertyValueOutOfRange,
248                   std::to_array<std::string_view>({arg1Str, arg2}));
249 }
250 
propertyValueOutOfRange(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)251 void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1,
252                              std::string_view arg2)
253 {
254     res.result(boost::beast::http::status::bad_request);
255     addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2));
256 }
257 
258 /**
259  * @internal
260  * @brief Formats PropertyValueError message into JSON
261  *
262  * See header file for more information
263  * @endinternal
264  */
propertyValueError(std::string_view arg1)265 nlohmann::json::object_t propertyValueError(std::string_view arg1)
266 {
267     return getLog(redfish::registries::Base::Index::propertyValueError,
268                   std::to_array({arg1}));
269 }
270 
propertyValueError(crow::Response & res,std::string_view arg1)271 void propertyValueError(crow::Response& res, std::string_view arg1)
272 {
273     res.result(boost::beast::http::status::bad_request);
274     addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1);
275 }
276 
277 /**
278  * @internal
279  * @brief Formats PropertyNotWritable message into JSON
280  *
281  * See header file for more information
282  * @endinternal
283  */
propertyNotWritable(std::string_view arg1)284 nlohmann::json::object_t propertyNotWritable(std::string_view arg1)
285 {
286     return getLog(redfish::registries::Base::Index::propertyNotWritable,
287                   std::to_array({arg1}));
288 }
289 
propertyNotWritable(crow::Response & res,std::string_view arg1)290 void propertyNotWritable(crow::Response& res, std::string_view arg1)
291 {
292     res.result(boost::beast::http::status::method_not_allowed);
293     addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
294 }
295 
296 /**
297  * @internal
298  * @brief Formats PropertyNotUpdated message into JSON
299  *
300  * See header file for more information
301  * @endinternal
302  */
propertyNotUpdated(std::string_view arg1)303 nlohmann::json::object_t propertyNotUpdated(std::string_view arg1)
304 {
305     return getLog(redfish::registries::Base::Index::propertyNotUpdated,
306                   std::to_array({arg1}));
307 }
308 
propertyNotUpdated(crow::Response & res,std::string_view arg1)309 void propertyNotUpdated(crow::Response& res, std::string_view arg1)
310 {
311     res.result(boost::beast::http::status::bad_request);
312     addMessageToErrorJson(res.jsonValue, propertyNotUpdated(arg1));
313 }
314 
315 /**
316  * @internal
317  * @brief Formats PropertyMissing message into JSON
318  *
319  * See header file for more information
320  * @endinternal
321  */
propertyMissing(std::string_view arg1)322 nlohmann::json::object_t propertyMissing(std::string_view arg1)
323 {
324     return getLog(redfish::registries::Base::Index::propertyMissing,
325                   std::to_array({arg1}));
326 }
327 
propertyMissing(crow::Response & res,std::string_view arg1)328 void propertyMissing(crow::Response& res, std::string_view arg1)
329 {
330     res.result(boost::beast::http::status::bad_request);
331     addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
332 }
333 
334 /**
335  * @internal
336  * @brief Formats MalformedJSON message into JSON
337  *
338  * See header file for more information
339  * @endinternal
340  */
malformedJSON()341 nlohmann::json::object_t malformedJSON()
342 {
343     return getLog(redfish::registries::Base::Index::malformedJSON, {});
344 }
345 
malformedJSON(crow::Response & res)346 void malformedJSON(crow::Response& res)
347 {
348     res.result(boost::beast::http::status::bad_request);
349     addMessageToErrorJson(res.jsonValue, malformedJSON());
350 }
351 
352 /**
353  * @internal
354  * @brief Formats InvalidJSON message into JSON
355  *
356  * See header file for more information
357  * @endinternal
358  */
invalidJSON(uint64_t arg1)359 nlohmann::json::object_t invalidJSON(uint64_t arg1)
360 {
361     std::string arg1Str = std::to_string(arg1);
362     return getLog(redfish::registries::Base::Index::invalidJSON,
363                   std::to_array<std::string_view>({arg1Str}));
364 }
365 
invalidJSON(crow::Response & res,uint64_t arg1)366 void invalidJSON(crow::Response& res, uint64_t arg1)
367 {
368     res.result(boost::beast::http::status::bad_request);
369     addMessageToErrorJson(res.jsonValue, invalidJSON(arg1));
370 }
371 
372 /**
373  * @internal
374  * @brief Formats EmptyJSON message into JSON
375  *
376  * See header file for more information
377  * @endinternal
378  */
emptyJSON()379 nlohmann::json::object_t emptyJSON()
380 {
381     return getLog(redfish::registries::Base::Index::emptyJSON, {});
382 }
383 
emptyJSON(crow::Response & res)384 void emptyJSON(crow::Response& res)
385 {
386     res.result(boost::beast::http::status::bad_request);
387     addMessageToErrorJson(res.jsonValue, emptyJSON());
388 }
389 
390 /**
391  * @internal
392  * @brief Formats ActionNotSupported message into JSON
393  *
394  * See header file for more information
395  * @endinternal
396  */
actionNotSupported(std::string_view arg1)397 nlohmann::json::object_t actionNotSupported(std::string_view arg1)
398 {
399     return getLog(redfish::registries::Base::Index::actionNotSupported,
400                   std::to_array({arg1}));
401 }
402 
actionNotSupported(crow::Response & res,std::string_view arg1)403 void actionNotSupported(crow::Response& res, std::string_view arg1)
404 {
405     res.result(boost::beast::http::status::bad_request);
406     addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
407 }
408 
409 /**
410  * @internal
411  * @brief Formats ActionParameterMissing message into JSON
412  *
413  * See header file for more information
414  * @endinternal
415  */
actionParameterMissing(std::string_view arg1,std::string_view arg2)416 nlohmann::json::object_t actionParameterMissing(std::string_view arg1,
417                                                 std::string_view arg2)
418 {
419     return getLog(redfish::registries::Base::Index::actionParameterMissing,
420                   std::to_array({arg1, arg2}));
421 }
422 
actionParameterMissing(crow::Response & res,std::string_view arg1,std::string_view arg2)423 void actionParameterMissing(crow::Response& res, std::string_view arg1,
424                             std::string_view arg2)
425 {
426     res.result(boost::beast::http::status::bad_request);
427     addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2));
428 }
429 
430 /**
431  * @internal
432  * @brief Formats ActionParameterDuplicate message into JSON
433  *
434  * See header file for more information
435  * @endinternal
436  */
actionParameterDuplicate(std::string_view arg1,std::string_view arg2)437 nlohmann::json::object_t actionParameterDuplicate(std::string_view arg1,
438                                                   std::string_view arg2)
439 {
440     return getLog(redfish::registries::Base::Index::actionParameterDuplicate,
441                   std::to_array({arg1, arg2}));
442 }
443 
actionParameterDuplicate(crow::Response & res,std::string_view arg1,std::string_view arg2)444 void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
445                               std::string_view arg2)
446 {
447     res.result(boost::beast::http::status::bad_request);
448     addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
449 }
450 
451 /**
452  * @internal
453  * @brief Formats ActionParameterUnknown message into JSON
454  *
455  * See header file for more information
456  * @endinternal
457  */
actionParameterUnknown(std::string_view arg1,std::string_view arg2)458 nlohmann::json::object_t actionParameterUnknown(std::string_view arg1,
459                                                 std::string_view arg2)
460 {
461     return getLog(redfish::registries::Base::Index::actionParameterUnknown,
462                   std::to_array({arg1, arg2}));
463 }
464 
actionParameterUnknown(crow::Response & res,std::string_view arg1,std::string_view arg2)465 void actionParameterUnknown(crow::Response& res, std::string_view arg1,
466                             std::string_view arg2)
467 {
468     res.result(boost::beast::http::status::bad_request);
469     addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
470 }
471 
472 /**
473  * @internal
474  * @brief Formats ActionParameterValueTypeError message into JSON
475  *
476  * See header file for more information
477  * @endinternal
478  */
actionParameterValueTypeError(const nlohmann::json & arg1,std::string_view arg2,std::string_view arg3)479 nlohmann::json::object_t actionParameterValueTypeError(
480     const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
481 {
482     std::string arg1Str =
483         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
484     return getLog(
485         redfish::registries::Base::Index::actionParameterValueTypeError,
486         std::to_array<std::string_view>({arg1Str, arg2, arg3}));
487 }
488 
actionParameterValueTypeError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2,std::string_view arg3)489 void actionParameterValueTypeError(crow::Response& res,
490                                    const nlohmann::json& arg1,
491                                    std::string_view arg2, std::string_view arg3)
492 {
493     res.result(boost::beast::http::status::bad_request);
494     addMessageToErrorJson(res.jsonValue,
495                           actionParameterValueTypeError(arg1, arg2, arg3));
496 }
497 
498 /**
499  * @internal
500  * @brief Formats ActionParameterValueFormatError message into JSON
501  *
502  * See header file for more information
503  * @endinternal
504  */
actionParameterValueFormatError(const nlohmann::json & arg1,std::string_view arg2,std::string_view arg3)505 nlohmann::json::object_t actionParameterValueFormatError(
506     const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
507 {
508     std::string arg1Str =
509         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
510     return getLog(
511         redfish::registries::Base::Index::actionParameterValueFormatError,
512         std::to_array<std::string_view>({arg1Str, arg2, arg3}));
513 }
514 
actionParameterValueFormatError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2,std::string_view arg3)515 void actionParameterValueFormatError(
516     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
517     std::string_view arg3)
518 {
519     res.result(boost::beast::http::status::bad_request);
520     addMessageToErrorJson(res.jsonValue,
521                           actionParameterValueFormatError(arg1, arg2, arg3));
522 }
523 
524 /**
525  * @internal
526  * @brief Formats ActionParameterValueNotInList message into JSON
527  *
528  * See header file for more information
529  * @endinternal
530  */
actionParameterValueNotInList(std::string_view arg1,std::string_view arg2,std::string_view arg3)531 nlohmann::json::object_t actionParameterValueNotInList(
532     std::string_view arg1, std::string_view arg2, std::string_view arg3)
533 {
534     return getLog(
535         redfish::registries::Base::Index::actionParameterValueNotInList,
536         std::to_array({arg1, arg2, arg3}));
537 }
538 
actionParameterValueNotInList(crow::Response & res,std::string_view arg1,std::string_view arg2,std::string_view arg3)539 void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
540                                    std::string_view arg2, std::string_view arg3)
541 {
542     res.result(boost::beast::http::status::bad_request);
543     addMessageToErrorJson(res.jsonValue,
544                           actionParameterValueNotInList(arg1, arg2, arg3));
545 }
546 
547 /**
548  * @internal
549  * @brief Formats ActionParameterValueOutOfRange message into JSON
550  *
551  * See header file for more information
552  * @endinternal
553  */
actionParameterValueOutOfRange(std::string_view arg1,std::string_view arg2,std::string_view arg3)554 nlohmann::json::object_t actionParameterValueOutOfRange(
555     std::string_view arg1, std::string_view arg2, std::string_view arg3)
556 {
557     return getLog(
558         redfish::registries::Base::Index::actionParameterValueOutOfRange,
559         std::to_array({arg1, arg2, arg3}));
560 }
561 
actionParameterValueOutOfRange(crow::Response & res,std::string_view arg1,std::string_view arg2,std::string_view arg3)562 void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1,
563                                     std::string_view arg2,
564                                     std::string_view arg3)
565 {
566     res.result(boost::beast::http::status::bad_request);
567     addMessageToErrorJson(res.jsonValue,
568                           actionParameterValueOutOfRange(arg1, arg2, arg3));
569 }
570 
571 /**
572  * @internal
573  * @brief Formats ActionParameterValueError message into JSON
574  *
575  * See header file for more information
576  * @endinternal
577  */
actionParameterValueError(const nlohmann::json & arg1,std::string_view arg2)578 nlohmann::json::object_t actionParameterValueError(const nlohmann::json& arg1,
579                                                    std::string_view arg2)
580 {
581     std::string arg1Str =
582         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
583     return getLog(redfish::registries::Base::Index::actionParameterValueError,
584                   std::to_array<std::string_view>({arg1Str, arg2}));
585 }
586 
actionParameterValueError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)587 void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
588                                std::string_view arg2)
589 {
590     res.result(boost::beast::http::status::bad_request);
591     addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2));
592 }
593 
594 /**
595  * @internal
596  * @brief Formats ActionParameterNotSupported message into JSON
597  *
598  * See header file for more information
599  * @endinternal
600  */
actionParameterNotSupported(std::string_view arg1,std::string_view arg2)601 nlohmann::json::object_t actionParameterNotSupported(std::string_view arg1,
602                                                      std::string_view arg2)
603 {
604     return getLog(redfish::registries::Base::Index::actionParameterNotSupported,
605                   std::to_array({arg1, arg2}));
606 }
607 
actionParameterNotSupported(crow::Response & res,std::string_view arg1,std::string_view arg2)608 void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
609                                  std::string_view arg2)
610 {
611     res.result(boost::beast::http::status::bad_request);
612     addMessageToErrorJson(res.jsonValue,
613                           actionParameterNotSupported(arg1, arg2));
614 }
615 
616 /**
617  * @internal
618  * @brief Formats ArraySizeTooLong message into JSON
619  *
620  * See header file for more information
621  * @endinternal
622  */
arraySizeTooLong(std::string_view arg1,uint64_t arg2)623 nlohmann::json::object_t arraySizeTooLong(std::string_view arg1, uint64_t arg2)
624 {
625     std::string arg2Str = std::to_string(arg2);
626     return getLog(redfish::registries::Base::Index::arraySizeTooLong,
627                   std::to_array<std::string_view>({arg1, arg2Str}));
628 }
629 
arraySizeTooLong(crow::Response & res,std::string_view arg1,uint64_t arg2)630 void arraySizeTooLong(crow::Response& res, std::string_view arg1, uint64_t arg2)
631 {
632     res.result(boost::beast::http::status::bad_request);
633     addMessageToErrorJson(res.jsonValue, arraySizeTooLong(arg1, arg2));
634 }
635 
636 /**
637  * @internal
638  * @brief Formats ArraySizeTooShort message into JSON
639  *
640  * See header file for more information
641  * @endinternal
642  */
arraySizeTooShort(std::string_view arg1,uint64_t arg2)643 nlohmann::json::object_t arraySizeTooShort(std::string_view arg1, uint64_t arg2)
644 {
645     std::string arg2Str = std::to_string(arg2);
646     return getLog(redfish::registries::Base::Index::arraySizeTooShort,
647                   std::to_array<std::string_view>({arg1, arg2Str}));
648 }
649 
arraySizeTooShort(crow::Response & res,std::string_view arg1,uint64_t arg2)650 void arraySizeTooShort(crow::Response& res, std::string_view arg1,
651                        uint64_t arg2)
652 {
653     res.result(boost::beast::http::status::bad_request);
654     addMessageToErrorJson(res.jsonValue, arraySizeTooShort(arg1, arg2));
655 }
656 
657 /**
658  * @internal
659  * @brief Formats QueryParameterValueTypeError message into JSON
660  *
661  * See header file for more information
662  * @endinternal
663  */
queryParameterValueTypeError(const nlohmann::json & arg1,std::string_view arg2)664 nlohmann::json::object_t queryParameterValueTypeError(
665     const nlohmann::json& arg1, std::string_view arg2)
666 {
667     std::string arg1Str =
668         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
669     return getLog(
670         redfish::registries::Base::Index::queryParameterValueTypeError,
671         std::to_array<std::string_view>({arg1Str, arg2}));
672 }
673 
queryParameterValueTypeError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)674 void queryParameterValueTypeError(
675     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
676 {
677     res.result(boost::beast::http::status::bad_request);
678     addMessageToErrorJson(res.jsonValue,
679                           queryParameterValueTypeError(arg1, arg2));
680 }
681 
682 /**
683  * @internal
684  * @brief Formats QueryParameterValueFormatError message into JSON
685  *
686  * See header file for more information
687  * @endinternal
688  */
queryParameterValueFormatError(const nlohmann::json & arg1,std::string_view arg2)689 nlohmann::json::object_t queryParameterValueFormatError(
690     const nlohmann::json& arg1, std::string_view arg2)
691 {
692     std::string arg1Str =
693         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
694     return getLog(
695         redfish::registries::Base::Index::queryParameterValueFormatError,
696         std::to_array<std::string_view>({arg1Str, arg2}));
697 }
698 
queryParameterValueFormatError(crow::Response & res,const nlohmann::json & arg1,std::string_view arg2)699 void queryParameterValueFormatError(
700     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
701 {
702     res.result(boost::beast::http::status::bad_request);
703     addMessageToErrorJson(res.jsonValue,
704                           queryParameterValueFormatError(arg1, arg2));
705 }
706 
707 /**
708  * @internal
709  * @brief Formats QueryParameterValueError message into JSON
710  *
711  * See header file for more information
712  * @endinternal
713  */
queryParameterValueError(std::string_view arg1)714 nlohmann::json::object_t queryParameterValueError(std::string_view arg1)
715 {
716     return getLog(redfish::registries::Base::Index::queryParameterValueError,
717                   std::to_array({arg1}));
718 }
719 
queryParameterValueError(crow::Response & res,std::string_view arg1)720 void queryParameterValueError(crow::Response& res, std::string_view arg1)
721 {
722     res.result(boost::beast::http::status::bad_request);
723     addMessageToErrorJson(res.jsonValue, queryParameterValueError(arg1));
724 }
725 
726 /**
727  * @internal
728  * @brief Formats QueryParameterOutOfRange message into JSON
729  *
730  * See header file for more information
731  * @endinternal
732  */
queryParameterOutOfRange(std::string_view arg1,std::string_view arg2,std::string_view arg3)733 nlohmann::json::object_t queryParameterOutOfRange(
734     std::string_view arg1, std::string_view arg2, std::string_view arg3)
735 {
736     return getLog(redfish::registries::Base::Index::queryParameterOutOfRange,
737                   std::to_array({arg1, arg2, arg3}));
738 }
739 
queryParameterOutOfRange(crow::Response & res,std::string_view arg1,std::string_view arg2,std::string_view arg3)740 void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
741                               std::string_view arg2, std::string_view arg3)
742 {
743     res.result(boost::beast::http::status::bad_request);
744     addMessageToErrorJson(res.jsonValue,
745                           queryParameterOutOfRange(arg1, arg2, arg3));
746 }
747 
748 /**
749  * @internal
750  * @brief Formats QueryNotSupportedOnResource message into JSON
751  *
752  * See header file for more information
753  * @endinternal
754  */
queryNotSupportedOnResource()755 nlohmann::json::object_t queryNotSupportedOnResource()
756 {
757     return getLog(redfish::registries::Base::Index::queryNotSupportedOnResource,
758                   {});
759 }
760 
queryNotSupportedOnResource(crow::Response & res)761 void queryNotSupportedOnResource(crow::Response& res)
762 {
763     res.result(boost::beast::http::status::bad_request);
764     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
765 }
766 
767 /**
768  * @internal
769  * @brief Formats QueryNotSupportedOnOperation message into JSON
770  *
771  * See header file for more information
772  * @endinternal
773  */
queryNotSupportedOnOperation()774 nlohmann::json::object_t queryNotSupportedOnOperation()
775 {
776     return getLog(
777         redfish::registries::Base::Index::queryNotSupportedOnOperation, {});
778 }
779 
queryNotSupportedOnOperation(crow::Response & res)780 void queryNotSupportedOnOperation(crow::Response& res)
781 {
782     res.result(boost::beast::http::status::bad_request);
783     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
784 }
785 
786 /**
787  * @internal
788  * @brief Formats QueryNotSupported message into JSON
789  *
790  * See header file for more information
791  * @endinternal
792  */
queryNotSupported()793 nlohmann::json::object_t queryNotSupported()
794 {
795     return getLog(redfish::registries::Base::Index::queryNotSupported, {});
796 }
797 
queryNotSupported(crow::Response & res)798 void queryNotSupported(crow::Response& res)
799 {
800     res.result(boost::beast::http::status::bad_request);
801     addMessageToErrorJson(res.jsonValue, queryNotSupported());
802 }
803 
804 /**
805  * @internal
806  * @brief Formats QueryCombinationInvalid message into JSON
807  *
808  * See header file for more information
809  * @endinternal
810  */
queryCombinationInvalid()811 nlohmann::json::object_t queryCombinationInvalid()
812 {
813     return getLog(redfish::registries::Base::Index::queryCombinationInvalid,
814                   {});
815 }
816 
queryCombinationInvalid(crow::Response & res)817 void queryCombinationInvalid(crow::Response& res)
818 {
819     res.result(boost::beast::http::status::bad_request);
820     addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
821 }
822 
823 /**
824  * @internal
825  * @brief Formats QueryParameterUnsupported message into JSON
826  *
827  * See header file for more information
828  * @endinternal
829  */
queryParameterUnsupported(std::string_view arg1)830 nlohmann::json::object_t queryParameterUnsupported(std::string_view arg1)
831 {
832     return getLog(redfish::registries::Base::Index::queryParameterUnsupported,
833                   std::to_array({arg1}));
834 }
835 
queryParameterUnsupported(crow::Response & res,std::string_view arg1)836 void queryParameterUnsupported(crow::Response& res, std::string_view arg1)
837 {
838     res.result(boost::beast::http::status::bad_request);
839     addMessageToErrorJson(res.jsonValue, queryParameterUnsupported(arg1));
840 }
841 
842 /**
843  * @internal
844  * @brief Formats SessionLimitExceeded message into JSON
845  *
846  * See header file for more information
847  * @endinternal
848  */
sessionLimitExceeded()849 nlohmann::json::object_t sessionLimitExceeded()
850 {
851     return getLog(redfish::registries::Base::Index::sessionLimitExceeded, {});
852 }
853 
sessionLimitExceeded(crow::Response & res)854 void sessionLimitExceeded(crow::Response& res)
855 {
856     res.result(boost::beast::http::status::service_unavailable);
857     addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
858 }
859 
860 /**
861  * @internal
862  * @brief Formats EventSubscriptionLimitExceeded message into JSON
863  *
864  * See header file for more information
865  * @endinternal
866  */
eventSubscriptionLimitExceeded()867 nlohmann::json::object_t eventSubscriptionLimitExceeded()
868 {
869     return getLog(
870         redfish::registries::Base::Index::eventSubscriptionLimitExceeded, {});
871 }
872 
eventSubscriptionLimitExceeded(crow::Response & res)873 void eventSubscriptionLimitExceeded(crow::Response& res)
874 {
875     res.result(boost::beast::http::status::service_unavailable);
876     addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
877 }
878 
879 /**
880  * @internal
881  * @brief Formats ResourceCannotBeDeleted message into JSON
882  *
883  * See header file for more information
884  * @endinternal
885  */
resourceCannotBeDeleted()886 nlohmann::json::object_t resourceCannotBeDeleted()
887 {
888     return getLog(redfish::registries::Base::Index::resourceCannotBeDeleted,
889                   {});
890 }
891 
resourceCannotBeDeleted(crow::Response & res)892 void resourceCannotBeDeleted(crow::Response& res)
893 {
894     res.result(boost::beast::http::status::method_not_allowed);
895     addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
896 }
897 
898 /**
899  * @internal
900  * @brief Formats ResourceInUse message into JSON
901  *
902  * See header file for more information
903  * @endinternal
904  */
resourceInUse()905 nlohmann::json::object_t resourceInUse()
906 {
907     return getLog(redfish::registries::Base::Index::resourceInUse, {});
908 }
909 
resourceInUse(crow::Response & res)910 void resourceInUse(crow::Response& res)
911 {
912     res.result(boost::beast::http::status::service_unavailable);
913     addMessageToErrorJson(res.jsonValue, resourceInUse());
914 }
915 
916 /**
917  * @internal
918  * @brief Formats ResourceAlreadyExists message into JSON
919  *
920  * See header file for more information
921  * @endinternal
922  */
resourceAlreadyExists(std::string_view arg1,std::string_view arg2,std::string_view arg3)923 nlohmann::json::object_t resourceAlreadyExists(
924     std::string_view arg1, std::string_view arg2, std::string_view arg3)
925 {
926     return getLog(redfish::registries::Base::Index::resourceAlreadyExists,
927                   std::to_array({arg1, arg2, arg3}));
928 }
929 
resourceAlreadyExists(crow::Response & res,std::string_view arg1,std::string_view arg2,std::string_view arg3)930 void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
931                            std::string_view arg2, std::string_view arg3)
932 {
933     res.result(boost::beast::http::status::bad_request);
934     addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
935                      arg2);
936 }
937 
938 /**
939  * @internal
940  * @brief Formats ResourceNotFound message into JSON
941  *
942  * See header file for more information
943  * @endinternal
944  */
resourceNotFound(std::string_view arg1,std::string_view arg2)945 nlohmann::json::object_t resourceNotFound(std::string_view arg1,
946                                           std::string_view arg2)
947 {
948     return getLog(redfish::registries::Base::Index::resourceNotFound,
949                   std::to_array({arg1, arg2}));
950 }
951 
resourceNotFound(crow::Response & res,std::string_view arg1,std::string_view arg2)952 void resourceNotFound(crow::Response& res, std::string_view arg1,
953                       std::string_view arg2)
954 {
955     res.result(boost::beast::http::status::not_found);
956     addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
957 }
958 
959 /**
960  * @internal
961  * @brief Formats PayloadTooLarge message into JSON
962  *
963  * See header file for more information
964  * @endinternal
965  */
payloadTooLarge()966 nlohmann::json::object_t payloadTooLarge()
967 {
968     return getLog(redfish::registries::Base::Index::payloadTooLarge, {});
969 }
970 
payloadTooLarge(crow::Response & res)971 void payloadTooLarge(crow::Response& res)
972 {
973     res.result(boost::beast::http::status::bad_request);
974     addMessageToErrorJson(res.jsonValue, payloadTooLarge());
975 }
976 
977 /**
978  * @internal
979  * @brief Formats InsufficientStorage message into JSON
980  *
981  * See header file for more information
982  * @endinternal
983  */
insufficientStorage()984 nlohmann::json::object_t insufficientStorage()
985 {
986     return getLog(redfish::registries::Base::Index::insufficientStorage, {});
987 }
988 
insufficientStorage(crow::Response & res)989 void insufficientStorage(crow::Response& res)
990 {
991     res.result(boost::beast::http::status::insufficient_storage);
992     addMessageToErrorJson(res.jsonValue, insufficientStorage());
993 }
994 
995 /**
996  * @internal
997  * @brief Formats MissingOrMalformedPart message into JSON
998  *
999  * See header file for more information
1000  * @endinternal
1001  */
missingOrMalformedPart()1002 nlohmann::json::object_t missingOrMalformedPart()
1003 {
1004     return getLog(redfish::registries::Base::Index::missingOrMalformedPart, {});
1005 }
1006 
missingOrMalformedPart(crow::Response & res)1007 void missingOrMalformedPart(crow::Response& res)
1008 {
1009     res.result(boost::beast::http::status::bad_request);
1010     addMessageToErrorJson(res.jsonValue, missingOrMalformedPart());
1011 }
1012 
1013 /**
1014  * @internal
1015  * @brief Formats InvalidURI message into JSON
1016  *
1017  * See header file for more information
1018  * @endinternal
1019  */
invalidURI(std::string_view arg1)1020 nlohmann::json::object_t invalidURI(std::string_view arg1)
1021 {
1022     return getLog(redfish::registries::Base::Index::invalidURI,
1023                   std::to_array({arg1}));
1024 }
1025 
invalidURI(crow::Response & res,std::string_view arg1)1026 void invalidURI(crow::Response& res, std::string_view arg1)
1027 {
1028     res.result(boost::beast::http::status::bad_request);
1029     addMessageToErrorJson(res.jsonValue, invalidURI(arg1));
1030 }
1031 
1032 /**
1033  * @internal
1034  * @brief Formats CreateFailedMissingReqProperties message into JSON
1035  *
1036  * See header file for more information
1037  * @endinternal
1038  */
createFailedMissingReqProperties(std::string_view arg1)1039 nlohmann::json::object_t createFailedMissingReqProperties(std::string_view arg1)
1040 {
1041     return getLog(
1042         redfish::registries::Base::Index::createFailedMissingReqProperties,
1043         std::to_array({arg1}));
1044 }
1045 
createFailedMissingReqProperties(crow::Response & res,std::string_view arg1)1046 void createFailedMissingReqProperties(crow::Response& res,
1047                                       std::string_view arg1)
1048 {
1049     res.result(boost::beast::http::status::bad_request);
1050     addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
1051                      arg1);
1052 }
1053 
1054 /**
1055  * @internal
1056  * @brief Formats CreateLimitReachedForResource message into JSON
1057  *
1058  * See header file for more information
1059  * @endinternal
1060  */
createLimitReachedForResource()1061 nlohmann::json::object_t createLimitReachedForResource()
1062 {
1063     return getLog(
1064         redfish::registries::Base::Index::createLimitReachedForResource, {});
1065 }
1066 
createLimitReachedForResource(crow::Response & res)1067 void createLimitReachedForResource(crow::Response& res)
1068 {
1069     res.result(boost::beast::http::status::bad_request);
1070     addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
1071 }
1072 
1073 /**
1074  * @internal
1075  * @brief Formats ServiceShuttingDown message into JSON
1076  *
1077  * See header file for more information
1078  * @endinternal
1079  */
serviceShuttingDown()1080 nlohmann::json::object_t serviceShuttingDown()
1081 {
1082     return getLog(redfish::registries::Base::Index::serviceShuttingDown, {});
1083 }
1084 
serviceShuttingDown(crow::Response & res)1085 void serviceShuttingDown(crow::Response& res)
1086 {
1087     res.result(boost::beast::http::status::service_unavailable);
1088     addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
1089 }
1090 
1091 /**
1092  * @internal
1093  * @brief Formats ServiceInUnknownState message into JSON
1094  *
1095  * See header file for more information
1096  * @endinternal
1097  */
serviceInUnknownState()1098 nlohmann::json::object_t serviceInUnknownState()
1099 {
1100     return getLog(redfish::registries::Base::Index::serviceInUnknownState, {});
1101 }
1102 
serviceInUnknownState(crow::Response & res)1103 void serviceInUnknownState(crow::Response& res)
1104 {
1105     res.result(boost::beast::http::status::service_unavailable);
1106     addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
1107 }
1108 
1109 /**
1110  * @internal
1111  * @brief Formats NoValidSession message into JSON
1112  *
1113  * See header file for more information
1114  * @endinternal
1115  */
noValidSession()1116 nlohmann::json::object_t noValidSession()
1117 {
1118     return getLog(redfish::registries::Base::Index::noValidSession, {});
1119 }
1120 
noValidSession(crow::Response & res)1121 void noValidSession(crow::Response& res)
1122 {
1123     res.result(boost::beast::http::status::forbidden);
1124     addMessageToErrorJson(res.jsonValue, noValidSession());
1125 }
1126 
1127 /**
1128  * @internal
1129  * @brief Formats InsufficientPrivilege message into JSON
1130  *
1131  * See header file for more information
1132  * @endinternal
1133  */
insufficientPrivilege()1134 nlohmann::json::object_t insufficientPrivilege()
1135 {
1136     return getLog(redfish::registries::Base::Index::insufficientPrivilege, {});
1137 }
1138 
insufficientPrivilege(crow::Response & res)1139 void insufficientPrivilege(crow::Response& res)
1140 {
1141     res.result(boost::beast::http::status::forbidden);
1142     addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
1143 }
1144 
1145 /**
1146  * @internal
1147  * @brief Formats AccountModified message into JSON
1148  *
1149  * See header file for more information
1150  * @endinternal
1151  */
accountModified()1152 nlohmann::json::object_t accountModified()
1153 {
1154     return getLog(redfish::registries::Base::Index::accountModified, {});
1155 }
1156 
accountModified(crow::Response & res)1157 void accountModified(crow::Response& res)
1158 {
1159     res.result(boost::beast::http::status::ok);
1160     addMessageToErrorJson(res.jsonValue, accountModified());
1161 }
1162 
1163 /**
1164  * @internal
1165  * @brief Formats AccountNotModified message into JSON
1166  *
1167  * See header file for more information
1168  * @endinternal
1169  */
accountNotModified()1170 nlohmann::json::object_t accountNotModified()
1171 {
1172     return getLog(redfish::registries::Base::Index::accountNotModified, {});
1173 }
1174 
accountNotModified(crow::Response & res)1175 void accountNotModified(crow::Response& res)
1176 {
1177     res.result(boost::beast::http::status::bad_request);
1178     addMessageToErrorJson(res.jsonValue, accountNotModified());
1179 }
1180 
1181 /**
1182  * @internal
1183  * @brief Formats AccountRemoved message into JSON
1184  *
1185  * See header file for more information
1186  * @endinternal
1187  */
accountRemoved()1188 nlohmann::json::object_t accountRemoved()
1189 {
1190     return getLog(redfish::registries::Base::Index::accountRemoved, {});
1191 }
1192 
accountRemoved(crow::Response & res)1193 void accountRemoved(crow::Response& res)
1194 {
1195     res.result(boost::beast::http::status::ok);
1196     addMessageToJsonRoot(res.jsonValue, accountRemoved());
1197 }
1198 
1199 /**
1200  * @internal
1201  * @brief Formats AccountForSessionNoLongerExists message into JSON
1202  *
1203  * See header file for more information
1204  * @endinternal
1205  */
accountForSessionNoLongerExists()1206 nlohmann::json::object_t accountForSessionNoLongerExists()
1207 {
1208     return getLog(
1209         redfish::registries::Base::Index::accountForSessionNoLongerExists, {});
1210 }
1211 
accountForSessionNoLongerExists(crow::Response & res)1212 void accountForSessionNoLongerExists(crow::Response& res)
1213 {
1214     res.result(boost::beast::http::status::forbidden);
1215     addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
1216 }
1217 
1218 /**
1219  * @internal
1220  * @brief Formats InvalidObject message into JSON
1221  *
1222  * See header file for more information
1223  * @endinternal
1224  */
invalidObject(const boost::urls::url_view_base & arg1)1225 nlohmann::json::object_t invalidObject(const boost::urls::url_view_base& arg1)
1226 {
1227     return getLog(redfish::registries::Base::Index::invalidObject,
1228                   std::to_array<std::string_view>({arg1.buffer()}));
1229 }
1230 
invalidObject(crow::Response & res,const boost::urls::url_view_base & arg1)1231 void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1)
1232 {
1233     res.result(boost::beast::http::status::bad_request);
1234     addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
1235 }
1236 
1237 /**
1238  * @internal
1239  * @brief Formats InternalError message into JSON
1240  *
1241  * See header file for more information
1242  * @endinternal
1243  */
internalError()1244 nlohmann::json::object_t internalError()
1245 {
1246     return getLog(redfish::registries::Base::Index::internalError, {});
1247 }
1248 
internalError(crow::Response & res,const std::source_location location)1249 void internalError(crow::Response& res, const std::source_location location)
1250 {
1251     BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
1252                         location.line(), location.column(),
1253                         location.function_name());
1254     res.result(boost::beast::http::status::internal_server_error);
1255     addMessageToErrorJson(res.jsonValue, internalError());
1256 }
1257 
1258 /**
1259  * @internal
1260  * @brief Formats UnrecognizedRequestBody message into JSON
1261  *
1262  * See header file for more information
1263  * @endinternal
1264  */
unrecognizedRequestBody()1265 nlohmann::json::object_t unrecognizedRequestBody()
1266 {
1267     return getLog(redfish::registries::Base::Index::unrecognizedRequestBody,
1268                   {});
1269 }
1270 
unrecognizedRequestBody(crow::Response & res)1271 void unrecognizedRequestBody(crow::Response& res)
1272 {
1273     res.result(boost::beast::http::status::bad_request);
1274     addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
1275 }
1276 
1277 /**
1278  * @internal
1279  * @brief Formats ResourceMissingAtURI message into JSON
1280  *
1281  * See header file for more information
1282  * @endinternal
1283  */
resourceMissingAtURI(const boost::urls::url_view_base & arg1)1284 nlohmann::json::object_t resourceMissingAtURI(
1285     const boost::urls::url_view_base& arg1)
1286 {
1287     return getLog(redfish::registries::Base::Index::resourceMissingAtURI,
1288                   std::to_array<std::string_view>({arg1.buffer()}));
1289 }
1290 
resourceMissingAtURI(crow::Response & res,const boost::urls::url_view_base & arg1)1291 void resourceMissingAtURI(crow::Response& res,
1292                           const boost::urls::url_view_base& arg1)
1293 {
1294     res.result(boost::beast::http::status::bad_request);
1295     addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
1296 }
1297 
1298 /**
1299  * @internal
1300  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
1301  *
1302  * See header file for more information
1303  * @endinternal
1304  */
resourceAtUriInUnknownFormat(const boost::urls::url_view_base & arg1)1305 nlohmann::json::object_t resourceAtUriInUnknownFormat(
1306     const boost::urls::url_view_base& arg1)
1307 {
1308     return getLog(
1309         redfish::registries::Base::Index::resourceAtUriInUnknownFormat,
1310         std::to_array<std::string_view>({arg1.buffer()}));
1311 }
1312 
resourceAtUriInUnknownFormat(crow::Response & res,const boost::urls::url_view_base & arg1)1313 void resourceAtUriInUnknownFormat(crow::Response& res,
1314                                   const boost::urls::url_view_base& arg1)
1315 {
1316     res.result(boost::beast::http::status::bad_request);
1317     addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
1318 }
1319 
1320 /**
1321  * @internal
1322  * @brief Formats ResourceAtUriUnauthorized message into JSON
1323  *
1324  * See header file for more information
1325  * @endinternal
1326  */
resourceAtUriUnauthorized(const boost::urls::url_view_base & arg1,std::string_view arg2)1327 nlohmann::json::object_t resourceAtUriUnauthorized(
1328     const boost::urls::url_view_base& arg1, std::string_view arg2)
1329 {
1330     return getLog(redfish::registries::Base::Index::resourceAtUriUnauthorized,
1331                   std::to_array<std::string_view>({arg1.buffer(), arg2}));
1332 }
1333 
resourceAtUriUnauthorized(crow::Response & res,const boost::urls::url_view_base & arg1,std::string_view arg2)1334 void resourceAtUriUnauthorized(crow::Response& res,
1335                                const boost::urls::url_view_base& arg1,
1336                                std::string_view arg2)
1337 {
1338     res.result(boost::beast::http::status::unauthorized);
1339     addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
1340 }
1341 
1342 /**
1343  * @internal
1344  * @brief Formats CouldNotEstablishConnection message into JSON
1345  *
1346  * See header file for more information
1347  * @endinternal
1348  */
couldNotEstablishConnection(const boost::urls::url_view_base & arg1)1349 nlohmann::json::object_t couldNotEstablishConnection(
1350     const boost::urls::url_view_base& arg1)
1351 {
1352     return getLog(redfish::registries::Base::Index::couldNotEstablishConnection,
1353                   std::to_array<std::string_view>({arg1.buffer()}));
1354 }
1355 
couldNotEstablishConnection(crow::Response & res,const boost::urls::url_view_base & arg1)1356 void couldNotEstablishConnection(crow::Response& res,
1357                                  const boost::urls::url_view_base& arg1)
1358 {
1359     res.result(boost::beast::http::status::not_found);
1360     addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
1361 }
1362 
1363 /**
1364  * @internal
1365  * @brief Formats SourceDoesNotSupportProtocol message into JSON
1366  *
1367  * See header file for more information
1368  * @endinternal
1369  */
sourceDoesNotSupportProtocol(const boost::urls::url_view_base & arg1,std::string_view arg2)1370 nlohmann::json::object_t sourceDoesNotSupportProtocol(
1371     const boost::urls::url_view_base& arg1, std::string_view arg2)
1372 {
1373     return getLog(
1374         redfish::registries::Base::Index::sourceDoesNotSupportProtocol,
1375         std::to_array<std::string_view>({arg1.buffer(), arg2}));
1376 }
1377 
sourceDoesNotSupportProtocol(crow::Response & res,const boost::urls::url_view_base & arg1,std::string_view arg2)1378 void sourceDoesNotSupportProtocol(crow::Response& res,
1379                                   const boost::urls::url_view_base& arg1,
1380                                   std::string_view arg2)
1381 {
1382     res.result(boost::beast::http::status::bad_request);
1383     addMessageToErrorJson(res.jsonValue,
1384                           sourceDoesNotSupportProtocol(arg1, arg2));
1385 }
1386 
1387 /**
1388  * @internal
1389  * @brief Formats AccessDenied message into JSON
1390  *
1391  * See header file for more information
1392  * @endinternal
1393  */
accessDenied(const boost::urls::url_view_base & arg1)1394 nlohmann::json::object_t accessDenied(const boost::urls::url_view_base& arg1)
1395 {
1396     return getLog(redfish::registries::Base::Index::accessDenied,
1397                   std::to_array<std::string_view>({arg1.buffer()}));
1398 }
1399 
accessDenied(crow::Response & res,const boost::urls::url_view_base & arg1)1400 void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1)
1401 {
1402     res.result(boost::beast::http::status::forbidden);
1403     addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
1404 }
1405 
1406 /**
1407  * @internal
1408  * @brief Formats ServiceTemporarilyUnavailable message into JSON
1409  *
1410  * See header file for more information
1411  * @endinternal
1412  */
serviceTemporarilyUnavailable(std::string_view arg1)1413 nlohmann::json::object_t serviceTemporarilyUnavailable(std::string_view arg1)
1414 {
1415     return getLog(
1416         redfish::registries::Base::Index::serviceTemporarilyUnavailable,
1417         std::to_array({arg1}));
1418 }
1419 
serviceTemporarilyUnavailable(crow::Response & res,std::string_view arg1)1420 void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1)
1421 {
1422     res.addHeader(boost::beast::http::field::retry_after, arg1);
1423     res.result(boost::beast::http::status::service_unavailable);
1424     addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
1425 }
1426 
1427 /**
1428  * @internal
1429  * @brief Formats InvalidIndex message into JSON
1430  *
1431  * See header file for more information
1432  * @endinternal
1433  */
invalidIndex(uint64_t arg1)1434 nlohmann::json::object_t invalidIndex(uint64_t arg1)
1435 {
1436     std::string arg1Str = std::to_string(arg1);
1437     return getLog(redfish::registries::Base::Index::invalidIndex,
1438                   std::to_array<std::string_view>({arg1Str}));
1439 }
1440 
invalidIndex(crow::Response & res,uint64_t arg1)1441 void invalidIndex(crow::Response& res, uint64_t arg1)
1442 {
1443     res.result(boost::beast::http::status::bad_request);
1444     addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
1445 }
1446 
1447 /**
1448  * @internal
1449  * @brief Formats PropertyValueModified message into JSON
1450  *
1451  * See header file for more information
1452  * @endinternal
1453  */
propertyValueModified(std::string_view arg1,const nlohmann::json & arg2)1454 nlohmann::json::object_t propertyValueModified(std::string_view arg1,
1455                                                const nlohmann::json& arg2)
1456 {
1457     std::string arg2Str =
1458         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1459     return getLog(redfish::registries::Base::Index::propertyValueModified,
1460                   std::to_array<std::string_view>({arg1, arg2Str}));
1461 }
1462 
propertyValueModified(crow::Response & res,std::string_view arg1,const nlohmann::json & arg2)1463 void propertyValueModified(crow::Response& res, std::string_view arg1,
1464                            const nlohmann::json& arg2)
1465 {
1466     res.result(boost::beast::http::status::ok);
1467     addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
1468 }
1469 
1470 /**
1471  * @internal
1472  * @brief Formats ResourceInStandby message into JSON
1473  *
1474  * See header file for more information
1475  * @endinternal
1476  */
resourceInStandby()1477 nlohmann::json::object_t resourceInStandby()
1478 {
1479     return getLog(redfish::registries::Base::Index::resourceInStandby, {});
1480 }
1481 
resourceInStandby(crow::Response & res)1482 void resourceInStandby(crow::Response& res)
1483 {
1484     res.result(boost::beast::http::status::service_unavailable);
1485     addMessageToErrorJson(res.jsonValue, resourceInStandby());
1486 }
1487 
1488 /**
1489  * @internal
1490  * @brief Formats ResourceExhaustion message into JSON
1491  *
1492  * See header file for more information
1493  * @endinternal
1494  */
resourceExhaustion(std::string_view arg1)1495 nlohmann::json::object_t resourceExhaustion(std::string_view arg1)
1496 {
1497     return getLog(redfish::registries::Base::Index::resourceExhaustion,
1498                   std::to_array({arg1}));
1499 }
1500 
resourceExhaustion(crow::Response & res,std::string_view arg1)1501 void resourceExhaustion(crow::Response& res, std::string_view arg1)
1502 {
1503     res.result(boost::beast::http::status::service_unavailable);
1504     addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
1505 }
1506 
1507 /**
1508  * @internal
1509  * @brief Formats StringValueTooLong message into JSON
1510  *
1511  * See header file for more information
1512  * @endinternal
1513  */
stringValueTooLong(std::string_view arg1,uint64_t arg2)1514 nlohmann::json::object_t stringValueTooLong(std::string_view arg1,
1515                                             uint64_t arg2)
1516 {
1517     std::string arg2Str = std::to_string(arg2);
1518     return getLog(redfish::registries::Base::Index::stringValueTooLong,
1519                   std::to_array<std::string_view>({arg1, arg2Str}));
1520 }
1521 
stringValueTooLong(crow::Response & res,std::string_view arg1,uint64_t arg2)1522 void stringValueTooLong(crow::Response& res, std::string_view arg1,
1523                         uint64_t arg2)
1524 {
1525     res.result(boost::beast::http::status::bad_request);
1526     addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2));
1527 }
1528 
1529 /**
1530  * @internal
1531  * @brief Formats StringValueTooShort message into JSON
1532  *
1533  * See header file for more information
1534  * @endinternal
1535  */
stringValueTooShort(std::string_view arg1,uint64_t arg2)1536 nlohmann::json::object_t stringValueTooShort(std::string_view arg1,
1537                                              uint64_t arg2)
1538 {
1539     std::string arg2Str = std::to_string(arg2);
1540     return getLog(redfish::registries::Base::Index::stringValueTooShort,
1541                   std::to_array<std::string_view>({arg1, arg2Str}));
1542 }
1543 
stringValueTooShort(crow::Response & res,std::string_view arg1,uint64_t arg2)1544 void stringValueTooShort(crow::Response& res, std::string_view arg1,
1545                          uint64_t arg2)
1546 {
1547     res.result(boost::beast::http::status::bad_request);
1548     addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2));
1549 }
1550 
1551 /**
1552  * @internal
1553  * @brief Formats SessionTerminated message into JSON
1554  *
1555  * See header file for more information
1556  * @endinternal
1557  */
sessionTerminated()1558 nlohmann::json::object_t sessionTerminated()
1559 {
1560     return getLog(redfish::registries::Base::Index::sessionTerminated, {});
1561 }
1562 
sessionTerminated(crow::Response & res)1563 void sessionTerminated(crow::Response& res)
1564 {
1565     res.result(boost::beast::http::status::ok);
1566     addMessageToJsonRoot(res.jsonValue, sessionTerminated());
1567 }
1568 
1569 /**
1570  * @internal
1571  * @brief Formats SubscriptionTerminated message into JSON
1572  *
1573  * See header file for more information
1574  * @endinternal
1575  */
subscriptionTerminated()1576 nlohmann::json::object_t subscriptionTerminated()
1577 {
1578     return getLog(redfish::registries::Base::Index::subscriptionTerminated, {});
1579 }
1580 
subscriptionTerminated(crow::Response & res)1581 void subscriptionTerminated(crow::Response& res)
1582 {
1583     res.result(boost::beast::http::status::ok);
1584     addMessageToJsonRoot(res.jsonValue, subscriptionTerminated());
1585 }
1586 
1587 /**
1588  * @internal
1589  * @brief Formats ResourceTypeIncompatible message into JSON
1590  *
1591  * See header file for more information
1592  * @endinternal
1593  */
resourceTypeIncompatible(std::string_view arg1,std::string_view arg2)1594 nlohmann::json::object_t resourceTypeIncompatible(std::string_view arg1,
1595                                                   std::string_view arg2)
1596 {
1597     return getLog(redfish::registries::Base::Index::resourceTypeIncompatible,
1598                   std::to_array({arg1, arg2}));
1599 }
1600 
resourceTypeIncompatible(crow::Response & res,std::string_view arg1,std::string_view arg2)1601 void resourceTypeIncompatible(crow::Response& res, std::string_view arg1,
1602                               std::string_view arg2)
1603 {
1604     res.result(boost::beast::http::status::bad_request);
1605     addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2));
1606 }
1607 
1608 /**
1609  * @internal
1610  * @brief Formats PasswordChangeRequired message into JSON
1611  *
1612  * See header file for more information
1613  * @endinternal
1614  */
passwordChangeRequired(const boost::urls::url_view_base & arg1)1615 nlohmann::json::object_t passwordChangeRequired(
1616     const boost::urls::url_view_base& arg1)
1617 {
1618     return getLog(redfish::registries::Base::Index::passwordChangeRequired,
1619                   std::to_array<std::string_view>({arg1.buffer()}));
1620 }
1621 
passwordChangeRequired(crow::Response & res,const boost::urls::url_view_base & arg1)1622 void passwordChangeRequired(crow::Response& res,
1623                             const boost::urls::url_view_base& arg1)
1624 {
1625     addMessageToErrorJson(res.jsonValue, passwordChangeRequired(arg1));
1626 }
1627 
1628 /**
1629  * @internal
1630  * @brief Formats ResetRequired message into JSON
1631  *
1632  * See header file for more information
1633  * @endinternal
1634  */
resetRequired(const boost::urls::url_view_base & arg1,std::string_view arg2)1635 nlohmann::json::object_t resetRequired(const boost::urls::url_view_base& arg1,
1636                                        std::string_view arg2)
1637 {
1638     return getLog(redfish::registries::Base::Index::resetRequired,
1639                   std::to_array<std::string_view>({arg1.buffer(), arg2}));
1640 }
1641 
resetRequired(crow::Response & res,const boost::urls::url_view_base & arg1,std::string_view arg2)1642 void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1,
1643                    std::string_view arg2)
1644 {
1645     res.result(boost::beast::http::status::bad_request);
1646     addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2));
1647 }
1648 
1649 /**
1650  * @internal
1651  * @brief Formats ResetRecommended message into JSON
1652  *
1653  * See header file for more information
1654  * @endinternal
1655  */
resetRecommended(std::string_view arg1,std::string_view arg2)1656 nlohmann::json::object_t resetRecommended(std::string_view arg1,
1657                                           std::string_view arg2)
1658 {
1659     return getLog(redfish::registries::Base::Index::resetRecommended,
1660                   std::to_array({arg1, arg2}));
1661 }
1662 
resetRecommended(crow::Response & res,std::string_view arg1,std::string_view arg2)1663 void resetRecommended(crow::Response& res, std::string_view arg1,
1664                       std::string_view arg2)
1665 {
1666     res.result(boost::beast::http::status::bad_request);
1667     addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2));
1668 }
1669 
1670 /**
1671  * @internal
1672  * @brief Formats ChassisPowerStateOnRequired message into JSON
1673  *
1674  * See header file for more information
1675  * @endinternal
1676  */
chassisPowerStateOnRequired(std::string_view arg1)1677 nlohmann::json::object_t chassisPowerStateOnRequired(std::string_view arg1)
1678 {
1679     return getLog(redfish::registries::Base::Index::chassisPowerStateOnRequired,
1680                   std::to_array({arg1}));
1681 }
1682 
chassisPowerStateOnRequired(crow::Response & res,std::string_view arg1)1683 void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1)
1684 {
1685     res.result(boost::beast::http::status::bad_request);
1686     addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1));
1687 }
1688 
1689 /**
1690  * @internal
1691  * @brief Formats ChassisPowerStateOffRequired message into JSON
1692  *
1693  * See header file for more information
1694  * @endinternal
1695  */
chassisPowerStateOffRequired(std::string_view arg1)1696 nlohmann::json::object_t chassisPowerStateOffRequired(std::string_view arg1)
1697 {
1698     return getLog(
1699         redfish::registries::Base::Index::chassisPowerStateOffRequired,
1700         std::to_array({arg1}));
1701 }
1702 
chassisPowerStateOffRequired(crow::Response & res,std::string_view arg1)1703 void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1)
1704 {
1705     res.result(boost::beast::http::status::bad_request);
1706     addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1));
1707 }
1708 
1709 /**
1710  * @internal
1711  * @brief Formats PropertyValueConflict message into JSON
1712  *
1713  * See header file for more information
1714  * @endinternal
1715  */
propertyValueConflict(std::string_view arg1,std::string_view arg2)1716 nlohmann::json::object_t propertyValueConflict(std::string_view arg1,
1717                                                std::string_view arg2)
1718 {
1719     return getLog(redfish::registries::Base::Index::propertyValueConflict,
1720                   std::to_array({arg1, arg2}));
1721 }
1722 
propertyValueConflict(crow::Response & res,std::string_view arg1,std::string_view arg2)1723 void propertyValueConflict(crow::Response& res, std::string_view arg1,
1724                            std::string_view arg2)
1725 {
1726     res.result(boost::beast::http::status::bad_request);
1727     addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2));
1728 }
1729 
1730 /**
1731  * @internal
1732  * @brief Formats PropertyValueResourceConflict message into JSON
1733  *
1734  * See header file for more information
1735  * @endinternal
1736  */
propertyValueResourceConflict(std::string_view arg1,const nlohmann::json & arg2,const boost::urls::url_view_base & arg3)1737 nlohmann::json::object_t propertyValueResourceConflict(
1738     std::string_view arg1, const nlohmann::json& arg2,
1739     const boost::urls::url_view_base& arg3)
1740 {
1741     std::string arg2Str =
1742         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1743     return getLog(
1744         redfish::registries::Base::Index::propertyValueResourceConflict,
1745         std::to_array<std::string_view>({arg1, arg2Str, arg3.buffer()}));
1746 }
1747 
propertyValueResourceConflict(crow::Response & res,std::string_view arg1,const nlohmann::json & arg2,const boost::urls::url_view_base & arg3)1748 void propertyValueResourceConflict(crow::Response& res, std::string_view arg1,
1749                                    const nlohmann::json& arg2,
1750                                    const boost::urls::url_view_base& arg3)
1751 {
1752     res.result(boost::beast::http::status::conflict);
1753     addMessageToErrorJson(res.jsonValue,
1754                           propertyValueResourceConflict(arg1, arg2, arg3));
1755 }
1756 
1757 /**
1758  * @internal
1759  * @brief Formats PropertyValueExternalConflict message into JSON
1760  *
1761  * See header file for more information
1762  * @endinternal
1763  */
propertyValueExternalConflict(std::string_view arg1,const nlohmann::json & arg2)1764 nlohmann::json::object_t propertyValueExternalConflict(
1765     std::string_view arg1, const nlohmann::json& arg2)
1766 {
1767     std::string arg2Str =
1768         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1769     return getLog(
1770         redfish::registries::Base::Index::propertyValueExternalConflict,
1771         std::to_array<std::string_view>({arg1, arg2Str}));
1772 }
1773 
propertyValueExternalConflict(crow::Response & res,std::string_view arg1,const nlohmann::json & arg2)1774 void propertyValueExternalConflict(crow::Response& res, std::string_view arg1,
1775                                    const nlohmann::json& arg2)
1776 {
1777     res.result(boost::beast::http::status::conflict);
1778     addMessageToErrorJson(res.jsonValue,
1779                           propertyValueExternalConflict(arg1, arg2));
1780 }
1781 
1782 /**
1783  * @internal
1784  * @brief Formats PropertyValueIncorrect message into JSON
1785  *
1786  * See header file for more information
1787  * @endinternal
1788  */
propertyValueIncorrect(std::string_view arg1,const nlohmann::json & arg2)1789 nlohmann::json::object_t propertyValueIncorrect(std::string_view arg1,
1790                                                 const nlohmann::json& arg2)
1791 {
1792     std::string arg2Str =
1793         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1794     return getLog(redfish::registries::Base::Index::propertyValueIncorrect,
1795                   std::to_array<std::string_view>({arg1, arg2Str}));
1796 }
1797 
propertyValueIncorrect(crow::Response & res,std::string_view arg1,const nlohmann::json & arg2)1798 void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
1799                             const nlohmann::json& arg2)
1800 {
1801     res.result(boost::beast::http::status::bad_request);
1802     addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));
1803 }
1804 
1805 /**
1806  * @internal
1807  * @brief Formats ResourceCreationConflict message into JSON
1808  *
1809  * See header file for more information
1810  * @endinternal
1811  */
resourceCreationConflict(const boost::urls::url_view_base & arg1)1812 nlohmann::json::object_t resourceCreationConflict(
1813     const boost::urls::url_view_base& arg1)
1814 {
1815     return getLog(redfish::registries::Base::Index::resourceCreationConflict,
1816                   std::to_array<std::string_view>({arg1.buffer()}));
1817 }
1818 
resourceCreationConflict(crow::Response & res,const boost::urls::url_view_base & arg1)1819 void resourceCreationConflict(crow::Response& res,
1820                               const boost::urls::url_view_base& arg1)
1821 {
1822     res.result(boost::beast::http::status::bad_request);
1823     addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1));
1824 }
1825 
1826 /**
1827  * @internal
1828  * @brief Formats ActionParameterValueConflict message into JSON
1829  *
1830  * See header file for more information
1831  * @endinternal
1832  */
actionParameterValueConflict(std::string_view arg1,std::string_view arg2)1833 nlohmann::json::object_t actionParameterValueConflict(std::string_view arg1,
1834                                                       std::string_view arg2)
1835 {
1836     return getLog(
1837         redfish::registries::Base::Index::actionParameterValueConflict,
1838         std::to_array({arg1, arg2}));
1839 }
1840 
actionParameterValueConflict(crow::Response & res,std::string_view arg1,std::string_view arg2)1841 void actionParameterValueConflict(crow::Response& res, std::string_view arg1,
1842                                   std::string_view arg2)
1843 {
1844     res.result(boost::beast::http::status::bad_request);
1845     addMessageToErrorJson(res.jsonValue,
1846                           actionParameterValueConflict(arg1, arg2));
1847 }
1848 
1849 /**
1850  * @internal
1851  * @brief Formats MaximumErrorsExceeded message into JSON
1852  *
1853  * See header file for more information
1854  * @endinternal
1855  */
maximumErrorsExceeded()1856 nlohmann::json::object_t maximumErrorsExceeded()
1857 {
1858     return getLog(redfish::registries::Base::Index::maximumErrorsExceeded, {});
1859 }
1860 
maximumErrorsExceeded(crow::Response & res)1861 void maximumErrorsExceeded(crow::Response& res)
1862 {
1863     res.result(boost::beast::http::status::internal_server_error);
1864     addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded());
1865 }
1866 
1867 /**
1868  * @internal
1869  * @brief Formats PreconditionFailed message into JSON
1870  *
1871  * See header file for more information
1872  * @endinternal
1873  */
preconditionFailed()1874 nlohmann::json::object_t preconditionFailed()
1875 {
1876     return getLog(redfish::registries::Base::Index::preconditionFailed, {});
1877 }
1878 
preconditionFailed(crow::Response & res)1879 void preconditionFailed(crow::Response& res)
1880 {
1881     res.result(boost::beast::http::status::precondition_failed);
1882     addMessageToErrorJson(res.jsonValue, preconditionFailed());
1883 }
1884 
1885 /**
1886  * @internal
1887  * @brief Formats PreconditionRequired message into JSON
1888  *
1889  * See header file for more information
1890  * @endinternal
1891  */
preconditionRequired()1892 nlohmann::json::object_t preconditionRequired()
1893 {
1894     return getLog(redfish::registries::Base::Index::preconditionRequired, {});
1895 }
1896 
preconditionRequired(crow::Response & res)1897 void preconditionRequired(crow::Response& res)
1898 {
1899     res.result(boost::beast::http::status::bad_request);
1900     addMessageToErrorJson(res.jsonValue, preconditionRequired());
1901 }
1902 
1903 /**
1904  * @internal
1905  * @brief Formats HeaderMissing message into JSON
1906  *
1907  * See header file for more information
1908  * @endinternal
1909  */
headerMissing(std::string_view arg1)1910 nlohmann::json::object_t headerMissing(std::string_view arg1)
1911 {
1912     return getLog(redfish::registries::Base::Index::headerMissing,
1913                   std::to_array({arg1}));
1914 }
1915 
headerMissing(crow::Response & res,std::string_view arg1)1916 void headerMissing(crow::Response& res, std::string_view arg1)
1917 {
1918     res.result(boost::beast::http::status::bad_request);
1919     addMessageToErrorJson(res.jsonValue, headerMissing(arg1));
1920 }
1921 
1922 /**
1923  * @internal
1924  * @brief Formats HeaderInvalid message into JSON
1925  *
1926  * See header file for more information
1927  * @endinternal
1928  */
headerInvalid(std::string_view arg1)1929 nlohmann::json::object_t headerInvalid(std::string_view arg1)
1930 {
1931     return getLog(redfish::registries::Base::Index::headerInvalid,
1932                   std::to_array({arg1}));
1933 }
1934 
headerInvalid(crow::Response & res,std::string_view arg1)1935 void headerInvalid(crow::Response& res, std::string_view arg1)
1936 {
1937     res.result(boost::beast::http::status::bad_request);
1938     addMessageToErrorJson(res.jsonValue, headerInvalid(arg1));
1939 }
1940 
1941 /**
1942  * @internal
1943  * @brief Formats OperationFailed message into JSON
1944  *
1945  * See header file for more information
1946  * @endinternal
1947  */
operationFailed()1948 nlohmann::json::object_t operationFailed()
1949 {
1950     return getLog(redfish::registries::Base::Index::operationFailed, {});
1951 }
1952 
operationFailed(crow::Response & res)1953 void operationFailed(crow::Response& res)
1954 {
1955     res.result(boost::beast::http::status::bad_gateway);
1956     addMessageToErrorJson(res.jsonValue, operationFailed());
1957 }
1958 
1959 /**
1960  * @internal
1961  * @brief Formats OperationTimeout message into JSON
1962  *
1963  * See header file for more information
1964  * @endinternal
1965  */
operationTimeout()1966 nlohmann::json::object_t operationTimeout()
1967 {
1968     return getLog(redfish::registries::Base::Index::operationTimeout, {});
1969 }
1970 
operationTimeout(crow::Response & res)1971 void operationTimeout(crow::Response& res)
1972 {
1973     res.result(boost::beast::http::status::internal_server_error);
1974     addMessageToErrorJson(res.jsonValue, operationTimeout());
1975 }
1976 
1977 /**
1978  * @internal
1979  * @brief Formats OperationNotAllowed message into JSON
1980  *
1981  * See header file for more information
1982  * @endinternal
1983  */
operationNotAllowed()1984 nlohmann::json::object_t operationNotAllowed()
1985 {
1986     return getLog(redfish::registries::Base::Index::operationNotAllowed, {});
1987 }
1988 
operationNotAllowed(crow::Response & res)1989 void operationNotAllowed(crow::Response& res)
1990 {
1991     res.result(boost::beast::http::status::method_not_allowed);
1992     addMessageToErrorJson(res.jsonValue, operationNotAllowed());
1993 }
1994 
1995 /**
1996  * @internal
1997  * @brief Formats UndeterminedFault message into JSON
1998  *
1999  * See header file for more information
2000  * @endinternal
2001  */
undeterminedFault(std::string_view arg1)2002 nlohmann::json::object_t undeterminedFault(std::string_view arg1)
2003 {
2004     return getLog(redfish::registries::Base::Index::undeterminedFault,
2005                   std::to_array({arg1}));
2006 }
2007 
undeterminedFault(crow::Response & res,std::string_view arg1)2008 void undeterminedFault(crow::Response& res, std::string_view arg1)
2009 {
2010     res.result(boost::beast::http::status::bad_request);
2011     addMessageToErrorJson(res.jsonValue, undeterminedFault(arg1));
2012 }
2013 
2014 /**
2015  * @internal
2016  * @brief Formats ConditionInRelatedResource message into JSON
2017  *
2018  * See header file for more information
2019  * @endinternal
2020  */
conditionInRelatedResource()2021 nlohmann::json::object_t conditionInRelatedResource()
2022 {
2023     return getLog(redfish::registries::Base::Index::conditionInRelatedResource,
2024                   {});
2025 }
2026 
conditionInRelatedResource(crow::Response & res)2027 void conditionInRelatedResource(crow::Response& res)
2028 {
2029     res.result(boost::beast::http::status::bad_request);
2030     addMessageToErrorJson(res.jsonValue, conditionInRelatedResource());
2031 }
2032 
2033 /**
2034  * @internal
2035  * @brief Formats RestrictedRole message into JSON
2036  *
2037  * See header file for more information
2038  * @endinternal
2039  */
restrictedRole(std::string_view arg1)2040 nlohmann::json::object_t restrictedRole(std::string_view arg1)
2041 {
2042     return getLog(redfish::registries::Base::Index::restrictedRole,
2043                   std::to_array({arg1}));
2044 }
2045 
restrictedRole(crow::Response & res,std::string_view arg1)2046 void restrictedRole(crow::Response& res, std::string_view arg1)
2047 {
2048     res.result(boost::beast::http::status::forbidden);
2049     addMessageToErrorJson(res.jsonValue, restrictedRole(arg1));
2050 }
2051 
2052 /**
2053  * @internal
2054  * @brief Formats RestrictedPrivilege message into JSON
2055  *
2056  * See header file for more information
2057  * @endinternal
2058  */
restrictedPrivilege(std::string_view arg1)2059 nlohmann::json::object_t restrictedPrivilege(std::string_view arg1)
2060 {
2061     return getLog(redfish::registries::Base::Index::restrictedPrivilege,
2062                   std::to_array({arg1}));
2063 }
2064 
restrictedPrivilege(crow::Response & res,std::string_view arg1)2065 void restrictedPrivilege(crow::Response& res, std::string_view arg1)
2066 {
2067     res.result(boost::beast::http::status::bad_request);
2068     addMessageToErrorJson(res.jsonValue, restrictedPrivilege(arg1));
2069 }
2070 
2071 /**
2072  * @internal
2073  * @brief Formats StrictAccountTypes message into JSON
2074  *
2075  * See header file for more information
2076  * @endinternal
2077  */
strictAccountTypes(std::string_view arg1)2078 nlohmann::json::object_t strictAccountTypes(std::string_view arg1)
2079 {
2080     return getLog(redfish::registries::Base::Index::strictAccountTypes,
2081                   std::to_array({arg1}));
2082 }
2083 
strictAccountTypes(crow::Response & res,std::string_view arg1)2084 void strictAccountTypes(crow::Response& res, std::string_view arg1)
2085 {
2086     res.result(boost::beast::http::status::bad_request);
2087     addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1));
2088 }
2089 
2090 /**
2091  * @internal
2092  * @brief Formats PropertyDeprecated message into JSON
2093  *
2094  * See header file for more information
2095  * @endinternal
2096  */
propertyDeprecated(std::string_view arg1)2097 nlohmann::json::object_t propertyDeprecated(std::string_view arg1)
2098 {
2099     return getLog(redfish::registries::Base::Index::propertyDeprecated,
2100                   std::to_array({arg1}));
2101 }
2102 
propertyDeprecated(crow::Response & res,std::string_view arg1)2103 void propertyDeprecated(crow::Response& res, std::string_view arg1)
2104 {
2105     res.result(boost::beast::http::status::bad_request);
2106     addMessageToErrorJson(res.jsonValue, propertyDeprecated(arg1));
2107 }
2108 
2109 /**
2110  * @internal
2111  * @brief Formats ResourceDeprecated message into JSON
2112  *
2113  * See header file for more information
2114  * @endinternal
2115  */
resourceDeprecated(std::string_view arg1)2116 nlohmann::json::object_t resourceDeprecated(std::string_view arg1)
2117 {
2118     return getLog(redfish::registries::Base::Index::resourceDeprecated,
2119                   std::to_array({arg1}));
2120 }
2121 
resourceDeprecated(crow::Response & res,std::string_view arg1)2122 void resourceDeprecated(crow::Response& res, std::string_view arg1)
2123 {
2124     res.result(boost::beast::http::status::bad_request);
2125     addMessageToErrorJson(res.jsonValue, resourceDeprecated(arg1));
2126 }
2127 
2128 /**
2129  * @internal
2130  * @brief Formats PropertyValueDeprecated message into JSON
2131  *
2132  * See header file for more information
2133  * @endinternal
2134  */
propertyValueDeprecated(std::string_view arg1,std::string_view arg2)2135 nlohmann::json::object_t propertyValueDeprecated(std::string_view arg1,
2136                                                  std::string_view arg2)
2137 {
2138     return getLog(redfish::registries::Base::Index::propertyValueDeprecated,
2139                   std::to_array({arg1, arg2}));
2140 }
2141 
propertyValueDeprecated(crow::Response & res,std::string_view arg1,std::string_view arg2)2142 void propertyValueDeprecated(crow::Response& res, std::string_view arg1,
2143                              std::string_view arg2)
2144 {
2145     res.result(boost::beast::http::status::bad_request);
2146     addMessageToErrorJson(res.jsonValue, propertyValueDeprecated(arg1, arg2));
2147 }
2148 
2149 /**
2150  * @internal
2151  * @brief Formats ActionDeprecated message into JSON
2152  *
2153  * See header file for more information
2154  * @endinternal
2155  */
actionDeprecated(std::string_view arg1)2156 nlohmann::json::object_t actionDeprecated(std::string_view arg1)
2157 {
2158     return getLog(redfish::registries::Base::Index::actionDeprecated,
2159                   std::to_array({arg1}));
2160 }
2161 
actionDeprecated(crow::Response & res,std::string_view arg1)2162 void actionDeprecated(crow::Response& res, std::string_view arg1)
2163 {
2164     res.result(boost::beast::http::status::bad_request);
2165     addMessageToErrorJson(res.jsonValue, actionDeprecated(arg1));
2166 }
2167 
2168 /**
2169  * @internal
2170  * @brief Formats NetworkNameResolutionNotConfigured message into JSON
2171  *
2172  * See header file for more information
2173  * @endinternal
2174  */
networkNameResolutionNotConfigured()2175 nlohmann::json::object_t networkNameResolutionNotConfigured()
2176 {
2177     return getLog(
2178         redfish::registries::Base::Index::networkNameResolutionNotConfigured,
2179         {});
2180 }
2181 
networkNameResolutionNotConfigured(crow::Response & res)2182 void networkNameResolutionNotConfigured(crow::Response& res)
2183 {
2184     res.result(boost::beast::http::status::bad_request);
2185     addMessageToErrorJson(res.jsonValue, networkNameResolutionNotConfigured());
2186 }
2187 
2188 /**
2189  * @internal
2190  * @brief Formats NetworkNameResolutionNotSupported message into JSON
2191  *
2192  * See header file for more information
2193  * @endinternal
2194  */
networkNameResolutionNotSupported()2195 nlohmann::json::object_t networkNameResolutionNotSupported()
2196 {
2197     return getLog(
2198         redfish::registries::Base::Index::networkNameResolutionNotSupported,
2199         {});
2200 }
2201 
networkNameResolutionNotSupported(crow::Response & res)2202 void networkNameResolutionNotSupported(crow::Response& res)
2203 {
2204     res.result(boost::beast::http::status::bad_request);
2205     addMessageToErrorJson(res.jsonValue, networkNameResolutionNotSupported());
2206 }
2207 
2208 /**
2209  * @internal
2210  * @brief Formats ServiceDisabled message into JSON
2211  *
2212  * See header file for more information
2213  * @endinternal
2214  */
serviceDisabled(std::string_view arg1)2215 nlohmann::json::object_t serviceDisabled(std::string_view arg1)
2216 {
2217     return getLog(redfish::registries::Base::Index::serviceDisabled,
2218                   std::to_array({arg1}));
2219 }
2220 
serviceDisabled(crow::Response & res,std::string_view arg1)2221 void serviceDisabled(crow::Response& res, std::string_view arg1)
2222 {
2223     res.result(boost::beast::http::status::service_unavailable);
2224     addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1));
2225 }
2226 
2227 /**
2228  * @internal
2229  * @brief Formats EventBufferExceeded message into JSON
2230  *
2231  * See header file for more information
2232  * @endinternal
2233  */
eventBufferExceeded()2234 nlohmann::json::object_t eventBufferExceeded()
2235 {
2236     return getLog(redfish::registries::Base::Index::eventBufferExceeded, {});
2237 }
2238 
eventBufferExceeded(crow::Response & res)2239 void eventBufferExceeded(crow::Response& res)
2240 {
2241     res.result(boost::beast::http::status::bad_request);
2242     addMessageToErrorJson(res.jsonValue, eventBufferExceeded());
2243 }
2244 
2245 /**
2246  * @internal
2247  * @brief Formats AuthenticationTokenRequired message into JSON
2248  *
2249  * See header file for more information
2250  * @endinternal
2251  */
authenticationTokenRequired()2252 nlohmann::json::object_t authenticationTokenRequired()
2253 {
2254     return getLog(redfish::registries::Base::Index::authenticationTokenRequired,
2255                   {});
2256 }
2257 
authenticationTokenRequired(crow::Response & res)2258 void authenticationTokenRequired(crow::Response& res)
2259 {
2260     res.result(boost::beast::http::status::bad_request);
2261     addMessageToErrorJson(res.jsonValue, authenticationTokenRequired());
2262 }
2263 
2264 /**
2265  * @internal
2266  * @brief Formats OneTimePasscodeSent message into JSON
2267  *
2268  * See header file for more information
2269  * @endinternal
2270  */
oneTimePasscodeSent(std::string_view arg1)2271 nlohmann::json::object_t oneTimePasscodeSent(std::string_view arg1)
2272 {
2273     return getLog(redfish::registries::Base::Index::oneTimePasscodeSent,
2274                   std::to_array({arg1}));
2275 }
2276 
oneTimePasscodeSent(crow::Response & res,std::string_view arg1)2277 void oneTimePasscodeSent(crow::Response& res, std::string_view arg1)
2278 {
2279     res.result(boost::beast::http::status::bad_request);
2280     addMessageToErrorJson(res.jsonValue, oneTimePasscodeSent(arg1));
2281 }
2282 
2283 /**
2284  * @internal
2285  * @brief Formats LicenseRequired message into JSON
2286  *
2287  * See header file for more information
2288  * @endinternal
2289  */
licenseRequired(std::string_view arg1)2290 nlohmann::json::object_t licenseRequired(std::string_view arg1)
2291 {
2292     return getLog(redfish::registries::Base::Index::licenseRequired,
2293                   std::to_array({arg1}));
2294 }
2295 
licenseRequired(crow::Response & res,std::string_view arg1)2296 void licenseRequired(crow::Response& res, std::string_view arg1)
2297 {
2298     res.result(boost::beast::http::status::bad_request);
2299     addMessageToErrorJson(res.jsonValue, licenseRequired(arg1));
2300 }
2301 
2302 /**
2303  * @internal
2304  * @brief Formats PropertyModified message into JSON
2305  *
2306  * See header file for more information
2307  * @endinternal
2308  */
propertyModified()2309 nlohmann::json::object_t propertyModified()
2310 {
2311     return getLog(redfish::registries::Base::Index::propertyModified, {});
2312 }
2313 
propertyModified(crow::Response & res)2314 void propertyModified(crow::Response& res)
2315 {
2316     res.result(boost::beast::http::status::bad_request);
2317     addMessageToErrorJson(res.jsonValue, propertyModified());
2318 }
2319 
2320 /**
2321  * @internal
2322  * @brief Formats GenerateSecretKeyRequired message into JSON
2323  *
2324  * See header file for more information
2325  * @endinternal
2326  */
generateSecretKeyRequired(const boost::urls::url_view_base & arg1)2327 nlohmann::json::object_t generateSecretKeyRequired(
2328     const boost::urls::url_view_base& arg1)
2329 {
2330     return getLog(redfish::registries::Base::Index::generateSecretKeyRequired,
2331                   std::to_array<std::string_view>({arg1.buffer()}));
2332 }
2333 
generateSecretKeyRequired(crow::Response & res,const boost::urls::url_view_base & arg1)2334 void generateSecretKeyRequired(crow::Response& res,
2335                                const boost::urls::url_view_base& arg1)
2336 {
2337     res.result(boost::beast::http::status::forbidden);
2338     addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1));
2339 }
2340 
2341 } // namespace messages
2342 } // namespace redfish
2343