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