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