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(uint64_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, uint64_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, uint64_t 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, 1624 uint64_t arg2) 1625 { 1626 res.result(boost::beast::http::status::bad_request); 1627 addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 1628 } 1629 1630 /** 1631 * @internal 1632 * @brief Formats StringValueTooShort message into JSON 1633 * 1634 * See header file for more information 1635 * @endinternal 1636 */ 1637 nlohmann::json stringValueTooShort(std::string_view arg1, std::string_view arg2) 1638 { 1639 return getLog(redfish::registries::base::Index::stringValueTooShort, 1640 std::to_array({arg1, arg2})); 1641 } 1642 1643 void stringValueTooShort(crow::Response& res, std::string_view arg1, 1644 std::string_view arg2) 1645 { 1646 res.result(boost::beast::http::status::bad_request); 1647 addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2)); 1648 } 1649 1650 /** 1651 * @internal 1652 * @brief Formats SessionTerminated message into JSON 1653 * 1654 * See header file for more information 1655 * @endinternal 1656 */ 1657 nlohmann::json sessionTerminated() 1658 { 1659 return getLog(redfish::registries::base::Index::sessionTerminated, {}); 1660 } 1661 1662 void sessionTerminated(crow::Response& res) 1663 { 1664 res.result(boost::beast::http::status::ok); 1665 addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 1666 } 1667 1668 /** 1669 * @internal 1670 * @brief Formats SubscriptionTerminated message into JSON 1671 * 1672 * See header file for more information 1673 * @endinternal 1674 */ 1675 nlohmann::json subscriptionTerminated() 1676 { 1677 return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 1678 } 1679 1680 void subscriptionTerminated(crow::Response& res) 1681 { 1682 res.result(boost::beast::http::status::ok); 1683 addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 1684 } 1685 1686 /** 1687 * @internal 1688 * @brief Formats ResourceTypeIncompatible message into JSON 1689 * 1690 * See header file for more information 1691 * @endinternal 1692 */ 1693 nlohmann::json resourceTypeIncompatible(std::string_view arg1, 1694 std::string_view arg2) 1695 { 1696 return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 1697 std::to_array({arg1, arg2})); 1698 } 1699 1700 void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 1701 std::string_view arg2) 1702 { 1703 res.result(boost::beast::http::status::bad_request); 1704 addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 1705 } 1706 1707 /** 1708 * @internal 1709 * @brief Formats PasswordChangeRequired message into JSON 1710 * 1711 * See header file for more information 1712 * @endinternal 1713 */ 1714 nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1) 1715 { 1716 return getLog(redfish::registries::base::Index::passwordChangeRequired, 1717 std::to_array<std::string_view>({arg1.buffer()})); 1718 } 1719 1720 void passwordChangeRequired(crow::Response& res, 1721 const boost::urls::url_view_base& arg1) 1722 { 1723 addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 1724 } 1725 1726 /** 1727 * @internal 1728 * @brief Formats ResetRequired message into JSON 1729 * 1730 * See header file for more information 1731 * @endinternal 1732 */ 1733 nlohmann::json resetRequired(const boost::urls::url_view_base& arg1, 1734 std::string_view arg2) 1735 { 1736 return getLog(redfish::registries::base::Index::resetRequired, 1737 std::to_array<std::string_view>({arg1.buffer(), arg2})); 1738 } 1739 1740 void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1, 1741 std::string_view arg2) 1742 { 1743 res.result(boost::beast::http::status::bad_request); 1744 addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 1745 } 1746 1747 /** 1748 * @internal 1749 * @brief Formats ResetRecommended message into JSON 1750 * 1751 * See header file for more information 1752 * @endinternal 1753 */ 1754 nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2) 1755 { 1756 return getLog(redfish::registries::base::Index::resetRecommended, 1757 std::to_array({arg1, arg2})); 1758 } 1759 1760 void resetRecommended(crow::Response& res, std::string_view arg1, 1761 std::string_view arg2) 1762 { 1763 res.result(boost::beast::http::status::bad_request); 1764 addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2)); 1765 } 1766 1767 /** 1768 * @internal 1769 * @brief Formats ChassisPowerStateOnRequired message into JSON 1770 * 1771 * See header file for more information 1772 * @endinternal 1773 */ 1774 nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 1775 { 1776 return getLog(redfish::registries::base::Index::chassisPowerStateOnRequired, 1777 std::to_array({arg1})); 1778 } 1779 1780 void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 1781 { 1782 res.result(boost::beast::http::status::bad_request); 1783 addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 1784 } 1785 1786 /** 1787 * @internal 1788 * @brief Formats ChassisPowerStateOffRequired message into JSON 1789 * 1790 * See header file for more information 1791 * @endinternal 1792 */ 1793 nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 1794 { 1795 return getLog( 1796 redfish::registries::base::Index::chassisPowerStateOffRequired, 1797 std::to_array({arg1})); 1798 } 1799 1800 void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 1801 { 1802 res.result(boost::beast::http::status::bad_request); 1803 addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 1804 } 1805 1806 /** 1807 * @internal 1808 * @brief Formats PropertyValueConflict message into JSON 1809 * 1810 * See header file for more information 1811 * @endinternal 1812 */ 1813 nlohmann::json propertyValueConflict(std::string_view arg1, 1814 std::string_view arg2) 1815 { 1816 return getLog(redfish::registries::base::Index::propertyValueConflict, 1817 std::to_array({arg1, arg2})); 1818 } 1819 1820 void propertyValueConflict(crow::Response& res, std::string_view arg1, 1821 std::string_view arg2) 1822 { 1823 res.result(boost::beast::http::status::bad_request); 1824 addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 1825 } 1826 1827 /** 1828 * @internal 1829 * @brief Formats PropertyValueResourceConflict message into JSON 1830 * 1831 * See header file for more information 1832 * @endinternal 1833 */ 1834 nlohmann::json propertyValueResourceConflict( 1835 std::string_view arg1, const nlohmann::json& arg2, 1836 const boost::urls::url_view_base& arg3) 1837 { 1838 std::string arg2Str = 1839 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1840 return getLog( 1841 redfish::registries::base::Index::propertyValueResourceConflict, 1842 std::to_array<std::string_view>({arg1, arg2Str, arg3.buffer()})); 1843 } 1844 1845 void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 1846 const nlohmann::json& arg2, 1847 const boost::urls::url_view_base& arg3) 1848 { 1849 res.result(boost::beast::http::status::conflict); 1850 addMessageToErrorJson(res.jsonValue, 1851 propertyValueResourceConflict(arg1, arg2, arg3)); 1852 } 1853 1854 /** 1855 * @internal 1856 * @brief Formats PropertyValueExternalConflict message into JSON 1857 * 1858 * See header file for more information 1859 * @endinternal 1860 */ 1861 nlohmann::json propertyValueExternalConflict(std::string_view arg1, 1862 const nlohmann::json& arg2) 1863 { 1864 std::string arg2Str = 1865 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1866 return getLog( 1867 redfish::registries::base::Index::propertyValueExternalConflict, 1868 std::to_array<std::string_view>({arg1, arg2Str})); 1869 } 1870 1871 void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 1872 const nlohmann::json& arg2) 1873 { 1874 res.result(boost::beast::http::status::conflict); 1875 addMessageToErrorJson(res.jsonValue, 1876 propertyValueExternalConflict(arg1, arg2)); 1877 } 1878 1879 /** 1880 * @internal 1881 * @brief Formats PropertyValueIncorrect message into JSON 1882 * 1883 * See header file for more information 1884 * @endinternal 1885 */ 1886 nlohmann::json propertyValueIncorrect(std::string_view arg1, 1887 const nlohmann::json& arg2) 1888 { 1889 std::string arg2Str = 1890 arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1891 return getLog(redfish::registries::base::Index::propertyValueIncorrect, 1892 std::to_array<std::string_view>({arg1, arg2Str})); 1893 } 1894 1895 void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 1896 const nlohmann::json& arg2) 1897 { 1898 res.result(boost::beast::http::status::bad_request); 1899 addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 1900 } 1901 1902 /** 1903 * @internal 1904 * @brief Formats ResourceCreationConflict message into JSON 1905 * 1906 * See header file for more information 1907 * @endinternal 1908 */ 1909 nlohmann::json resourceCreationConflict(const boost::urls::url_view_base& arg1) 1910 { 1911 return getLog(redfish::registries::base::Index::resourceCreationConflict, 1912 std::to_array<std::string_view>({arg1.buffer()})); 1913 } 1914 1915 void resourceCreationConflict(crow::Response& res, 1916 const boost::urls::url_view_base& arg1) 1917 { 1918 res.result(boost::beast::http::status::bad_request); 1919 addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 1920 } 1921 1922 /** 1923 * @internal 1924 * @brief Formats ActionParameterValueConflict message into JSON 1925 * 1926 * See header file for more information 1927 * @endinternal 1928 */ 1929 nlohmann::json 1930 actionParameterValueConflict(std::string_view arg1, std::string_view arg2) 1931 { 1932 return getLog( 1933 redfish::registries::base::Index::actionParameterValueConflict, 1934 std::to_array({arg1, arg2})); 1935 } 1936 1937 void actionParameterValueConflict(crow::Response& res, std::string_view arg1, 1938 std::string_view arg2) 1939 { 1940 res.result(boost::beast::http::status::bad_request); 1941 addMessageToErrorJson(res.jsonValue, 1942 actionParameterValueConflict(arg1, arg2)); 1943 } 1944 1945 /** 1946 * @internal 1947 * @brief Formats MaximumErrorsExceeded message into JSON 1948 * 1949 * See header file for more information 1950 * @endinternal 1951 */ 1952 nlohmann::json maximumErrorsExceeded() 1953 { 1954 return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 1955 } 1956 1957 void maximumErrorsExceeded(crow::Response& res) 1958 { 1959 res.result(boost::beast::http::status::internal_server_error); 1960 addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 1961 } 1962 1963 /** 1964 * @internal 1965 * @brief Formats PreconditionFailed message into JSON 1966 * 1967 * See header file for more information 1968 * @endinternal 1969 */ 1970 nlohmann::json preconditionFailed() 1971 { 1972 return getLog(redfish::registries::base::Index::preconditionFailed, {}); 1973 } 1974 1975 void preconditionFailed(crow::Response& res) 1976 { 1977 res.result(boost::beast::http::status::precondition_failed); 1978 addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1979 } 1980 1981 /** 1982 * @internal 1983 * @brief Formats PreconditionRequired message into JSON 1984 * 1985 * See header file for more information 1986 * @endinternal 1987 */ 1988 nlohmann::json preconditionRequired() 1989 { 1990 return getLog(redfish::registries::base::Index::preconditionRequired, {}); 1991 } 1992 1993 void preconditionRequired(crow::Response& res) 1994 { 1995 res.result(boost::beast::http::status::bad_request); 1996 addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1997 } 1998 1999 /** 2000 * @internal 2001 * @brief Formats HeaderMissing message into JSON 2002 * 2003 * See header file for more information 2004 * @endinternal 2005 */ 2006 nlohmann::json headerMissing(std::string_view arg1) 2007 { 2008 return getLog(redfish::registries::base::Index::headerMissing, 2009 std::to_array({arg1})); 2010 } 2011 2012 void headerMissing(crow::Response& res, std::string_view arg1) 2013 { 2014 res.result(boost::beast::http::status::bad_request); 2015 addMessageToErrorJson(res.jsonValue, headerMissing(arg1)); 2016 } 2017 2018 /** 2019 * @internal 2020 * @brief Formats HeaderInvalid message into JSON 2021 * 2022 * See header file for more information 2023 * @endinternal 2024 */ 2025 nlohmann::json headerInvalid(std::string_view arg1) 2026 { 2027 return getLog(redfish::registries::base::Index::headerInvalid, 2028 std::to_array({arg1})); 2029 } 2030 2031 void headerInvalid(crow::Response& res, std::string_view arg1) 2032 { 2033 res.result(boost::beast::http::status::bad_request); 2034 addMessageToErrorJson(res.jsonValue, headerInvalid(arg1)); 2035 } 2036 2037 /** 2038 * @internal 2039 * @brief Formats OperationFailed message into JSON 2040 * 2041 * See header file for more information 2042 * @endinternal 2043 */ 2044 nlohmann::json operationFailed() 2045 { 2046 return getLog(redfish::registries::base::Index::operationFailed, {}); 2047 } 2048 2049 void operationFailed(crow::Response& res) 2050 { 2051 res.result(boost::beast::http::status::bad_gateway); 2052 addMessageToErrorJson(res.jsonValue, operationFailed()); 2053 } 2054 2055 /** 2056 * @internal 2057 * @brief Formats OperationTimeout message into JSON 2058 * 2059 * See header file for more information 2060 * @endinternal 2061 */ 2062 nlohmann::json operationTimeout() 2063 { 2064 return getLog(redfish::registries::base::Index::operationTimeout, {}); 2065 } 2066 2067 void operationTimeout(crow::Response& res) 2068 { 2069 res.result(boost::beast::http::status::internal_server_error); 2070 addMessageToErrorJson(res.jsonValue, operationTimeout()); 2071 } 2072 2073 /** 2074 * @internal 2075 * @brief Formats OperationNotAllowed message into JSON 2076 * 2077 * See header file for more information 2078 * @endinternal 2079 */ 2080 nlohmann::json operationNotAllowed() 2081 { 2082 return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 2083 } 2084 2085 void operationNotAllowed(crow::Response& res) 2086 { 2087 res.result(boost::beast::http::status::method_not_allowed); 2088 addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 2089 } 2090 2091 /** 2092 * @internal 2093 * @brief Formats UndeterminedFault message into JSON 2094 * 2095 * See header file for more information 2096 * @endinternal 2097 */ 2098 nlohmann::json undeterminedFault(std::string_view arg1) 2099 { 2100 return getLog(redfish::registries::base::Index::undeterminedFault, 2101 std::to_array({arg1})); 2102 } 2103 2104 void undeterminedFault(crow::Response& res, std::string_view arg1) 2105 { 2106 res.result(boost::beast::http::status::bad_request); 2107 addMessageToErrorJson(res.jsonValue, undeterminedFault(arg1)); 2108 } 2109 2110 /** 2111 * @internal 2112 * @brief Formats ConditionInRelatedResource message into JSON 2113 * 2114 * See header file for more information 2115 * @endinternal 2116 */ 2117 nlohmann::json conditionInRelatedResource() 2118 { 2119 return getLog(redfish::registries::base::Index::conditionInRelatedResource, 2120 {}); 2121 } 2122 2123 void conditionInRelatedResource(crow::Response& res) 2124 { 2125 res.result(boost::beast::http::status::bad_request); 2126 addMessageToErrorJson(res.jsonValue, conditionInRelatedResource()); 2127 } 2128 2129 /** 2130 * @internal 2131 * @brief Formats RestrictedRole message into JSON 2132 * 2133 * See header file for more information 2134 * @endinternal 2135 */ 2136 nlohmann::json restrictedRole(std::string_view arg1) 2137 { 2138 return getLog(redfish::registries::base::Index::restrictedRole, 2139 std::to_array({arg1})); 2140 } 2141 2142 void restrictedRole(crow::Response& res, std::string_view arg1) 2143 { 2144 res.result(boost::beast::http::status::bad_request); 2145 addMessageToErrorJson(res.jsonValue, restrictedRole(arg1)); 2146 } 2147 2148 /** 2149 * @internal 2150 * @brief Formats RestrictedPrivilege message into JSON 2151 * 2152 * See header file for more information 2153 * @endinternal 2154 */ 2155 nlohmann::json restrictedPrivilege(std::string_view arg1) 2156 { 2157 return getLog(redfish::registries::base::Index::restrictedPrivilege, 2158 std::to_array({arg1})); 2159 } 2160 2161 void restrictedPrivilege(crow::Response& res, std::string_view arg1) 2162 { 2163 res.result(boost::beast::http::status::bad_request); 2164 addMessageToErrorJson(res.jsonValue, restrictedPrivilege(arg1)); 2165 } 2166 2167 /** 2168 * @internal 2169 * @brief Formats StrictAccountTypes message into JSON 2170 * 2171 * See header file for more information 2172 * @endinternal 2173 */ 2174 nlohmann::json strictAccountTypes(std::string_view arg1) 2175 { 2176 return getLog(redfish::registries::base::Index::strictAccountTypes, 2177 std::to_array({arg1})); 2178 } 2179 2180 void strictAccountTypes(crow::Response& res, std::string_view arg1) 2181 { 2182 res.result(boost::beast::http::status::bad_request); 2183 addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 2184 } 2185 2186 /** 2187 * @internal 2188 * @brief Formats PropertyDeprecated message into JSON 2189 * 2190 * See header file for more information 2191 * @endinternal 2192 */ 2193 nlohmann::json propertyDeprecated(std::string_view arg1) 2194 { 2195 return getLog(redfish::registries::base::Index::propertyDeprecated, 2196 std::to_array({arg1})); 2197 } 2198 2199 void propertyDeprecated(crow::Response& res, std::string_view arg1) 2200 { 2201 res.result(boost::beast::http::status::bad_request); 2202 addMessageToErrorJson(res.jsonValue, propertyDeprecated(arg1)); 2203 } 2204 2205 /** 2206 * @internal 2207 * @brief Formats ResourceDeprecated message into JSON 2208 * 2209 * See header file for more information 2210 * @endinternal 2211 */ 2212 nlohmann::json resourceDeprecated(std::string_view arg1) 2213 { 2214 return getLog(redfish::registries::base::Index::resourceDeprecated, 2215 std::to_array({arg1})); 2216 } 2217 2218 void resourceDeprecated(crow::Response& res, std::string_view arg1) 2219 { 2220 res.result(boost::beast::http::status::bad_request); 2221 addMessageToErrorJson(res.jsonValue, resourceDeprecated(arg1)); 2222 } 2223 2224 /** 2225 * @internal 2226 * @brief Formats PropertyValueDeprecated message into JSON 2227 * 2228 * See header file for more information 2229 * @endinternal 2230 */ 2231 nlohmann::json propertyValueDeprecated(std::string_view arg1, 2232 std::string_view arg2) 2233 { 2234 return getLog(redfish::registries::base::Index::propertyValueDeprecated, 2235 std::to_array({arg1, arg2})); 2236 } 2237 2238 void propertyValueDeprecated(crow::Response& res, std::string_view arg1, 2239 std::string_view arg2) 2240 { 2241 res.result(boost::beast::http::status::bad_request); 2242 addMessageToErrorJson(res.jsonValue, propertyValueDeprecated(arg1, arg2)); 2243 } 2244 2245 /** 2246 * @internal 2247 * @brief Formats ActionDeprecated message into JSON 2248 * 2249 * See header file for more information 2250 * @endinternal 2251 */ 2252 nlohmann::json actionDeprecated(std::string_view arg1) 2253 { 2254 return getLog(redfish::registries::base::Index::actionDeprecated, 2255 std::to_array({arg1})); 2256 } 2257 2258 void actionDeprecated(crow::Response& res, std::string_view arg1) 2259 { 2260 res.result(boost::beast::http::status::bad_request); 2261 addMessageToErrorJson(res.jsonValue, actionDeprecated(arg1)); 2262 } 2263 2264 /** 2265 * @internal 2266 * @brief Formats NetworkNameResolutionNotConfigured message into JSON 2267 * 2268 * See header file for more information 2269 * @endinternal 2270 */ 2271 nlohmann::json networkNameResolutionNotConfigured() 2272 { 2273 return getLog( 2274 redfish::registries::base::Index::networkNameResolutionNotConfigured, 2275 {}); 2276 } 2277 2278 void networkNameResolutionNotConfigured(crow::Response& res) 2279 { 2280 res.result(boost::beast::http::status::bad_request); 2281 addMessageToErrorJson(res.jsonValue, networkNameResolutionNotConfigured()); 2282 } 2283 2284 /** 2285 * @internal 2286 * @brief Formats NetworkNameResolutionNotSupported message into JSON 2287 * 2288 * See header file for more information 2289 * @endinternal 2290 */ 2291 nlohmann::json networkNameResolutionNotSupported() 2292 { 2293 return getLog( 2294 redfish::registries::base::Index::networkNameResolutionNotSupported, 2295 {}); 2296 } 2297 2298 void networkNameResolutionNotSupported(crow::Response& res) 2299 { 2300 res.result(boost::beast::http::status::bad_request); 2301 addMessageToErrorJson(res.jsonValue, networkNameResolutionNotSupported()); 2302 } 2303 2304 /** 2305 * @internal 2306 * @brief Formats ServiceDisabled message into JSON 2307 * 2308 * See header file for more information 2309 * @endinternal 2310 */ 2311 nlohmann::json serviceDisabled(std::string_view arg1) 2312 { 2313 return getLog(redfish::registries::base::Index::serviceDisabled, 2314 std::to_array({arg1})); 2315 } 2316 2317 void serviceDisabled(crow::Response& res, std::string_view arg1) 2318 { 2319 res.result(boost::beast::http::status::service_unavailable); 2320 addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 2321 } 2322 2323 /** 2324 * @internal 2325 * @brief Formats EventBufferExceeded message into JSON 2326 * 2327 * See header file for more information 2328 * @endinternal 2329 */ 2330 nlohmann::json eventBufferExceeded() 2331 { 2332 return getLog(redfish::registries::base::Index::eventBufferExceeded, {}); 2333 } 2334 2335 void eventBufferExceeded(crow::Response& res) 2336 { 2337 res.result(boost::beast::http::status::bad_request); 2338 addMessageToErrorJson(res.jsonValue, eventBufferExceeded()); 2339 } 2340 2341 /** 2342 * @internal 2343 * @brief Formats AuthenticationTokenRequired message into JSON 2344 * 2345 * See header file for more information 2346 * @endinternal 2347 */ 2348 nlohmann::json authenticationTokenRequired() 2349 { 2350 return getLog(redfish::registries::base::Index::authenticationTokenRequired, 2351 {}); 2352 } 2353 2354 void authenticationTokenRequired(crow::Response& res) 2355 { 2356 res.result(boost::beast::http::status::bad_request); 2357 addMessageToErrorJson(res.jsonValue, authenticationTokenRequired()); 2358 } 2359 2360 /** 2361 * @internal 2362 * @brief Formats OneTimePasscodeSent message into JSON 2363 * 2364 * See header file for more information 2365 * @endinternal 2366 */ 2367 nlohmann::json oneTimePasscodeSent(std::string_view arg1) 2368 { 2369 return getLog(redfish::registries::base::Index::oneTimePasscodeSent, 2370 std::to_array({arg1})); 2371 } 2372 2373 void oneTimePasscodeSent(crow::Response& res, std::string_view arg1) 2374 { 2375 res.result(boost::beast::http::status::bad_request); 2376 addMessageToErrorJson(res.jsonValue, oneTimePasscodeSent(arg1)); 2377 } 2378 2379 /** 2380 * @internal 2381 * @brief Formats LicenseRequired message into JSON 2382 * 2383 * See header file for more information 2384 * @endinternal 2385 */ 2386 nlohmann::json licenseRequired(std::string_view arg1) 2387 { 2388 return getLog(redfish::registries::base::Index::licenseRequired, 2389 std::to_array({arg1})); 2390 } 2391 2392 void licenseRequired(crow::Response& res, std::string_view arg1) 2393 { 2394 res.result(boost::beast::http::status::bad_request); 2395 addMessageToErrorJson(res.jsonValue, licenseRequired(arg1)); 2396 } 2397 2398 /** 2399 * @internal 2400 * @brief Formats PropertyModified message into JSON 2401 * 2402 * See header file for more information 2403 * @endinternal 2404 */ 2405 nlohmann::json propertyModified() 2406 { 2407 return getLog(redfish::registries::base::Index::propertyModified, {}); 2408 } 2409 2410 void propertyModified(crow::Response& res) 2411 { 2412 res.result(boost::beast::http::status::bad_request); 2413 addMessageToErrorJson(res.jsonValue, propertyModified()); 2414 } 2415 2416 /** 2417 * @internal 2418 * @brief Formats GenerateSecretKeyRequired message into JSON 2419 * 2420 * See header file for more information 2421 * @endinternal 2422 */ 2423 nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1) 2424 { 2425 return getLog(redfish::registries::base::Index::generateSecretKeyRequired, 2426 std::to_array<std::string_view>({arg1.buffer()})); 2427 } 2428 2429 void generateSecretKeyRequired(crow::Response& res, 2430 const boost::urls::url_view_base& arg1) 2431 { 2432 res.result(boost::beast::http::status::forbidden); 2433 addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1)); 2434 } 2435 2436 } // namespace messages 2437 } // namespace redfish 2438