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