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 43 static nlohmann::json::object_t 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 */ 62 nlohmann::json::object_t success() 63 { 64 return getLog(redfish::registries::Base::Index::success, {}); 65 } 66 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 */ 79 nlohmann::json::object_t generalError() 80 { 81 return getLog(redfish::registries::Base::Index::generalError, {}); 82 } 83 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 */ 97 nlohmann::json::object_t created() 98 { 99 return getLog(redfish::registries::Base::Index::created, {}); 100 } 101 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 */ 115 nlohmann::json::object_t noOperation() 116 { 117 return getLog(redfish::registries::Base::Index::noOperation, {}); 118 } 119 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 */ 133 nlohmann::json::object_t propertyDuplicate(std::string_view arg1) 134 { 135 return getLog(redfish::registries::Base::Index::propertyDuplicate, 136 std::to_array({arg1})); 137 } 138 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 */ 152 nlohmann::json::object_t propertyUnknown(std::string_view arg1) 153 { 154 return getLog(redfish::registries::Base::Index::propertyUnknown, 155 std::to_array({arg1})); 156 } 157 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 */ 171 nlohmann::json::object_t 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 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 */ 194 nlohmann::json::object_t 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 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 */ 217 nlohmann::json::object_t 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 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 */ 240 nlohmann::json::object_t 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 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 */ 263 nlohmann::json::object_t propertyValueError(std::string_view arg1) 264 { 265 return getLog(redfish::registries::Base::Index::propertyValueError, 266 std::to_array({arg1})); 267 } 268 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 */ 282 nlohmann::json::object_t propertyNotWritable(std::string_view arg1) 283 { 284 return getLog(redfish::registries::Base::Index::propertyNotWritable, 285 std::to_array({arg1})); 286 } 287 288 void propertyNotWritable(crow::Response& res, std::string_view arg1) 289 { 290 res.result(boost::beast::http::status::method_not_allowed); 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 */ 301 nlohmann::json::object_t propertyNotUpdated(std::string_view arg1) 302 { 303 return getLog(redfish::registries::Base::Index::propertyNotUpdated, 304 std::to_array({arg1})); 305 } 306 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 */ 320 nlohmann::json::object_t propertyMissing(std::string_view arg1) 321 { 322 return getLog(redfish::registries::Base::Index::propertyMissing, 323 std::to_array({arg1})); 324 } 325 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 */ 339 nlohmann::json::object_t malformedJSON() 340 { 341 return getLog(redfish::registries::Base::Index::malformedJSON, {}); 342 } 343 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 */ 357 nlohmann::json::object_t invalidJSON(std::string_view arg1) 358 { 359 return getLog(redfish::registries::Base::Index::invalidJSON, 360 std::to_array({arg1})); 361 } 362 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 */ 376 nlohmann::json::object_t emptyJSON() 377 { 378 return getLog(redfish::registries::Base::Index::emptyJSON, {}); 379 } 380 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 */ 394 nlohmann::json::object_t actionNotSupported(std::string_view arg1) 395 { 396 return getLog(redfish::registries::Base::Index::actionNotSupported, 397 std::to_array({arg1})); 398 } 399 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 */ 413 nlohmann::json::object_t 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 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 */ 434 nlohmann::json::object_t 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 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 */ 455 nlohmann::json::object_t 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 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 */ 476 nlohmann::json::object_t 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 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 */ 502 nlohmann::json::object_t 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 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 */ 528 nlohmann::json::object_t 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 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 */ 551 nlohmann::json::object_t 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 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 */ 575 nlohmann::json::object_t 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 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 */ 598 nlohmann::json::object_t 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 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 */ 620 nlohmann::json::object_t 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 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 */ 640 nlohmann::json::object_t arraySizeTooShort(std::string_view arg1, 641 std::string_view arg2) 642 { 643 return getLog(redfish::registries::Base::Index::arraySizeTooShort, 644 std::to_array({arg1, arg2})); 645 } 646 647 void arraySizeTooShort(crow::Response& res, std::string_view arg1, 648 std::string_view arg2) 649 { 650 res.result(boost::beast::http::status::bad_request); 651 addMessageToErrorJson(res.jsonValue, arraySizeTooShort(arg1, arg2)); 652 } 653 654 /** 655 * @internal 656 * @brief Formats QueryParameterValueTypeError message into JSON 657 * 658 * See header file for more information 659 * @endinternal 660 */ 661 nlohmann::json::object_t queryParameterValueTypeError( 662 const nlohmann::json& arg1, std::string_view arg2) 663 { 664 std::string arg1Str = 665 arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 666 return getLog( 667 redfish::registries::Base::Index::queryParameterValueTypeError, 668 std::to_array<std::string_view>({arg1Str, arg2})); 669 } 670 671 void queryParameterValueTypeError( 672 crow::Response& res, const nlohmann::json& arg1, std::string_view arg2) 673 { 674 res.result(boost::beast::http::status::bad_request); 675 addMessageToErrorJson(res.jsonValue, 676 queryParameterValueTypeError(arg1, arg2)); 677 } 678 679 /** 680 * @internal 681 * @brief Formats QueryParameterValueFormatError message into JSON 682 * 683 * See header file for more information 684 * @endinternal 685 */ 686 nlohmann::json::object_t queryParameterValueFormatError( 687 const nlohmann::json& arg1, std::string_view arg2) 688 { 689 std::string arg1Str = 690 arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 691 return getLog( 692 redfish::registries::Base::Index::queryParameterValueFormatError, 693 std::to_array<std::string_view>({arg1Str, arg2})); 694 } 695 696 void queryParameterValueFormatError( 697 crow::Response& res, const nlohmann::json& arg1, std::string_view arg2) 698 { 699 res.result(boost::beast::http::status::bad_request); 700 addMessageToErrorJson(res.jsonValue, 701 queryParameterValueFormatError(arg1, arg2)); 702 } 703 704 /** 705 * @internal 706 * @brief Formats QueryParameterValueError message into JSON 707 * 708 * See header file for more information 709 * @endinternal 710 */ 711 nlohmann::json::object_t queryParameterValueError(std::string_view arg1) 712 { 713 return getLog(redfish::registries::Base::Index::queryParameterValueError, 714 std::to_array({arg1})); 715 } 716 717 void queryParameterValueError(crow::Response& res, std::string_view arg1) 718 { 719 res.result(boost::beast::http::status::bad_request); 720 addMessageToErrorJson(res.jsonValue, queryParameterValueError(arg1)); 721 } 722 723 /** 724 * @internal 725 * @brief Formats QueryParameterOutOfRange message into JSON 726 * 727 * See header file for more information 728 * @endinternal 729 */ 730 nlohmann::json::object_t queryParameterOutOfRange( 731 std::string_view arg1, std::string_view arg2, std::string_view arg3) 732 { 733 return getLog(redfish::registries::Base::Index::queryParameterOutOfRange, 734 std::to_array({arg1, arg2, arg3})); 735 } 736 737 void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 738 std::string_view arg2, std::string_view arg3) 739 { 740 res.result(boost::beast::http::status::bad_request); 741 addMessageToErrorJson(res.jsonValue, 742 queryParameterOutOfRange(arg1, arg2, arg3)); 743 } 744 745 /** 746 * @internal 747 * @brief Formats QueryNotSupportedOnResource message into JSON 748 * 749 * See header file for more information 750 * @endinternal 751 */ 752 nlohmann::json::object_t queryNotSupportedOnResource() 753 { 754 return getLog(redfish::registries::Base::Index::queryNotSupportedOnResource, 755 {}); 756 } 757 758 void queryNotSupportedOnResource(crow::Response& res) 759 { 760 res.result(boost::beast::http::status::bad_request); 761 addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 762 } 763 764 /** 765 * @internal 766 * @brief Formats QueryNotSupportedOnOperation message into JSON 767 * 768 * See header file for more information 769 * @endinternal 770 */ 771 nlohmann::json::object_t queryNotSupportedOnOperation() 772 { 773 return getLog( 774 redfish::registries::Base::Index::queryNotSupportedOnOperation, {}); 775 } 776 777 void queryNotSupportedOnOperation(crow::Response& res) 778 { 779 res.result(boost::beast::http::status::bad_request); 780 addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 781 } 782 783 /** 784 * @internal 785 * @brief Formats QueryNotSupported message into JSON 786 * 787 * See header file for more information 788 * @endinternal 789 */ 790 nlohmann::json::object_t queryNotSupported() 791 { 792 return getLog(redfish::registries::Base::Index::queryNotSupported, {}); 793 } 794 795 void queryNotSupported(crow::Response& res) 796 { 797 res.result(boost::beast::http::status::bad_request); 798 addMessageToErrorJson(res.jsonValue, queryNotSupported()); 799 } 800 801 /** 802 * @internal 803 * @brief Formats QueryCombinationInvalid message into JSON 804 * 805 * See header file for more information 806 * @endinternal 807 */ 808 nlohmann::json::object_t queryCombinationInvalid() 809 { 810 return getLog(redfish::registries::Base::Index::queryCombinationInvalid, 811 {}); 812 } 813 814 void queryCombinationInvalid(crow::Response& res) 815 { 816 res.result(boost::beast::http::status::bad_request); 817 addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 818 } 819 820 /** 821 * @internal 822 * @brief Formats QueryParameterUnsupported message into JSON 823 * 824 * See header file for more information 825 * @endinternal 826 */ 827 nlohmann::json::object_t queryParameterUnsupported(std::string_view arg1) 828 { 829 return getLog(redfish::registries::Base::Index::queryParameterUnsupported, 830 std::to_array({arg1})); 831 } 832 833 void queryParameterUnsupported(crow::Response& res, std::string_view arg1) 834 { 835 res.result(boost::beast::http::status::bad_request); 836 addMessageToErrorJson(res.jsonValue, queryParameterUnsupported(arg1)); 837 } 838 839 /** 840 * @internal 841 * @brief Formats SessionLimitExceeded message into JSON 842 * 843 * See header file for more information 844 * @endinternal 845 */ 846 nlohmann::json::object_t sessionLimitExceeded() 847 { 848 return getLog(redfish::registries::Base::Index::sessionLimitExceeded, {}); 849 } 850 851 void sessionLimitExceeded(crow::Response& res) 852 { 853 res.result(boost::beast::http::status::service_unavailable); 854 addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 855 } 856 857 /** 858 * @internal 859 * @brief Formats EventSubscriptionLimitExceeded message into JSON 860 * 861 * See header file for more information 862 * @endinternal 863 */ 864 nlohmann::json::object_t eventSubscriptionLimitExceeded() 865 { 866 return getLog( 867 redfish::registries::Base::Index::eventSubscriptionLimitExceeded, {}); 868 } 869 870 void eventSubscriptionLimitExceeded(crow::Response& res) 871 { 872 res.result(boost::beast::http::status::service_unavailable); 873 addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 874 } 875 876 /** 877 * @internal 878 * @brief Formats ResourceCannotBeDeleted message into JSON 879 * 880 * See header file for more information 881 * @endinternal 882 */ 883 nlohmann::json::object_t resourceCannotBeDeleted() 884 { 885 return getLog(redfish::registries::Base::Index::resourceCannotBeDeleted, 886 {}); 887 } 888 889 void resourceCannotBeDeleted(crow::Response& res) 890 { 891 res.result(boost::beast::http::status::method_not_allowed); 892 addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 893 } 894 895 /** 896 * @internal 897 * @brief Formats ResourceInUse message into JSON 898 * 899 * See header file for more information 900 * @endinternal 901 */ 902 nlohmann::json::object_t resourceInUse() 903 { 904 return getLog(redfish::registries::Base::Index::resourceInUse, {}); 905 } 906 907 void resourceInUse(crow::Response& res) 908 { 909 res.result(boost::beast::http::status::service_unavailable); 910 addMessageToErrorJson(res.jsonValue, resourceInUse()); 911 } 912 913 /** 914 * @internal 915 * @brief Formats ResourceAlreadyExists message into JSON 916 * 917 * See header file for more information 918 * @endinternal 919 */ 920 nlohmann::json::object_t resourceAlreadyExists( 921 std::string_view arg1, std::string_view arg2, std::string_view arg3) 922 { 923 return getLog(redfish::registries::Base::Index::resourceAlreadyExists, 924 std::to_array({arg1, arg2, arg3})); 925 } 926 927 void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 928 std::string_view arg2, std::string_view arg3) 929 { 930 res.result(boost::beast::http::status::bad_request); 931 addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 932 arg2); 933 } 934 935 /** 936 * @internal 937 * @brief Formats ResourceNotFound message into JSON 938 * 939 * See header file for more information 940 * @endinternal 941 */ 942 nlohmann::json::object_t resourceNotFound(std::string_view arg1, 943 std::string_view arg2) 944 { 945 return getLog(redfish::registries::Base::Index::resourceNotFound, 946 std::to_array({arg1, arg2})); 947 } 948 949 void resourceNotFound(crow::Response& res, std::string_view arg1, 950 std::string_view arg2) 951 { 952 res.result(boost::beast::http::status::not_found); 953 addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 954 } 955 956 /** 957 * @internal 958 * @brief Formats PayloadTooLarge message into JSON 959 * 960 * See header file for more information 961 * @endinternal 962 */ 963 nlohmann::json::object_t payloadTooLarge() 964 { 965 return getLog(redfish::registries::Base::Index::payloadTooLarge, {}); 966 } 967 968 void payloadTooLarge(crow::Response& res) 969 { 970 res.result(boost::beast::http::status::bad_request); 971 addMessageToErrorJson(res.jsonValue, payloadTooLarge()); 972 } 973 974 /** 975 * @internal 976 * @brief Formats InsufficientStorage message into JSON 977 * 978 * See header file for more information 979 * @endinternal 980 */ 981 nlohmann::json::object_t insufficientStorage() 982 { 983 return getLog(redfish::registries::Base::Index::insufficientStorage, {}); 984 } 985 986 void insufficientStorage(crow::Response& res) 987 { 988 res.result(boost::beast::http::status::insufficient_storage); 989 addMessageToErrorJson(res.jsonValue, insufficientStorage()); 990 } 991 992 /** 993 * @internal 994 * @brief Formats MissingOrMalformedPart message into JSON 995 * 996 * See header file for more information 997 * @endinternal 998 */ 999 nlohmann::json::object_t missingOrMalformedPart() 1000 { 1001 return getLog(redfish::registries::Base::Index::missingOrMalformedPart, {}); 1002 } 1003 1004 void missingOrMalformedPart(crow::Response& res) 1005 { 1006 res.result(boost::beast::http::status::bad_request); 1007 addMessageToErrorJson(res.jsonValue, missingOrMalformedPart()); 1008 } 1009 1010 /** 1011 * @internal 1012 * @brief Formats InvalidURI message into JSON 1013 * 1014 * See header file for more information 1015 * @endinternal 1016 */ 1017 nlohmann::json::object_t invalidURI(std::string_view arg1) 1018 { 1019 return getLog(redfish::registries::Base::Index::invalidURI, 1020 std::to_array({arg1})); 1021 } 1022 1023 void invalidURI(crow::Response& res, std::string_view arg1) 1024 { 1025 res.result(boost::beast::http::status::bad_request); 1026 addMessageToErrorJson(res.jsonValue, invalidURI(arg1)); 1027 } 1028 1029 /** 1030 * @internal 1031 * @brief Formats CreateFailedMissingReqProperties message into JSON 1032 * 1033 * See header file for more information 1034 * @endinternal 1035 */ 1036 nlohmann::json::object_t createFailedMissingReqProperties(std::string_view arg1) 1037 { 1038 return getLog( 1039 redfish::registries::Base::Index::createFailedMissingReqProperties, 1040 std::to_array({arg1})); 1041 } 1042 1043 void createFailedMissingReqProperties(crow::Response& res, 1044 std::string_view arg1) 1045 { 1046 res.result(boost::beast::http::status::bad_request); 1047 addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 1048 arg1); 1049 } 1050 1051 /** 1052 * @internal 1053 * @brief Formats CreateLimitReachedForResource message into JSON 1054 * 1055 * See header file for more information 1056 * @endinternal 1057 */ 1058 nlohmann::json::object_t createLimitReachedForResource() 1059 { 1060 return getLog( 1061 redfish::registries::Base::Index::createLimitReachedForResource, {}); 1062 } 1063 1064 void createLimitReachedForResource(crow::Response& res) 1065 { 1066 res.result(boost::beast::http::status::bad_request); 1067 addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1068 } 1069 1070 /** 1071 * @internal 1072 * @brief Formats ServiceShuttingDown message into JSON 1073 * 1074 * See header file for more information 1075 * @endinternal 1076 */ 1077 nlohmann::json::object_t serviceShuttingDown() 1078 { 1079 return getLog(redfish::registries::Base::Index::serviceShuttingDown, {}); 1080 } 1081 1082 void serviceShuttingDown(crow::Response& res) 1083 { 1084 res.result(boost::beast::http::status::service_unavailable); 1085 addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1086 } 1087 1088 /** 1089 * @internal 1090 * @brief Formats ServiceInUnknownState message into JSON 1091 * 1092 * See header file for more information 1093 * @endinternal 1094 */ 1095 nlohmann::json::object_t serviceInUnknownState() 1096 { 1097 return getLog(redfish::registries::Base::Index::serviceInUnknownState, {}); 1098 } 1099 1100 void serviceInUnknownState(crow::Response& res) 1101 { 1102 res.result(boost::beast::http::status::service_unavailable); 1103 addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 1104 } 1105 1106 /** 1107 * @internal 1108 * @brief Formats NoValidSession message into JSON 1109 * 1110 * See header file for more information 1111 * @endinternal 1112 */ 1113 nlohmann::json::object_t noValidSession() 1114 { 1115 return getLog(redfish::registries::Base::Index::noValidSession, {}); 1116 } 1117 1118 void noValidSession(crow::Response& res) 1119 { 1120 res.result(boost::beast::http::status::forbidden); 1121 addMessageToErrorJson(res.jsonValue, noValidSession()); 1122 } 1123 1124 /** 1125 * @internal 1126 * @brief Formats InsufficientPrivilege message into JSON 1127 * 1128 * See header file for more information 1129 * @endinternal 1130 */ 1131 nlohmann::json::object_t insufficientPrivilege() 1132 { 1133 return getLog(redfish::registries::Base::Index::insufficientPrivilege, {}); 1134 } 1135 1136 void insufficientPrivilege(crow::Response& res) 1137 { 1138 res.result(boost::beast::http::status::forbidden); 1139 addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1140 } 1141 1142 /** 1143 * @internal 1144 * @brief Formats AccountModified message into JSON 1145 * 1146 * See header file for more information 1147 * @endinternal 1148 */ 1149 nlohmann::json::object_t accountModified() 1150 { 1151 return getLog(redfish::registries::Base::Index::accountModified, {}); 1152 } 1153 1154 void accountModified(crow::Response& res) 1155 { 1156 res.result(boost::beast::http::status::ok); 1157 addMessageToErrorJson(res.jsonValue, accountModified()); 1158 } 1159 1160 /** 1161 * @internal 1162 * @brief Formats AccountNotModified message into JSON 1163 * 1164 * See header file for more information 1165 * @endinternal 1166 */ 1167 nlohmann::json::object_t accountNotModified() 1168 { 1169 return getLog(redfish::registries::Base::Index::accountNotModified, {}); 1170 } 1171 1172 void accountNotModified(crow::Response& res) 1173 { 1174 res.result(boost::beast::http::status::bad_request); 1175 addMessageToErrorJson(res.jsonValue, accountNotModified()); 1176 } 1177 1178 /** 1179 * @internal 1180 * @brief Formats AccountRemoved message into JSON 1181 * 1182 * See header file for more information 1183 * @endinternal 1184 */ 1185 nlohmann::json::object_t accountRemoved() 1186 { 1187 return getLog(redfish::registries::Base::Index::accountRemoved, {}); 1188 } 1189 1190 void accountRemoved(crow::Response& res) 1191 { 1192 res.result(boost::beast::http::status::ok); 1193 addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1194 } 1195 1196 /** 1197 * @internal 1198 * @brief Formats AccountForSessionNoLongerExists message into JSON 1199 * 1200 * See header file for more information 1201 * @endinternal 1202 */ 1203 nlohmann::json::object_t accountForSessionNoLongerExists() 1204 { 1205 return getLog( 1206 redfish::registries::Base::Index::accountForSessionNoLongerExists, {}); 1207 } 1208 1209 void accountForSessionNoLongerExists(crow::Response& res) 1210 { 1211 res.result(boost::beast::http::status::forbidden); 1212 addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 1213 } 1214 1215 /** 1216 * @internal 1217 * @brief Formats InvalidObject message into JSON 1218 * 1219 * See header file for more information 1220 * @endinternal 1221 */ 1222 nlohmann::json::object_t invalidObject(const boost::urls::url_view_base& arg1) 1223 { 1224 return getLog(redfish::registries::Base::Index::invalidObject, 1225 std::to_array<std::string_view>({arg1.buffer()})); 1226 } 1227 1228 void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1) 1229 { 1230 res.result(boost::beast::http::status::bad_request); 1231 addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1232 } 1233 1234 /** 1235 * @internal 1236 * @brief Formats InternalError message into JSON 1237 * 1238 * See header file for more information 1239 * @endinternal 1240 */ 1241 nlohmann::json::object_t internalError() 1242 { 1243 return getLog(redfish::registries::Base::Index::internalError, {}); 1244 } 1245 1246 void internalError(crow::Response& res, const std::source_location location) 1247 { 1248 BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(), 1249 location.line(), location.column(), 1250 location.function_name()); 1251 res.result(boost::beast::http::status::internal_server_error); 1252 addMessageToErrorJson(res.jsonValue, internalError()); 1253 } 1254 1255 /** 1256 * @internal 1257 * @brief Formats UnrecognizedRequestBody message into JSON 1258 * 1259 * See header file for more information 1260 * @endinternal 1261 */ 1262 nlohmann::json::object_t unrecognizedRequestBody() 1263 { 1264 return getLog(redfish::registries::Base::Index::unrecognizedRequestBody, 1265 {}); 1266 } 1267 1268 void unrecognizedRequestBody(crow::Response& res) 1269 { 1270 res.result(boost::beast::http::status::bad_request); 1271 addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 1272 } 1273 1274 /** 1275 * @internal 1276 * @brief Formats ResourceMissingAtURI message into JSON 1277 * 1278 * See header file for more information 1279 * @endinternal 1280 */ 1281 nlohmann::json::object_t resourceMissingAtURI( 1282 const boost::urls::url_view_base& arg1) 1283 { 1284 return getLog(redfish::registries::Base::Index::resourceMissingAtURI, 1285 std::to_array<std::string_view>({arg1.buffer()})); 1286 } 1287 1288 void resourceMissingAtURI(crow::Response& res, 1289 const boost::urls::url_view_base& arg1) 1290 { 1291 res.result(boost::beast::http::status::bad_request); 1292 addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 1293 } 1294 1295 /** 1296 * @internal 1297 * @brief Formats ResourceAtUriInUnknownFormat message into JSON 1298 * 1299 * See header file for more information 1300 * @endinternal 1301 */ 1302 nlohmann::json::object_t resourceAtUriInUnknownFormat( 1303 const boost::urls::url_view_base& arg1) 1304 { 1305 return getLog( 1306 redfish::registries::Base::Index::resourceAtUriInUnknownFormat, 1307 std::to_array<std::string_view>({arg1.buffer()})); 1308 } 1309 1310 void resourceAtUriInUnknownFormat(crow::Response& res, 1311 const boost::urls::url_view_base& arg1) 1312 { 1313 res.result(boost::beast::http::status::bad_request); 1314 addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 1315 } 1316 1317 /** 1318 * @internal 1319 * @brief Formats ResourceAtUriUnauthorized message into JSON 1320 * 1321 * See header file for more information 1322 * @endinternal 1323 */ 1324 nlohmann::json::object_t resourceAtUriUnauthorized( 1325 const boost::urls::url_view_base& arg1, std::string_view arg2) 1326 { 1327 return getLog(redfish::registries::Base::Index::resourceAtUriUnauthorized, 1328 std::to_array<std::string_view>({arg1.buffer(), arg2})); 1329 } 1330 1331 void resourceAtUriUnauthorized(crow::Response& res, 1332 const boost::urls::url_view_base& arg1, 1333 std::string_view arg2) 1334 { 1335 res.result(boost::beast::http::status::unauthorized); 1336 addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 1337 } 1338 1339 /** 1340 * @internal 1341 * @brief Formats CouldNotEstablishConnection message into JSON 1342 * 1343 * See header file for more information 1344 * @endinternal 1345 */ 1346 nlohmann::json::object_t couldNotEstablishConnection( 1347 const boost::urls::url_view_base& arg1) 1348 { 1349 return getLog(redfish::registries::Base::Index::couldNotEstablishConnection, 1350 std::to_array<std::string_view>({arg1.buffer()})); 1351 } 1352 1353 void couldNotEstablishConnection(crow::Response& res, 1354 const boost::urls::url_view_base& arg1) 1355 { 1356 res.result(boost::beast::http::status::not_found); 1357 addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1358 } 1359 1360 /** 1361 * @internal 1362 * @brief Formats SourceDoesNotSupportProtocol message into JSON 1363 * 1364 * See header file for more information 1365 * @endinternal 1366 */ 1367 nlohmann::json::object_t sourceDoesNotSupportProtocol( 1368 const boost::urls::url_view_base& arg1, std::string_view arg2) 1369 { 1370 return getLog( 1371 redfish::registries::Base::Index::sourceDoesNotSupportProtocol, 1372 std::to_array<std::string_view>({arg1.buffer(), arg2})); 1373 } 1374 1375 void sourceDoesNotSupportProtocol(crow::Response& res, 1376 const boost::urls::url_view_base& arg1, 1377 std::string_view arg2) 1378 { 1379 res.result(boost::beast::http::status::bad_request); 1380 addMessageToErrorJson(res.jsonValue, 1381 sourceDoesNotSupportProtocol(arg1, arg2)); 1382 } 1383 1384 /** 1385 * @internal 1386 * @brief Formats AccessDenied message into JSON 1387 * 1388 * See header file for more information 1389 * @endinternal 1390 */ 1391 nlohmann::json::object_t accessDenied(const boost::urls::url_view_base& arg1) 1392 { 1393 return getLog(redfish::registries::Base::Index::accessDenied, 1394 std::to_array<std::string_view>({arg1.buffer()})); 1395 } 1396 1397 void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1) 1398 { 1399 res.result(boost::beast::http::status::forbidden); 1400 addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1401 } 1402 1403 /** 1404 * @internal 1405 * @brief Formats ServiceTemporarilyUnavailable message into JSON 1406 * 1407 * See header file for more information 1408 * @endinternal 1409 */ 1410 nlohmann::json::object_t serviceTemporarilyUnavailable(std::string_view arg1) 1411 { 1412 return getLog( 1413 redfish::registries::Base::Index::serviceTemporarilyUnavailable, 1414 std::to_array({arg1})); 1415 } 1416 1417 void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 1418 { 1419 res.addHeader(boost::beast::http::field::retry_after, arg1); 1420 res.result(boost::beast::http::status::service_unavailable); 1421 addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 1422 } 1423 1424 /** 1425 * @internal 1426 * @brief Formats InvalidIndex message into JSON 1427 * 1428 * See header file for more information 1429 * @endinternal 1430 */ 1431 nlohmann::json::object_t invalidIndex(uint64_t arg1) 1432 { 1433 std::string arg1Str = std::to_string(arg1); 1434 return getLog(redfish::registries::Base::Index::invalidIndex, 1435 std::to_array<std::string_view>({arg1Str})); 1436 } 1437 1438 void invalidIndex(crow::Response& res, uint64_t arg1) 1439 { 1440 res.result(boost::beast::http::status::bad_request); 1441 addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1442 } 1443 1444 /** 1445 * @internal 1446 * @brief Formats PropertyValueModified message into JSON 1447 * 1448 * See header file for more information 1449 * @endinternal 1450 */ 1451 nlohmann::json::object_t propertyValueModified(std::string_view arg1, 1452 const nlohmann::json& arg2) 1453 { 1454 std::string arg2Str = 1455 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1456 return getLog(redfish::registries::Base::Index::propertyValueModified, 1457 std::to_array<std::string_view>({arg1, arg2Str})); 1458 } 1459 1460 void propertyValueModified(crow::Response& res, std::string_view arg1, 1461 const nlohmann::json& arg2) 1462 { 1463 res.result(boost::beast::http::status::ok); 1464 addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1465 } 1466 1467 /** 1468 * @internal 1469 * @brief Formats ResourceInStandby message into JSON 1470 * 1471 * See header file for more information 1472 * @endinternal 1473 */ 1474 nlohmann::json::object_t resourceInStandby() 1475 { 1476 return getLog(redfish::registries::Base::Index::resourceInStandby, {}); 1477 } 1478 1479 void resourceInStandby(crow::Response& res) 1480 { 1481 res.result(boost::beast::http::status::service_unavailable); 1482 addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1483 } 1484 1485 /** 1486 * @internal 1487 * @brief Formats ResourceExhaustion message into JSON 1488 * 1489 * See header file for more information 1490 * @endinternal 1491 */ 1492 nlohmann::json::object_t resourceExhaustion(std::string_view arg1) 1493 { 1494 return getLog(redfish::registries::Base::Index::resourceExhaustion, 1495 std::to_array({arg1})); 1496 } 1497 1498 void resourceExhaustion(crow::Response& res, std::string_view arg1) 1499 { 1500 res.result(boost::beast::http::status::service_unavailable); 1501 addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1502 } 1503 1504 /** 1505 * @internal 1506 * @brief Formats StringValueTooLong message into JSON 1507 * 1508 * See header file for more information 1509 * @endinternal 1510 */ 1511 nlohmann::json::object_t stringValueTooLong(std::string_view arg1, 1512 uint64_t arg2) 1513 { 1514 std::string arg2Str = std::to_string(arg2); 1515 return getLog(redfish::registries::Base::Index::stringValueTooLong, 1516 std::to_array<std::string_view>({arg1, arg2Str})); 1517 } 1518 1519 void stringValueTooLong(crow::Response& res, std::string_view arg1, 1520 uint64_t arg2) 1521 { 1522 res.result(boost::beast::http::status::bad_request); 1523 addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 1524 } 1525 1526 /** 1527 * @internal 1528 * @brief Formats StringValueTooShort message into JSON 1529 * 1530 * See header file for more information 1531 * @endinternal 1532 */ 1533 nlohmann::json::object_t stringValueTooShort(std::string_view arg1, 1534 std::string_view arg2) 1535 { 1536 return getLog(redfish::registries::Base::Index::stringValueTooShort, 1537 std::to_array({arg1, arg2})); 1538 } 1539 1540 void stringValueTooShort(crow::Response& res, std::string_view arg1, 1541 std::string_view arg2) 1542 { 1543 res.result(boost::beast::http::status::bad_request); 1544 addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2)); 1545 } 1546 1547 /** 1548 * @internal 1549 * @brief Formats SessionTerminated message into JSON 1550 * 1551 * See header file for more information 1552 * @endinternal 1553 */ 1554 nlohmann::json::object_t sessionTerminated() 1555 { 1556 return getLog(redfish::registries::Base::Index::sessionTerminated, {}); 1557 } 1558 1559 void sessionTerminated(crow::Response& res) 1560 { 1561 res.result(boost::beast::http::status::ok); 1562 addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 1563 } 1564 1565 /** 1566 * @internal 1567 * @brief Formats SubscriptionTerminated message into JSON 1568 * 1569 * See header file for more information 1570 * @endinternal 1571 */ 1572 nlohmann::json::object_t subscriptionTerminated() 1573 { 1574 return getLog(redfish::registries::Base::Index::subscriptionTerminated, {}); 1575 } 1576 1577 void subscriptionTerminated(crow::Response& res) 1578 { 1579 res.result(boost::beast::http::status::ok); 1580 addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 1581 } 1582 1583 /** 1584 * @internal 1585 * @brief Formats ResourceTypeIncompatible message into JSON 1586 * 1587 * See header file for more information 1588 * @endinternal 1589 */ 1590 nlohmann::json::object_t resourceTypeIncompatible(std::string_view arg1, 1591 std::string_view arg2) 1592 { 1593 return getLog(redfish::registries::Base::Index::resourceTypeIncompatible, 1594 std::to_array({arg1, arg2})); 1595 } 1596 1597 void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 1598 std::string_view arg2) 1599 { 1600 res.result(boost::beast::http::status::bad_request); 1601 addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 1602 } 1603 1604 /** 1605 * @internal 1606 * @brief Formats PasswordChangeRequired message into JSON 1607 * 1608 * See header file for more information 1609 * @endinternal 1610 */ 1611 nlohmann::json::object_t passwordChangeRequired( 1612 const boost::urls::url_view_base& arg1) 1613 { 1614 return getLog(redfish::registries::Base::Index::passwordChangeRequired, 1615 std::to_array<std::string_view>({arg1.buffer()})); 1616 } 1617 1618 void passwordChangeRequired(crow::Response& res, 1619 const boost::urls::url_view_base& arg1) 1620 { 1621 addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 1622 } 1623 1624 /** 1625 * @internal 1626 * @brief Formats ResetRequired message into JSON 1627 * 1628 * See header file for more information 1629 * @endinternal 1630 */ 1631 nlohmann::json::object_t resetRequired(const boost::urls::url_view_base& arg1, 1632 std::string_view arg2) 1633 { 1634 return getLog(redfish::registries::Base::Index::resetRequired, 1635 std::to_array<std::string_view>({arg1.buffer(), arg2})); 1636 } 1637 1638 void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1, 1639 std::string_view arg2) 1640 { 1641 res.result(boost::beast::http::status::bad_request); 1642 addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 1643 } 1644 1645 /** 1646 * @internal 1647 * @brief Formats ResetRecommended message into JSON 1648 * 1649 * See header file for more information 1650 * @endinternal 1651 */ 1652 nlohmann::json::object_t resetRecommended(std::string_view arg1, 1653 std::string_view arg2) 1654 { 1655 return getLog(redfish::registries::Base::Index::resetRecommended, 1656 std::to_array({arg1, arg2})); 1657 } 1658 1659 void resetRecommended(crow::Response& res, std::string_view arg1, 1660 std::string_view arg2) 1661 { 1662 res.result(boost::beast::http::status::bad_request); 1663 addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2)); 1664 } 1665 1666 /** 1667 * @internal 1668 * @brief Formats ChassisPowerStateOnRequired message into JSON 1669 * 1670 * See header file for more information 1671 * @endinternal 1672 */ 1673 nlohmann::json::object_t chassisPowerStateOnRequired(std::string_view arg1) 1674 { 1675 return getLog(redfish::registries::Base::Index::chassisPowerStateOnRequired, 1676 std::to_array({arg1})); 1677 } 1678 1679 void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 1680 { 1681 res.result(boost::beast::http::status::bad_request); 1682 addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 1683 } 1684 1685 /** 1686 * @internal 1687 * @brief Formats ChassisPowerStateOffRequired message into JSON 1688 * 1689 * See header file for more information 1690 * @endinternal 1691 */ 1692 nlohmann::json::object_t chassisPowerStateOffRequired(std::string_view arg1) 1693 { 1694 return getLog( 1695 redfish::registries::Base::Index::chassisPowerStateOffRequired, 1696 std::to_array({arg1})); 1697 } 1698 1699 void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 1700 { 1701 res.result(boost::beast::http::status::bad_request); 1702 addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 1703 } 1704 1705 /** 1706 * @internal 1707 * @brief Formats PropertyValueConflict message into JSON 1708 * 1709 * See header file for more information 1710 * @endinternal 1711 */ 1712 nlohmann::json::object_t propertyValueConflict(std::string_view arg1, 1713 std::string_view arg2) 1714 { 1715 return getLog(redfish::registries::Base::Index::propertyValueConflict, 1716 std::to_array({arg1, arg2})); 1717 } 1718 1719 void propertyValueConflict(crow::Response& res, std::string_view arg1, 1720 std::string_view arg2) 1721 { 1722 res.result(boost::beast::http::status::bad_request); 1723 addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 1724 } 1725 1726 /** 1727 * @internal 1728 * @brief Formats PropertyValueResourceConflict message into JSON 1729 * 1730 * See header file for more information 1731 * @endinternal 1732 */ 1733 nlohmann::json::object_t propertyValueResourceConflict( 1734 std::string_view arg1, const nlohmann::json& arg2, 1735 const boost::urls::url_view_base& arg3) 1736 { 1737 std::string arg2Str = 1738 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1739 return getLog( 1740 redfish::registries::Base::Index::propertyValueResourceConflict, 1741 std::to_array<std::string_view>({arg1, arg2Str, arg3.buffer()})); 1742 } 1743 1744 void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 1745 const nlohmann::json& arg2, 1746 const boost::urls::url_view_base& arg3) 1747 { 1748 res.result(boost::beast::http::status::conflict); 1749 addMessageToErrorJson(res.jsonValue, 1750 propertyValueResourceConflict(arg1, arg2, arg3)); 1751 } 1752 1753 /** 1754 * @internal 1755 * @brief Formats PropertyValueExternalConflict message into JSON 1756 * 1757 * See header file for more information 1758 * @endinternal 1759 */ 1760 nlohmann::json::object_t propertyValueExternalConflict( 1761 std::string_view arg1, const nlohmann::json& arg2) 1762 { 1763 std::string arg2Str = 1764 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1765 return getLog( 1766 redfish::registries::Base::Index::propertyValueExternalConflict, 1767 std::to_array<std::string_view>({arg1, arg2Str})); 1768 } 1769 1770 void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 1771 const nlohmann::json& arg2) 1772 { 1773 res.result(boost::beast::http::status::conflict); 1774 addMessageToErrorJson(res.jsonValue, 1775 propertyValueExternalConflict(arg1, arg2)); 1776 } 1777 1778 /** 1779 * @internal 1780 * @brief Formats PropertyValueIncorrect message into JSON 1781 * 1782 * See header file for more information 1783 * @endinternal 1784 */ 1785 nlohmann::json::object_t propertyValueIncorrect(std::string_view arg1, 1786 const nlohmann::json& arg2) 1787 { 1788 std::string arg2Str = 1789 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1790 return getLog(redfish::registries::Base::Index::propertyValueIncorrect, 1791 std::to_array<std::string_view>({arg1, arg2Str})); 1792 } 1793 1794 void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 1795 const nlohmann::json& arg2) 1796 { 1797 res.result(boost::beast::http::status::bad_request); 1798 addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 1799 } 1800 1801 /** 1802 * @internal 1803 * @brief Formats ResourceCreationConflict message into JSON 1804 * 1805 * See header file for more information 1806 * @endinternal 1807 */ 1808 nlohmann::json::object_t resourceCreationConflict( 1809 const boost::urls::url_view_base& arg1) 1810 { 1811 return getLog(redfish::registries::Base::Index::resourceCreationConflict, 1812 std::to_array<std::string_view>({arg1.buffer()})); 1813 } 1814 1815 void resourceCreationConflict(crow::Response& res, 1816 const boost::urls::url_view_base& arg1) 1817 { 1818 res.result(boost::beast::http::status::bad_request); 1819 addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 1820 } 1821 1822 /** 1823 * @internal 1824 * @brief Formats ActionParameterValueConflict message into JSON 1825 * 1826 * See header file for more information 1827 * @endinternal 1828 */ 1829 nlohmann::json::object_t actionParameterValueConflict(std::string_view arg1, 1830 std::string_view arg2) 1831 { 1832 return getLog( 1833 redfish::registries::Base::Index::actionParameterValueConflict, 1834 std::to_array({arg1, arg2})); 1835 } 1836 1837 void actionParameterValueConflict(crow::Response& res, std::string_view arg1, 1838 std::string_view arg2) 1839 { 1840 res.result(boost::beast::http::status::bad_request); 1841 addMessageToErrorJson(res.jsonValue, 1842 actionParameterValueConflict(arg1, arg2)); 1843 } 1844 1845 /** 1846 * @internal 1847 * @brief Formats MaximumErrorsExceeded message into JSON 1848 * 1849 * See header file for more information 1850 * @endinternal 1851 */ 1852 nlohmann::json::object_t maximumErrorsExceeded() 1853 { 1854 return getLog(redfish::registries::Base::Index::maximumErrorsExceeded, {}); 1855 } 1856 1857 void maximumErrorsExceeded(crow::Response& res) 1858 { 1859 res.result(boost::beast::http::status::internal_server_error); 1860 addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 1861 } 1862 1863 /** 1864 * @internal 1865 * @brief Formats PreconditionFailed message into JSON 1866 * 1867 * See header file for more information 1868 * @endinternal 1869 */ 1870 nlohmann::json::object_t preconditionFailed() 1871 { 1872 return getLog(redfish::registries::Base::Index::preconditionFailed, {}); 1873 } 1874 1875 void preconditionFailed(crow::Response& res) 1876 { 1877 res.result(boost::beast::http::status::precondition_failed); 1878 addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1879 } 1880 1881 /** 1882 * @internal 1883 * @brief Formats PreconditionRequired message into JSON 1884 * 1885 * See header file for more information 1886 * @endinternal 1887 */ 1888 nlohmann::json::object_t preconditionRequired() 1889 { 1890 return getLog(redfish::registries::Base::Index::preconditionRequired, {}); 1891 } 1892 1893 void preconditionRequired(crow::Response& res) 1894 { 1895 res.result(boost::beast::http::status::bad_request); 1896 addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1897 } 1898 1899 /** 1900 * @internal 1901 * @brief Formats HeaderMissing message into JSON 1902 * 1903 * See header file for more information 1904 * @endinternal 1905 */ 1906 nlohmann::json::object_t headerMissing(std::string_view arg1) 1907 { 1908 return getLog(redfish::registries::Base::Index::headerMissing, 1909 std::to_array({arg1})); 1910 } 1911 1912 void headerMissing(crow::Response& res, std::string_view arg1) 1913 { 1914 res.result(boost::beast::http::status::bad_request); 1915 addMessageToErrorJson(res.jsonValue, headerMissing(arg1)); 1916 } 1917 1918 /** 1919 * @internal 1920 * @brief Formats HeaderInvalid message into JSON 1921 * 1922 * See header file for more information 1923 * @endinternal 1924 */ 1925 nlohmann::json::object_t headerInvalid(std::string_view arg1) 1926 { 1927 return getLog(redfish::registries::Base::Index::headerInvalid, 1928 std::to_array({arg1})); 1929 } 1930 1931 void headerInvalid(crow::Response& res, std::string_view arg1) 1932 { 1933 res.result(boost::beast::http::status::bad_request); 1934 addMessageToErrorJson(res.jsonValue, headerInvalid(arg1)); 1935 } 1936 1937 /** 1938 * @internal 1939 * @brief Formats OperationFailed message into JSON 1940 * 1941 * See header file for more information 1942 * @endinternal 1943 */ 1944 nlohmann::json::object_t operationFailed() 1945 { 1946 return getLog(redfish::registries::Base::Index::operationFailed, {}); 1947 } 1948 1949 void operationFailed(crow::Response& res) 1950 { 1951 res.result(boost::beast::http::status::bad_gateway); 1952 addMessageToErrorJson(res.jsonValue, operationFailed()); 1953 } 1954 1955 /** 1956 * @internal 1957 * @brief Formats OperationTimeout message into JSON 1958 * 1959 * See header file for more information 1960 * @endinternal 1961 */ 1962 nlohmann::json::object_t operationTimeout() 1963 { 1964 return getLog(redfish::registries::Base::Index::operationTimeout, {}); 1965 } 1966 1967 void operationTimeout(crow::Response& res) 1968 { 1969 res.result(boost::beast::http::status::internal_server_error); 1970 addMessageToErrorJson(res.jsonValue, operationTimeout()); 1971 } 1972 1973 /** 1974 * @internal 1975 * @brief Formats OperationNotAllowed message into JSON 1976 * 1977 * See header file for more information 1978 * @endinternal 1979 */ 1980 nlohmann::json::object_t operationNotAllowed() 1981 { 1982 return getLog(redfish::registries::Base::Index::operationNotAllowed, {}); 1983 } 1984 1985 void operationNotAllowed(crow::Response& res) 1986 { 1987 res.result(boost::beast::http::status::method_not_allowed); 1988 addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 1989 } 1990 1991 /** 1992 * @internal 1993 * @brief Formats UndeterminedFault message into JSON 1994 * 1995 * See header file for more information 1996 * @endinternal 1997 */ 1998 nlohmann::json::object_t undeterminedFault(std::string_view arg1) 1999 { 2000 return getLog(redfish::registries::Base::Index::undeterminedFault, 2001 std::to_array({arg1})); 2002 } 2003 2004 void undeterminedFault(crow::Response& res, std::string_view arg1) 2005 { 2006 res.result(boost::beast::http::status::bad_request); 2007 addMessageToErrorJson(res.jsonValue, undeterminedFault(arg1)); 2008 } 2009 2010 /** 2011 * @internal 2012 * @brief Formats ConditionInRelatedResource message into JSON 2013 * 2014 * See header file for more information 2015 * @endinternal 2016 */ 2017 nlohmann::json::object_t conditionInRelatedResource() 2018 { 2019 return getLog(redfish::registries::Base::Index::conditionInRelatedResource, 2020 {}); 2021 } 2022 2023 void conditionInRelatedResource(crow::Response& res) 2024 { 2025 res.result(boost::beast::http::status::bad_request); 2026 addMessageToErrorJson(res.jsonValue, conditionInRelatedResource()); 2027 } 2028 2029 /** 2030 * @internal 2031 * @brief Formats RestrictedRole message into JSON 2032 * 2033 * See header file for more information 2034 * @endinternal 2035 */ 2036 nlohmann::json::object_t restrictedRole(std::string_view arg1) 2037 { 2038 return getLog(redfish::registries::Base::Index::restrictedRole, 2039 std::to_array({arg1})); 2040 } 2041 2042 void restrictedRole(crow::Response& res, std::string_view arg1) 2043 { 2044 res.result(boost::beast::http::status::forbidden); 2045 addMessageToErrorJson(res.jsonValue, restrictedRole(arg1)); 2046 } 2047 2048 /** 2049 * @internal 2050 * @brief Formats RestrictedPrivilege message into JSON 2051 * 2052 * See header file for more information 2053 * @endinternal 2054 */ 2055 nlohmann::json::object_t restrictedPrivilege(std::string_view arg1) 2056 { 2057 return getLog(redfish::registries::Base::Index::restrictedPrivilege, 2058 std::to_array({arg1})); 2059 } 2060 2061 void restrictedPrivilege(crow::Response& res, std::string_view arg1) 2062 { 2063 res.result(boost::beast::http::status::bad_request); 2064 addMessageToErrorJson(res.jsonValue, restrictedPrivilege(arg1)); 2065 } 2066 2067 /** 2068 * @internal 2069 * @brief Formats StrictAccountTypes message into JSON 2070 * 2071 * See header file for more information 2072 * @endinternal 2073 */ 2074 nlohmann::json::object_t strictAccountTypes(std::string_view arg1) 2075 { 2076 return getLog(redfish::registries::Base::Index::strictAccountTypes, 2077 std::to_array({arg1})); 2078 } 2079 2080 void strictAccountTypes(crow::Response& res, std::string_view arg1) 2081 { 2082 res.result(boost::beast::http::status::bad_request); 2083 addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 2084 } 2085 2086 /** 2087 * @internal 2088 * @brief Formats PropertyDeprecated message into JSON 2089 * 2090 * See header file for more information 2091 * @endinternal 2092 */ 2093 nlohmann::json::object_t propertyDeprecated(std::string_view arg1) 2094 { 2095 return getLog(redfish::registries::Base::Index::propertyDeprecated, 2096 std::to_array({arg1})); 2097 } 2098 2099 void propertyDeprecated(crow::Response& res, std::string_view arg1) 2100 { 2101 res.result(boost::beast::http::status::bad_request); 2102 addMessageToErrorJson(res.jsonValue, propertyDeprecated(arg1)); 2103 } 2104 2105 /** 2106 * @internal 2107 * @brief Formats ResourceDeprecated message into JSON 2108 * 2109 * See header file for more information 2110 * @endinternal 2111 */ 2112 nlohmann::json::object_t resourceDeprecated(std::string_view arg1) 2113 { 2114 return getLog(redfish::registries::Base::Index::resourceDeprecated, 2115 std::to_array({arg1})); 2116 } 2117 2118 void resourceDeprecated(crow::Response& res, std::string_view arg1) 2119 { 2120 res.result(boost::beast::http::status::bad_request); 2121 addMessageToErrorJson(res.jsonValue, resourceDeprecated(arg1)); 2122 } 2123 2124 /** 2125 * @internal 2126 * @brief Formats PropertyValueDeprecated message into JSON 2127 * 2128 * See header file for more information 2129 * @endinternal 2130 */ 2131 nlohmann::json::object_t propertyValueDeprecated(std::string_view arg1, 2132 std::string_view arg2) 2133 { 2134 return getLog(redfish::registries::Base::Index::propertyValueDeprecated, 2135 std::to_array({arg1, arg2})); 2136 } 2137 2138 void propertyValueDeprecated(crow::Response& res, std::string_view arg1, 2139 std::string_view arg2) 2140 { 2141 res.result(boost::beast::http::status::bad_request); 2142 addMessageToErrorJson(res.jsonValue, propertyValueDeprecated(arg1, arg2)); 2143 } 2144 2145 /** 2146 * @internal 2147 * @brief Formats ActionDeprecated message into JSON 2148 * 2149 * See header file for more information 2150 * @endinternal 2151 */ 2152 nlohmann::json::object_t actionDeprecated(std::string_view arg1) 2153 { 2154 return getLog(redfish::registries::Base::Index::actionDeprecated, 2155 std::to_array({arg1})); 2156 } 2157 2158 void actionDeprecated(crow::Response& res, std::string_view arg1) 2159 { 2160 res.result(boost::beast::http::status::bad_request); 2161 addMessageToErrorJson(res.jsonValue, actionDeprecated(arg1)); 2162 } 2163 2164 /** 2165 * @internal 2166 * @brief Formats NetworkNameResolutionNotConfigured message into JSON 2167 * 2168 * See header file for more information 2169 * @endinternal 2170 */ 2171 nlohmann::json::object_t networkNameResolutionNotConfigured() 2172 { 2173 return getLog( 2174 redfish::registries::Base::Index::networkNameResolutionNotConfigured, 2175 {}); 2176 } 2177 2178 void networkNameResolutionNotConfigured(crow::Response& res) 2179 { 2180 res.result(boost::beast::http::status::bad_request); 2181 addMessageToErrorJson(res.jsonValue, networkNameResolutionNotConfigured()); 2182 } 2183 2184 /** 2185 * @internal 2186 * @brief Formats NetworkNameResolutionNotSupported message into JSON 2187 * 2188 * See header file for more information 2189 * @endinternal 2190 */ 2191 nlohmann::json::object_t networkNameResolutionNotSupported() 2192 { 2193 return getLog( 2194 redfish::registries::Base::Index::networkNameResolutionNotSupported, 2195 {}); 2196 } 2197 2198 void networkNameResolutionNotSupported(crow::Response& res) 2199 { 2200 res.result(boost::beast::http::status::bad_request); 2201 addMessageToErrorJson(res.jsonValue, networkNameResolutionNotSupported()); 2202 } 2203 2204 /** 2205 * @internal 2206 * @brief Formats ServiceDisabled message into JSON 2207 * 2208 * See header file for more information 2209 * @endinternal 2210 */ 2211 nlohmann::json::object_t serviceDisabled(std::string_view arg1) 2212 { 2213 return getLog(redfish::registries::Base::Index::serviceDisabled, 2214 std::to_array({arg1})); 2215 } 2216 2217 void serviceDisabled(crow::Response& res, std::string_view arg1) 2218 { 2219 res.result(boost::beast::http::status::service_unavailable); 2220 addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 2221 } 2222 2223 /** 2224 * @internal 2225 * @brief Formats EventBufferExceeded message into JSON 2226 * 2227 * See header file for more information 2228 * @endinternal 2229 */ 2230 nlohmann::json::object_t eventBufferExceeded() 2231 { 2232 return getLog(redfish::registries::Base::Index::eventBufferExceeded, {}); 2233 } 2234 2235 void eventBufferExceeded(crow::Response& res) 2236 { 2237 res.result(boost::beast::http::status::bad_request); 2238 addMessageToErrorJson(res.jsonValue, eventBufferExceeded()); 2239 } 2240 2241 /** 2242 * @internal 2243 * @brief Formats AuthenticationTokenRequired message into JSON 2244 * 2245 * See header file for more information 2246 * @endinternal 2247 */ 2248 nlohmann::json::object_t authenticationTokenRequired() 2249 { 2250 return getLog(redfish::registries::Base::Index::authenticationTokenRequired, 2251 {}); 2252 } 2253 2254 void authenticationTokenRequired(crow::Response& res) 2255 { 2256 res.result(boost::beast::http::status::bad_request); 2257 addMessageToErrorJson(res.jsonValue, authenticationTokenRequired()); 2258 } 2259 2260 /** 2261 * @internal 2262 * @brief Formats OneTimePasscodeSent message into JSON 2263 * 2264 * See header file for more information 2265 * @endinternal 2266 */ 2267 nlohmann::json::object_t oneTimePasscodeSent(std::string_view arg1) 2268 { 2269 return getLog(redfish::registries::Base::Index::oneTimePasscodeSent, 2270 std::to_array({arg1})); 2271 } 2272 2273 void oneTimePasscodeSent(crow::Response& res, std::string_view arg1) 2274 { 2275 res.result(boost::beast::http::status::bad_request); 2276 addMessageToErrorJson(res.jsonValue, oneTimePasscodeSent(arg1)); 2277 } 2278 2279 /** 2280 * @internal 2281 * @brief Formats LicenseRequired message into JSON 2282 * 2283 * See header file for more information 2284 * @endinternal 2285 */ 2286 nlohmann::json::object_t licenseRequired(std::string_view arg1) 2287 { 2288 return getLog(redfish::registries::Base::Index::licenseRequired, 2289 std::to_array({arg1})); 2290 } 2291 2292 void licenseRequired(crow::Response& res, std::string_view arg1) 2293 { 2294 res.result(boost::beast::http::status::bad_request); 2295 addMessageToErrorJson(res.jsonValue, licenseRequired(arg1)); 2296 } 2297 2298 /** 2299 * @internal 2300 * @brief Formats PropertyModified message into JSON 2301 * 2302 * See header file for more information 2303 * @endinternal 2304 */ 2305 nlohmann::json::object_t propertyModified() 2306 { 2307 return getLog(redfish::registries::Base::Index::propertyModified, {}); 2308 } 2309 2310 void propertyModified(crow::Response& res) 2311 { 2312 res.result(boost::beast::http::status::bad_request); 2313 addMessageToErrorJson(res.jsonValue, propertyModified()); 2314 } 2315 2316 /** 2317 * @internal 2318 * @brief Formats GenerateSecretKeyRequired message into JSON 2319 * 2320 * See header file for more information 2321 * @endinternal 2322 */ 2323 nlohmann::json::object_t generateSecretKeyRequired( 2324 const boost::urls::url_view_base& arg1) 2325 { 2326 return getLog(redfish::registries::Base::Index::generateSecretKeyRequired, 2327 std::to_array<std::string_view>({arg1.buffer()})); 2328 } 2329 2330 void generateSecretKeyRequired(crow::Response& res, 2331 const boost::urls::url_view_base& arg1) 2332 { 2333 res.result(boost::beast::http::status::forbidden); 2334 addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1)); 2335 } 2336 2337 } // namespace messages 2338 } // namespace redfish 2339