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