1 /* 2 // Copyright (c) 2018 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 #include <crow/logging.h> 17 18 #include <error_messages.hpp> 19 20 namespace redfish 21 { 22 23 namespace messages 24 { 25 26 void addMessageToErrorJson(nlohmann::json& target, 27 const nlohmann::json& message) 28 { 29 auto& error = target["error"]; 30 31 // If this is the first error message, fill in the information from the 32 // first error message to the top level struct 33 if (!error.is_object()) 34 { 35 auto message_id_iterator = message.find("MessageId"); 36 if (message_id_iterator == message.end()) 37 { 38 BMCWEB_LOG_CRITICAL 39 << "Attempt to add error message without MessageId"; 40 return; 41 } 42 43 auto message_field_iterator = message.find("Message"); 44 if (message_field_iterator == message.end()) 45 { 46 BMCWEB_LOG_CRITICAL 47 << "Attempt to add error message without Message"; 48 return; 49 } 50 // clang-format off 51 error = { 52 {"code", *message_id_iterator}, 53 {"message", *message_field_iterator} 54 }; 55 // clang-format on 56 } 57 else 58 { 59 // More than 1 error occurred, so the message has to be generic 60 error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 61 error["message"] = 62 "A general error has occurred. See ExtendedInfo for more" 63 "information."; 64 } 65 66 // This check could technically be done in in the default construction 67 // branch above, but because we need the pointer to the extended info field 68 // anyway, it's more efficient to do it here. 69 auto& extended_info = error[messages::messageAnnotation]; 70 if (!extended_info.is_array()) 71 { 72 extended_info = nlohmann::json::array(); 73 } 74 75 extended_info.push_back(message); 76 } 77 78 void addMessageToJsonRoot(nlohmann::json& target, const nlohmann::json& message) 79 { 80 if (!target[messages::messageAnnotation].is_array()) 81 { 82 // Force object to be an array 83 target[messages::messageAnnotation] = nlohmann::json::array(); 84 } 85 86 target[messages::messageAnnotation].push_back(message); 87 } 88 89 void addMessageToJson(nlohmann::json& target, const nlohmann::json& message, 90 const std::string& fieldPath) 91 { 92 nlohmann::json_pointer<nlohmann::json> extendedInfo( 93 fieldPath + messages::messageAnnotation); 94 95 if (!target[extendedInfo].is_array()) 96 { 97 // Force object to be an array 98 target[extendedInfo] = nlohmann::json::array(); 99 } 100 101 // Object exists and it is an array so we can just push in the message 102 target[extendedInfo].push_back(message); 103 } 104 105 /********************************* 106 * AUTOGENERATED FUNCTIONS START * 107 *********************************/ 108 109 /** 110 * @internal 111 * @brief Formats ResourceInUse message into JSON 112 * 113 * See header file for more information 114 * @endinternal 115 */ 116 nlohmann::json resourceInUse() 117 { 118 return nlohmann::json{ 119 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 120 {"MessageId", "Base.1.2.0.ResourceInUse"}, 121 {"Message", "The change to the requested resource failed because the " 122 "resource is in " 123 "use or in transition."}, 124 {"Severity", "Warning"}, 125 {"Resolution", 126 "Remove the condition and resubmit the request if the operation " 127 "failed."}}; 128 } 129 130 /** 131 * @internal 132 * @brief Formats MalformedJSON message into JSON 133 * 134 * See header file for more information 135 * @endinternal 136 */ 137 nlohmann::json malformedJSON() 138 { 139 return nlohmann::json{ 140 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 141 {"MessageId", "Base.1.2.0.MalformedJSON"}, 142 {"Message", "The request body submitted was malformed JSON and could " 143 "not be parsed " 144 "by the receiving service."}, 145 {"Severity", "Critical"}, 146 {"Resolution", "Ensure that the request body is valid JSON and " 147 "resubmit the request."}}; 148 } 149 150 /** 151 * @internal 152 * @brief Formats ResourceMissingAtURI message into JSON 153 * 154 * See header file for more information 155 * @endinternal 156 */ 157 nlohmann::json resourceMissingAtURI(const std::string& arg1) 158 { 159 return nlohmann::json{ 160 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 161 {"MessageId", "Base.1.2.0.ResourceMissingAtURI"}, 162 {"Message", "The resource at the URI " + arg1 + " was not found."}, 163 {"Severity", "Critical"}, 164 {"Resolution", "Place a valid resource at the URI or correct the URI " 165 "and resubmit the " 166 "request."}}; 167 } 168 169 /** 170 * @internal 171 * @brief Formats ActionParameterValueFormatError message into JSON 172 * 173 * See header file for more information 174 * @endinternal 175 */ 176 nlohmann::json actionParameterValueFormatError(const std::string& arg1, 177 const std::string& arg2, 178 const std::string& arg3) 179 { 180 return nlohmann::json{ 181 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 182 {"MessageId", "Base.1.2.0.ActionParameterValueFormatError"}, 183 {"Message", 184 "The value " + arg1 + " for the parameter " + arg2 + 185 " in the action " + arg3 + 186 " is of a different format than the parameter can accept."}, 187 {"Severity", "Warning"}, 188 {"Resolution", 189 "Correct the value for the parameter in the request body and resubmit " 190 "the request if the operation failed."}}; 191 } 192 193 /** 194 * @internal 195 * @brief Formats InternalError message into JSON 196 * 197 * See header file for more information 198 * @endinternal 199 */ 200 nlohmann::json internalError() 201 { 202 return nlohmann::json{ 203 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 204 {"MessageId", "Base.1.2.0.InternalError"}, 205 {"Message", 206 "The request failed due to an internal service error. The service is " 207 "still operational."}, 208 {"Severity", "Critical"}, 209 {"Resolution", "Resubmit the request. If the problem persists, " 210 "consider resetting the " 211 "service."}}; 212 } 213 214 /** 215 * @internal 216 * @brief Formats UnrecognizedRequestBody message into JSON 217 * 218 * See header file for more information 219 * @endinternal 220 */ 221 nlohmann::json unrecognizedRequestBody() 222 { 223 return nlohmann::json{ 224 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 225 {"MessageId", "Base.1.2.0.UnrecognizedRequestBody"}, 226 {"Message", 227 "The service detected a malformed request body that it was unable to " 228 "interpret."}, 229 {"Severity", "Warning"}, 230 {"Resolution", 231 "Correct the request body and resubmit the request if it failed."}}; 232 } 233 234 /** 235 * @internal 236 * @brief Formats ResourceAtUriUnauthorized message into JSON 237 * 238 * See header file for more information 239 * @endinternal 240 */ 241 nlohmann::json resourceAtUriUnauthorized(const std::string& arg1, 242 const std::string& arg2) 243 { 244 return nlohmann::json{ 245 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 246 {"MessageId", "Base.1.2.0.ResourceAtUriUnauthorized"}, 247 {"Message", "While accessing the resource at " + arg1 + 248 ", the service received an authorization error " + 249 arg2 + "."}, 250 {"Severity", "Critical"}, 251 {"Resolution", 252 "Ensure that the appropriate access is provided for the service in " 253 "order for it to access the URI."}}; 254 } 255 256 /** 257 * @internal 258 * @brief Formats ActionParameterUnknown message into JSON 259 * 260 * See header file for more information 261 * @endinternal 262 */ 263 nlohmann::json actionParameterUnknown(const std::string& arg1, 264 const std::string& arg2) 265 { 266 return nlohmann::json{ 267 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 268 {"MessageId", "Base.1.2.0.ActionParameterUnknown"}, 269 {"Message", "The action " + arg1 + 270 " was submitted with the invalid parameter " + arg2 + 271 "."}, 272 {"Severity", "Warning"}, 273 {"Resolution", 274 "Correct the invalid parameter and resubmit the request if the " 275 "operation failed."}}; 276 } 277 278 /** 279 * @internal 280 * @brief Formats ResourceCannotBeDeleted message into JSON 281 * 282 * See header file for more information 283 * @endinternal 284 */ 285 nlohmann::json resourceCannotBeDeleted() 286 { 287 return nlohmann::json{ 288 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 289 {"MessageId", "Base.1.2.0.ResourceCannotBeDeleted"}, 290 {"Message", 291 "The delete request failed because the resource requested cannot be " 292 "deleted."}, 293 {"Severity", "Critical"}, 294 {"Resolution", "Do not attempt to delete a non-deletable resource."}}; 295 } 296 297 /** 298 * @internal 299 * @brief Formats PropertyDuplicate message into JSON 300 * 301 * See header file for more information 302 * @endinternal 303 */ 304 nlohmann::json propertyDuplicate(const std::string& arg1) 305 { 306 return nlohmann::json{ 307 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 308 {"MessageId", "Base.1.2.0.PropertyDuplicate"}, 309 {"Message", "The property " + arg1 + " was duplicated in the request."}, 310 {"Severity", "Warning"}, 311 {"Resolution", 312 "Remove the duplicate property from the request body and resubmit the " 313 "request if the operation failed."}}; 314 } 315 316 /** 317 * @internal 318 * @brief Formats ServiceTemporarilyUnavailable message into JSON 319 * 320 * See header file for more information 321 * @endinternal 322 */ 323 nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1) 324 { 325 return nlohmann::json{ 326 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 327 {"MessageId", "Base.1.2.0.ServiceTemporarilyUnavailable"}, 328 {"Message", "The service is temporarily unavailable. Retry in " + 329 arg1 + " seconds."}, 330 {"Severity", "Critical"}, 331 {"Resolution", 332 "Wait for the indicated retry duration and retry the operation."}}; 333 } 334 335 /** 336 * @internal 337 * @brief Formats ResourceAlreadyExists message into JSON 338 * 339 * See header file for more information 340 * @endinternal 341 */ 342 nlohmann::json resourceAlreadyExists(const std::string& arg1, 343 const std::string& arg2, 344 const std::string& arg3) 345 { 346 return nlohmann::json{ 347 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 348 {"MessageId", "Base.1.2.0.ResourceAlreadyExists"}, 349 {"Message", "The requested resource of type " + arg1 + 350 " with the property " + arg2 + " with the value " + 351 arg3 + " already exists."}, 352 {"Severity", "Critical"}, 353 {"Resolution", 354 "Do not repeat the create operation as the resource has already been " 355 "created."}}; 356 } 357 358 /** 359 * @internal 360 * @brief Formats AccountForSessionNoLongerExists message into JSON 361 * 362 * See header file for more information 363 * @endinternal 364 */ 365 nlohmann::json accountForSessionNoLongerExists() 366 { 367 return nlohmann::json{ 368 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 369 {"MessageId", "Base.1.2.0.AccountForSessionNoLongerExists"}, 370 {"Message", "The account for the current session has been removed, " 371 "thus the current " 372 "session has been removed as well."}, 373 {"Severity", "OK"}, 374 {"Resolution", "Attempt to connect with a valid account."}}; 375 } 376 377 /** 378 * @internal 379 * @brief Formats CreateFailedMissingReqProperties message into JSON 380 * 381 * See header file for more information 382 * @endinternal 383 */ 384 nlohmann::json createFailedMissingReqProperties(const std::string& arg1) 385 { 386 return nlohmann::json{ 387 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 388 {"MessageId", "Base.1.2.0.CreateFailedMissingReqProperties"}, 389 {"Message", 390 "The create operation failed because the required property " + arg1 + 391 " was missing from the request."}, 392 {"Severity", "Critical"}, 393 {"Resolution", 394 "Correct the body to include the required property with a valid value " 395 "and resubmit the request if the operation failed."}}; 396 } 397 398 /** 399 * @internal 400 * @brief Formats PropertyValueFormatError message into JSON 401 * 402 * See header file for more information 403 * @endinternal 404 */ 405 nlohmann::json propertyValueFormatError(const std::string& arg1, 406 const std::string& arg2) 407 { 408 return nlohmann::json{ 409 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 410 {"MessageId", "Base.1.2.0.PropertyValueFormatError"}, 411 {"Message", 412 "The value " + arg1 + " for the property " + arg2 + 413 " is of a different format than the property can accept."}, 414 {"Severity", "Warning"}, 415 {"Resolution", 416 "Correct the value for the property in the request body and resubmit " 417 "the request if the operation failed."}}; 418 } 419 420 /** 421 * @internal 422 * @brief Formats PropertyValueNotInList message into JSON 423 * 424 * See header file for more information 425 * @endinternal 426 */ 427 nlohmann::json propertyValueNotInList(const std::string& arg1, 428 const std::string& arg2) 429 { 430 return nlohmann::json{ 431 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 432 {"MessageId", "Base.1.2.0.PropertyValueNotInList"}, 433 {"Message", "The value " + arg1 + " for the property " + arg2 + 434 " is not in the list of acceptable values."}, 435 {"Severity", "Warning"}, 436 {"Resolution", 437 "Choose a value from the enumeration list that the implementation can " 438 "support and resubmit the request if the operation failed."}}; 439 } 440 441 /** 442 * @internal 443 * @brief Formats ResourceAtUriInUnknownFormat message into JSON 444 * 445 * See header file for more information 446 * @endinternal 447 */ 448 nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1) 449 { 450 return nlohmann::json{ 451 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 452 {"MessageId", "Base.1.2.0.ResourceAtUriInUnknownFormat"}, 453 {"Message", "The resource at " + arg1 + 454 " is in a format not recognized by the service."}, 455 {"Severity", "Critical"}, 456 {"Resolution", 457 "Place an image or resource or file that is recognized by the service " 458 "at the URI."}}; 459 } 460 461 /** 462 * @internal 463 * @brief Formats ServiceInUnknownState message into JSON 464 * 465 * See header file for more information 466 * @endinternal 467 */ 468 nlohmann::json serviceInUnknownState() 469 { 470 return nlohmann::json{ 471 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 472 {"MessageId", "Base.1.2.0.ServiceInUnknownState"}, 473 {"Message", 474 "The operation failed because the service is in an unknown state and " 475 "can no longer take incoming requests."}, 476 {"Severity", "Critical"}, 477 {"Resolution", 478 "Restart the service and resubmit the request if the operation " 479 "failed."}}; 480 } 481 482 /** 483 * @internal 484 * @brief Formats EventSubscriptionLimitExceeded message into JSON 485 * 486 * See header file for more information 487 * @endinternal 488 */ 489 nlohmann::json eventSubscriptionLimitExceeded() 490 { 491 return nlohmann::json{ 492 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 493 {"MessageId", "Base.1.2.0.EventSubscriptionLimitExceeded"}, 494 {"Message", 495 "The event subscription failed due to the number of simultaneous " 496 "subscriptions exceeding the limit of the implementation."}, 497 {"Severity", "Critical"}, 498 {"Resolution", 499 "Reduce the number of other subscriptions before trying to establish " 500 "the event subscription or increase the limit of simultaneous " 501 "subscriptions (if supported)."}}; 502 } 503 504 /** 505 * @internal 506 * @brief Formats ActionParameterMissing message into JSON 507 * 508 * See header file for more information 509 * @endinternal 510 */ 511 nlohmann::json actionParameterMissing(const std::string& arg1, 512 const std::string& arg2) 513 { 514 return nlohmann::json{ 515 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 516 {"MessageId", "Base.1.2.0.ActionParameterMissing"}, 517 {"Message", "The action " + arg1 + " requires the parameter " + arg2 + 518 " to be present in the request body."}, 519 {"Severity", "Critical"}, 520 {"Resolution", "Supply the action with the required parameter in the " 521 "request body when " 522 "the request is resubmitted."}}; 523 } 524 525 /** 526 * @internal 527 * @brief Formats StringValueTooLong message into JSON 528 * 529 * See header file for more information 530 * @endinternal 531 */ 532 nlohmann::json stringValueTooLong(const std::string& arg1, const int& arg2) 533 { 534 return nlohmann::json{ 535 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 536 {"MessageId", "Base.1.2.0.StringValueTooLong"}, 537 {"Message", "The string " + arg1 + " exceeds the length limit " + 538 std::to_string(arg2) + "."}, 539 {"Severity", "Warning"}, 540 {"Resolution", 541 "Resubmit the request with an appropriate string length."}}; 542 } 543 544 /** 545 * @internal 546 * @brief Formats PropertyValueTypeError message into JSON 547 * 548 * See header file for more information 549 * @endinternal 550 */ 551 nlohmann::json propertyValueTypeError(const std::string& arg1, 552 const std::string& arg2) 553 { 554 return nlohmann::json{ 555 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 556 {"MessageId", "Base.1.2.0.PropertyValueTypeError"}, 557 {"Message", 558 "The value " + arg1 + " for the property " + arg2 + 559 " is of a different type than the property can accept."}, 560 {"Severity", "Warning"}, 561 {"Resolution", 562 "Correct the value for the property in the request body and resubmit " 563 "the request if the operation failed."}}; 564 } 565 566 /** 567 * @internal 568 * @brief Formats ResourceNotFound message into JSON 569 * 570 * See header file for more information 571 * @endinternal 572 */ 573 nlohmann::json resourceNotFound(const std::string& arg1, 574 const std::string& arg2) 575 { 576 return nlohmann::json{ 577 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 578 {"MessageId", "Base.1.2.0.ResourceNotFound"}, 579 {"Message", "The requested resource of type " + arg1 + " named " + 580 arg2 + " was not found."}, 581 {"Severity", "Critical"}, 582 {"Resolution", 583 "Provide a valid resource identifier and resubmit the request."}}; 584 } 585 586 /** 587 * @internal 588 * @brief Formats CouldNotEstablishConnection message into JSON 589 * 590 * See header file for more information 591 * @endinternal 592 */ 593 nlohmann::json couldNotEstablishConnection(const std::string& arg1) 594 { 595 return nlohmann::json{ 596 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 597 {"MessageId", "Base.1.2.0.CouldNotEstablishConnection"}, 598 {"Message", 599 "The service failed to establish a Connection with the URI " + arg1 + 600 "."}, 601 {"Severity", "Critical"}, 602 {"Resolution", "Ensure that the URI contains a valid and reachable " 603 "node name, protocol " 604 "information and other URI components."}}; 605 } 606 607 /** 608 * @internal 609 * @brief Formats PropertyNotWritable message into JSON 610 * 611 * See header file for more information 612 * @endinternal 613 */ 614 nlohmann::json propertyNotWritable(const std::string& arg1) 615 { 616 return nlohmann::json{ 617 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 618 {"MessageId", "Base.1.2.0.PropertyNotWritable"}, 619 {"Message", 620 "The property " + arg1 + 621 " is a read only property and cannot be assigned a value."}, 622 {"Severity", "Warning"}, 623 {"Resolution", "Remove the property from the request body and resubmit " 624 "the request if " 625 "the operation failed."}}; 626 } 627 628 /** 629 * @internal 630 * @brief Formats QueryParameterValueTypeError message into JSON 631 * 632 * See header file for more information 633 * @endinternal 634 */ 635 nlohmann::json queryParameterValueTypeError(const std::string& arg1, 636 const std::string& arg2) 637 { 638 return nlohmann::json{ 639 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 640 {"MessageId", "Base.1.2.0.QueryParameterValueTypeError"}, 641 {"Message", 642 "The value " + arg1 + " for the query parameter " + arg2 + 643 " is of a different type than the parameter can accept."}, 644 {"Severity", "Warning"}, 645 {"Resolution", "Correct the value for the query parameter in the " 646 "request and resubmit " 647 "the request if the operation failed."}}; 648 } 649 650 /** 651 * @internal 652 * @brief Formats ServiceShuttingDown message into JSON 653 * 654 * See header file for more information 655 * @endinternal 656 */ 657 nlohmann::json serviceShuttingDown() 658 { 659 return nlohmann::json{ 660 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 661 {"MessageId", "Base.1.2.0.ServiceShuttingDown"}, 662 {"Message", 663 "The operation failed because the service is shutting down and can no " 664 "longer take incoming requests."}, 665 {"Severity", "Critical"}, 666 {"Resolution", 667 "When the service becomes available, resubmit the request if the " 668 "operation failed."}}; 669 } 670 671 /** 672 * @internal 673 * @brief Formats ActionParameterDuplicate message into JSON 674 * 675 * See header file for more information 676 * @endinternal 677 */ 678 nlohmann::json actionParameterDuplicate(const std::string& arg1, 679 const std::string& arg2) 680 { 681 return nlohmann::json{ 682 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 683 {"MessageId", "Base.1.2.0.ActionParameterDuplicate"}, 684 {"Message", 685 "The action " + arg1 + 686 " was submitted with more than one value for the parameter " + 687 arg2 + "."}, 688 {"Severity", "Warning"}, 689 {"Resolution", 690 "Resubmit the action with only one instance of the parameter in the " 691 "request body if the operation failed."}}; 692 } 693 694 /** 695 * @internal 696 * @brief Formats ActionParameterNotSupported message into JSON 697 * 698 * See header file for more information 699 * @endinternal 700 */ 701 nlohmann::json actionParameterNotSupported(const std::string& arg1, 702 const std::string& arg2) 703 { 704 return nlohmann::json{ 705 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 706 {"MessageId", "Base.1.2.0.ActionParameterNotSupported"}, 707 {"Message", "The parameter " + arg1 + " for the action " + arg2 + 708 " is not supported on the target resource."}, 709 {"Severity", "Warning"}, 710 {"Resolution", 711 "Remove the parameter supplied and resubmit the request if the " 712 "operation failed."}}; 713 } 714 715 /** 716 * @internal 717 * @brief Formats SourceDoesNotSupportProtocol message into JSON 718 * 719 * See header file for more information 720 * @endinternal 721 */ 722 nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1, 723 const std::string& arg2) 724 { 725 return nlohmann::json{ 726 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 727 {"MessageId", "Base.1.2.0.SourceDoesNotSupportProtocol"}, 728 {"Message", "The other end of the Connection at " + arg1 + 729 " does not support the specified protocol " + arg2 + 730 "."}, 731 {"Severity", "Critical"}, 732 {"Resolution", "Change protocols or URIs. "}}; 733 } 734 735 /** 736 * @internal 737 * @brief Formats AccountRemoved message into JSON 738 * 739 * See header file for more information 740 * @endinternal 741 */ 742 nlohmann::json accountRemoved() 743 { 744 return nlohmann::json{ 745 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 746 {"MessageId", "Base.1.2.0.AccountRemoved"}, 747 {"Message", "The account was successfully removed."}, 748 {"Severity", "OK"}, 749 {"Resolution", "No resolution is required."}}; 750 } 751 752 /** 753 * @internal 754 * @brief Formats AccessDenied message into JSON 755 * 756 * See header file for more information 757 * @endinternal 758 */ 759 nlohmann::json accessDenied(const std::string& arg1) 760 { 761 return nlohmann::json{ 762 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 763 {"MessageId", "Base.1.2.0.AccessDenied"}, 764 {"Message", "While attempting to establish a Connection to " + arg1 + 765 ", the service denied access."}, 766 {"Severity", "Critical"}, 767 {"Resolution", "Attempt to ensure that the URI is correct and that the " 768 "service has the " 769 "appropriate credentials."}}; 770 } 771 772 /** 773 * @internal 774 * @brief Formats QueryNotSupported message into JSON 775 * 776 * See header file for more information 777 * @endinternal 778 */ 779 nlohmann::json queryNotSupported() 780 { 781 return nlohmann::json{ 782 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 783 {"MessageId", "Base.1.2.0.QueryNotSupported"}, 784 {"Message", "Querying is not supported by the implementation."}, 785 {"Severity", "Warning"}, 786 {"Resolution", "Remove the query parameters and resubmit the request " 787 "if the operation " 788 "failed."}}; 789 } 790 791 /** 792 * @internal 793 * @brief Formats CreateLimitReachedForResource message into JSON 794 * 795 * See header file for more information 796 * @endinternal 797 */ 798 nlohmann::json createLimitReachedForResource() 799 { 800 return nlohmann::json{ 801 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 802 {"MessageId", "Base.1.2.0.CreateLimitReachedForResource"}, 803 {"Message", "The create operation failed because the resource has " 804 "reached the limit " 805 "of possible resources."}, 806 {"Severity", "Critical"}, 807 {"Resolution", 808 "Either delete resources and resubmit the request if the operation " 809 "failed or do not resubmit the request."}}; 810 } 811 812 /** 813 * @internal 814 * @brief Formats GeneralError message into JSON 815 * 816 * See header file for more information 817 * @endinternal 818 */ 819 nlohmann::json generalError() 820 { 821 return nlohmann::json{ 822 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 823 {"MessageId", "Base.1.2.0.GeneralError"}, 824 {"Message", "A general error has occurred. See ExtendedInfo for more " 825 "information."}, 826 {"Severity", "Critical"}, 827 {"Resolution", "See ExtendedInfo for more information."}}; 828 } 829 830 /** 831 * @internal 832 * @brief Formats Success message into JSON 833 * 834 * See header file for more information 835 * @endinternal 836 */ 837 nlohmann::json success() 838 { 839 return nlohmann::json{ 840 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 841 {"MessageId", "Base.1.2.0.Success"}, 842 {"Message", "Successfully Completed Request"}, 843 {"Severity", "OK"}, 844 {"Resolution", "None"}}; 845 } 846 847 /** 848 * @internal 849 * @brief Formats Created message into JSON 850 * 851 * See header file for more information 852 * @endinternal 853 */ 854 nlohmann::json created() 855 { 856 return nlohmann::json{ 857 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 858 {"MessageId", "Base.1.2.0.Created"}, 859 {"Message", "The resource has been created successfully"}, 860 {"Severity", "OK"}, 861 {"Resolution", "None"}}; 862 } 863 864 /** 865 * @internal 866 * @brief Formats PropertyUnknown message into JSON 867 * 868 * See header file for more information 869 * @endinternal 870 */ 871 nlohmann::json propertyUnknown(const std::string& arg1) 872 { 873 return nlohmann::json{ 874 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 875 {"MessageId", "Base.1.2.0.PropertyUnknown"}, 876 {"Message", 877 "The property " + arg1 + 878 " is not in the list of valid properties for the resource."}, 879 {"Severity", "Warning"}, 880 {"Resolution", 881 "Remove the unknown property from the request body and resubmit the " 882 "request if the operation failed."}}; 883 } 884 885 /** 886 * @internal 887 * @brief Formats NoValidSession message into JSON 888 * 889 * See header file for more information 890 * @endinternal 891 */ 892 nlohmann::json noValidSession() 893 { 894 return nlohmann::json{ 895 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 896 {"MessageId", "Base.1.2.0.NoValidSession"}, 897 {"Message", 898 "There is no valid session established with the implementation."}, 899 {"Severity", "Critical"}, 900 {"Resolution", 901 "Establish as session before attempting any operations."}}; 902 } 903 904 /** 905 * @internal 906 * @brief Formats InvalidObject message into JSON 907 * 908 * See header file for more information 909 * @endinternal 910 */ 911 nlohmann::json invalidObject(const std::string& arg1) 912 { 913 return nlohmann::json{ 914 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 915 {"MessageId", "Base.1.2.0.InvalidObject"}, 916 {"Message", "The object at " + arg1 + " is invalid."}, 917 {"Severity", "Critical"}, 918 {"Resolution", "Either the object is malformed or the URI is not " 919 "correct. Correct the " 920 "condition and resubmit the request if it failed."}}; 921 } 922 923 /** 924 * @internal 925 * @brief Formats ResourceInStandby message into JSON 926 * 927 * See header file for more information 928 * @endinternal 929 */ 930 nlohmann::json resourceInStandby() 931 { 932 return nlohmann::json{ 933 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 934 {"MessageId", "Base.1.2.0.ResourceInStandby"}, 935 {"Message", 936 "The request could not be performed because the resource is in " 937 "standby."}, 938 {"Severity", "Critical"}, 939 {"Resolution", 940 "Ensure that the resource is in the correct power state and resubmit " 941 "the request."}}; 942 } 943 944 /** 945 * @internal 946 * @brief Formats ActionParameterValueTypeError message into JSON 947 * 948 * See header file for more information 949 * @endinternal 950 */ 951 nlohmann::json actionParameterValueTypeError(const std::string& arg1, 952 const std::string& arg2, 953 const std::string& arg3) 954 { 955 return nlohmann::json{ 956 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 957 {"MessageId", "Base.1.2.0.ActionParameterValueTypeError"}, 958 {"Message", 959 "The value " + arg1 + " for the parameter " + arg2 + 960 " in the action " + arg3 + 961 " is of a different type than the parameter can accept."}, 962 {"Severity", "Warning"}, 963 {"Resolution", 964 "Correct the value for the parameter in the request body and resubmit " 965 "the request if the operation failed."}}; 966 } 967 968 /** 969 * @internal 970 * @brief Formats SessionLimitExceeded message into JSON 971 * 972 * See header file for more information 973 * @endinternal 974 */ 975 nlohmann::json sessionLimitExceeded() 976 { 977 return nlohmann::json{ 978 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 979 {"MessageId", "Base.1.2.0.SessionLimitExceeded"}, 980 {"Message", 981 "The session establishment failed due to the number of simultaneous " 982 "sessions exceeding the limit of the implementation."}, 983 {"Severity", "Critical"}, 984 {"Resolution", 985 "Reduce the number of other sessions before trying to establish the " 986 "session or increase the limit of simultaneous sessions (if " 987 "supported)."}}; 988 } 989 990 /** 991 * @internal 992 * @brief Formats ActionNotSupported message into JSON 993 * 994 * See header file for more information 995 * @endinternal 996 */ 997 nlohmann::json actionNotSupported(const std::string& arg1) 998 { 999 return nlohmann::json{ 1000 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1001 {"MessageId", "Base.1.2.0.ActionNotSupported"}, 1002 {"Message", 1003 "The action " + arg1 + " is not supported by the resource."}, 1004 {"Severity", "Critical"}, 1005 {"Resolution", 1006 "The action supplied cannot be resubmitted to the implementation. " 1007 "Perhaps the action was invalid, the wrong resource was the target or " 1008 "the implementation documentation may be of assistance."}}; 1009 } 1010 1011 /** 1012 * @internal 1013 * @brief Formats InvalidIndex message into JSON 1014 * 1015 * See header file for more information 1016 * @endinternal 1017 */ 1018 nlohmann::json invalidIndex(const int& arg1) 1019 { 1020 return nlohmann::json{ 1021 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1022 {"MessageId", "Base.1.2.0.InvalidIndex"}, 1023 {"Message", "The index " + std::to_string(arg1) + 1024 " is not a valid offset into the array."}, 1025 {"Severity", "Warning"}, 1026 {"Resolution", 1027 "Verify the index value provided is within the bounds of the array."}}; 1028 } 1029 1030 /** 1031 * @internal 1032 * @brief Formats EmptyJSON message into JSON 1033 * 1034 * See header file for more information 1035 * @endinternal 1036 */ 1037 nlohmann::json emptyJSON() 1038 { 1039 return nlohmann::json{ 1040 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1041 {"MessageId", "Base.1.2.0.EmptyJSON"}, 1042 {"Message", 1043 "The request body submitted contained an empty JSON object and the " 1044 "service is unable to process it."}, 1045 {"Severity", "Warning"}, 1046 {"Resolution", 1047 "Add properties in the JSON object and resubmit the request."}}; 1048 } 1049 1050 /** 1051 * @internal 1052 * @brief Formats QueryNotSupportedOnResource message into JSON 1053 * 1054 * See header file for more information 1055 * @endinternal 1056 */ 1057 nlohmann::json queryNotSupportedOnResource() 1058 { 1059 return nlohmann::json{ 1060 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1061 {"MessageId", "Base.1.2.0.QueryNotSupportedOnResource"}, 1062 {"Message", "Querying is not supported on the requested resource."}, 1063 {"Severity", "Warning"}, 1064 {"Resolution", "Remove the query parameters and resubmit the request " 1065 "if the operation " 1066 "failed."}}; 1067 } 1068 1069 /** 1070 * @internal 1071 * @brief Formats InsufficientPrivilege message into JSON 1072 * 1073 * See header file for more information 1074 * @endinternal 1075 */ 1076 nlohmann::json insufficientPrivilege() 1077 { 1078 return nlohmann::json{ 1079 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1080 {"MessageId", "Base.1.2.0.InsufficientPrivilege"}, 1081 {"Message", 1082 "There are insufficient privileges for the account or credentials " 1083 "associated with the current session to perform the requested " 1084 "operation."}, 1085 {"Severity", "Critical"}, 1086 {"Resolution", 1087 "Either abandon the operation or change the associated access rights " 1088 "and resubmit the request if the operation failed."}}; 1089 } 1090 1091 /** 1092 * @internal 1093 * @brief Formats PropertyValueModified message into JSON 1094 * 1095 * See header file for more information 1096 * @endinternal 1097 */ 1098 nlohmann::json propertyValueModified(const std::string& arg1, 1099 const std::string& arg2) 1100 { 1101 return nlohmann::json{ 1102 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1103 {"MessageId", "Base.1.2.0.PropertyValueModified"}, 1104 {"Message", "The property " + arg1 + " was assigned the value " + arg2 + 1105 " due to modification by the service."}, 1106 {"Severity", "Warning"}, 1107 {"Resolution", "No resolution is required."}}; 1108 } 1109 1110 /** 1111 * @internal 1112 * @brief Formats AccountNotModified message into JSON 1113 * 1114 * See header file for more information 1115 * @endinternal 1116 */ 1117 nlohmann::json accountNotModified() 1118 { 1119 return nlohmann::json{ 1120 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1121 {"MessageId", "Base.1.2.0.AccountNotModified"}, 1122 {"Message", "The account modification request failed."}, 1123 {"Severity", "Warning"}, 1124 {"Resolution", 1125 "The modification may have failed due to permission issues or issues " 1126 "with the request body."}}; 1127 } 1128 1129 /** 1130 * @internal 1131 * @brief Formats QueryParameterValueFormatError message into JSON 1132 * 1133 * See header file for more information 1134 * @endinternal 1135 */ 1136 nlohmann::json queryParameterValueFormatError(const std::string& arg1, 1137 const std::string& arg2) 1138 { 1139 return nlohmann::json{ 1140 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1141 {"MessageId", "Base.1.2.0.QueryParameterValueFormatError"}, 1142 {"Message", 1143 "The value " + arg1 + " for the parameter " + arg2 + 1144 " is of a different format than the parameter can accept."}, 1145 {"Severity", "Warning"}, 1146 {"Resolution", "Correct the value for the query parameter in the " 1147 "request and resubmit " 1148 "the request if the operation failed."}}; 1149 } 1150 1151 /** 1152 * @internal 1153 * @brief Formats PropertyMissing message into JSON 1154 * 1155 * See header file for more information 1156 * @endinternal 1157 */ 1158 nlohmann::json propertyMissing(const std::string& arg1) 1159 { 1160 return nlohmann::json{ 1161 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1162 {"MessageId", "Base.1.2.0.PropertyMissing"}, 1163 {"Message", 1164 "The property " + arg1 + 1165 " is a required property and must be included in the request."}, 1166 {"Severity", "Warning"}, 1167 {"Resolution", "Ensure that the property is in the request body and " 1168 "has a valid value " 1169 "and resubmit the request if the operation failed."}}; 1170 } 1171 1172 /** 1173 * @internal 1174 * @brief Formats ResourceExhaustion message into JSON 1175 * 1176 * See header file for more information 1177 * @endinternal 1178 */ 1179 nlohmann::json resourceExhaustion(const std::string& arg1) 1180 { 1181 return nlohmann::json{ 1182 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1183 {"MessageId", "Base.1.2.0.ResourceExhaustion"}, 1184 {"Message", "The resource " + arg1 + 1185 " was unable to satisfy the request " 1186 "due to unavailability of " 1187 "resources."}, 1188 {"Severity", "Critical"}, 1189 {"Resolution", 1190 "Ensure that the resources are available and resubmit the request."}}; 1191 } 1192 1193 /** 1194 * @internal 1195 * @brief Formats AccountModified message into JSON 1196 * 1197 * See header file for more information 1198 * @endinternal 1199 */ 1200 nlohmann::json accountModified() 1201 { 1202 return nlohmann::json{ 1203 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1204 {"MessageId", "Base.1.2.0.AccountModified"}, 1205 {"Message", "The account was successfully modified."}, 1206 {"Severity", "OK"}, 1207 {"Resolution", "No resolution is required."}}; 1208 } 1209 1210 /** 1211 * @internal 1212 * @brief Formats QueryParameterOutOfRange message into JSON 1213 * 1214 * See header file for more information 1215 * @endinternal 1216 */ 1217 nlohmann::json queryParameterOutOfRange(const std::string& arg1, 1218 const std::string& arg2, 1219 const std::string& arg3) 1220 { 1221 return nlohmann::json{ 1222 {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"}, 1223 {"MessageId", "Base.1.2.0.QueryParameterOutOfRange"}, 1224 {"Message", "The value " + arg1 + " for the query parameter " + arg2 + 1225 " is out of range " + arg3 + "."}, 1226 {"Severity", "Warning"}, 1227 {"Resolution", 1228 "Reduce the value for the query parameter to a value that is within " 1229 "range, such as a start or count value that is within bounds of the " 1230 "number of resources in a collection or a page that is within the " 1231 "range " 1232 "of valid pages."}}; 1233 } 1234 1235 /********************************* 1236 * AUTOGENERATED FUNCTIONS END * 1237 *********************************/ 1238 1239 } // namespace messages 1240 1241 } // namespace redfish 1242