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 #pragma once 17 #include "http_response.hpp" 18 19 #include <boost/url/urls.hpp> 20 #include <nlohmann/json.hpp> 21 #include <source_location.hpp> 22 23 #include <string> 24 25 namespace redfish 26 { 27 28 namespace messages 29 { 30 31 constexpr const char* messageVersionPrefix = "Base.1.11.0."; 32 constexpr const char* messageAnnotation = "@Message.ExtendedInfo"; 33 34 /** 35 * @brief Formats ResourceInUse message into JSON 36 * Message body: "The change to the requested resource failed because the 37 * resource is in use or in transition." 38 * 39 * 40 * @returns Message ResourceInUse formatted to JSON */ 41 nlohmann::json resourceInUse(); 42 43 void resourceInUse(crow::Response& res); 44 45 /** 46 * @brief Formats MalformedJSON message into JSON 47 * Message body: "The request body submitted was malformed JSON and could not be 48 * parsed by the receiving service." 49 * 50 * 51 * @returns Message MalformedJSON formatted to JSON */ 52 nlohmann::json malformedJSON(); 53 54 void malformedJSON(crow::Response& res); 55 56 /** 57 * @brief Formats ResourceMissingAtURI message into JSON 58 * Message body: "The resource at the URI <arg1> was not found." 59 * 60 * @param[in] arg1 Parameter of message that will replace %1 in its body. 61 * 62 * @returns Message ResourceMissingAtURI formatted to JSON */ 63 nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1); 64 65 void resourceMissingAtURI(crow::Response& res, 66 const boost::urls::url_view& arg1); 67 68 /** 69 * @brief Formats ActionParameterValueFormatError message into JSON 70 * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3> 71 * is of a different format than the parameter can accept." 72 * 73 * @param[in] arg1 Parameter of message that will replace %1 in its body. 74 * @param[in] arg2 Parameter of message that will replace %2 in its body. 75 * @param[in] arg3 Parameter of message that will replace %3 in its body. 76 * 77 * @returns Message ActionParameterValueFormatError formatted to JSON */ 78 nlohmann::json actionParameterValueFormatError(std::string_view arg1, 79 std::string_view arg2, 80 std::string_view arg3); 81 82 void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 83 std::string_view arg2, 84 std::string_view arg3); 85 86 /** 87 * @brief Formats InternalError message into JSON 88 * Message body: "The request failed due to an internal service error. The 89 * service is still operational." 90 * 91 * 92 * @returns Message InternalError formatted to JSON */ 93 nlohmann::json internalError(); 94 95 void internalError(crow::Response& res, bmcweb::source_location location = 96 bmcweb::source_location::current()); 97 98 /** 99 * @brief Formats UnrecognizedRequestBody message into JSON 100 * Message body: "The service detected a malformed request body that it was 101 * unable to interpret." 102 * 103 * 104 * @returns Message UnrecognizedRequestBody formatted to JSON */ 105 nlohmann::json unrecognizedRequestBody(); 106 107 void unrecognizedRequestBody(crow::Response& res); 108 109 /** 110 * @brief Formats ResourceAtUriUnauthorized message into JSON 111 * Message body: "While accessing the resource at <arg1>, the service received 112 * an authorization error <arg2>." 113 * 114 * @param[in] arg1 Parameter of message that will replace %1 in its body. 115 * @param[in] arg2 Parameter of message that will replace %2 in its body. 116 * 117 * @returns Message ResourceAtUriUnauthorized formatted to JSON */ 118 nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 119 std::string_view arg2); 120 121 void resourceAtUriUnauthorized(crow::Response& res, 122 const boost::urls::url_view& arg1, 123 std::string_view arg2); 124 125 /** 126 * @brief Formats ActionParameterUnknown message into JSON 127 * Message body: "The action <arg1> was submitted with the invalid parameter 128 * <arg2>." 129 * 130 * @param[in] arg1 Parameter of message that will replace %1 in its body. 131 * @param[in] arg2 Parameter of message that will replace %2 in its body. 132 * 133 * @returns Message ActionParameterUnknown formatted to JSON */ 134 nlohmann::json actionParameterUnknown(std::string_view arg1, 135 std::string_view arg2); 136 137 void actionParameterUnknown(crow::Response& res, std::string_view arg1, 138 std::string_view arg2); 139 140 /** 141 * @brief Formats ResourceCannotBeDeleted message into JSON 142 * Message body: "The delete request failed because the resource requested 143 * cannot be deleted." 144 * 145 * 146 * @returns Message ResourceCannotBeDeleted formatted to JSON */ 147 nlohmann::json resourceCannotBeDeleted(); 148 149 void resourceCannotBeDeleted(crow::Response& res); 150 151 /** 152 * @brief Formats PropertyDuplicate message into JSON 153 * Message body: "The property <arg1> was duplicated in the request." 154 * 155 * @param[in] arg1 Parameter of message that will replace %1 in its body. 156 * 157 * @returns Message PropertyDuplicate formatted to JSON */ 158 nlohmann::json propertyDuplicate(std::string_view arg1); 159 160 void propertyDuplicate(crow::Response& res, std::string_view arg1); 161 162 /** 163 * @brief Formats ServiceTemporarilyUnavailable message into JSON 164 * Message body: "The service is temporarily unavailable. Retry in <arg1> 165 * seconds." 166 * 167 * @param[in] arg1 Parameter of message that will replace %1 in its body. 168 * 169 * @returns Message ServiceTemporarilyUnavailable formatted to JSON */ 170 nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1); 171 172 void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1); 173 174 /** 175 * @brief Formats ResourceAlreadyExists message into JSON 176 * Message body: "The requested resource of type <arg1> with the property <arg2> 177 * with the value <arg3> already exists." 178 * 179 * @param[in] arg1 Parameter of message that will replace %1 in its body. 180 * @param[in] arg2 Parameter of message that will replace %2 in its body. 181 * @param[in] arg3 Parameter of message that will replace %3 in its body. 182 * 183 * @returns Message ResourceAlreadyExists formatted to JSON */ 184 nlohmann::json resourceAlreadyExists(std::string_view arg1, 185 std::string_view arg2, 186 std::string_view arg3); 187 188 void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 189 std::string_view arg2, std::string_view arg3); 190 191 /** 192 * @brief Formats AccountForSessionNoLongerExists message into JSON 193 * Message body: "The account for the current session has been removed, thus the 194 * current session has been removed as well." 195 * 196 * 197 * @returns Message AccountForSessionNoLongerExists formatted to JSON */ 198 nlohmann::json accountForSessionNoLongerExists(); 199 200 void accountForSessionNoLongerExists(crow::Response& res); 201 202 /** 203 * @brief Formats CreateFailedMissingReqProperties message into JSON 204 * Message body: "The create operation failed because the required property 205 * <arg1> was missing from the request." 206 * 207 * @param[in] arg1 Parameter of message that will replace %1 in its body. 208 * 209 * @returns Message CreateFailedMissingReqProperties formatted to JSON */ 210 nlohmann::json createFailedMissingReqProperties(std::string_view arg1); 211 212 void createFailedMissingReqProperties(crow::Response& res, 213 std::string_view arg1); 214 215 /** 216 * @brief Formats PropertyValueFormatError message into JSON 217 * Message body: "The value <arg1> for the property <arg2> is of a different 218 * format than the property can accept." 219 * 220 * @param[in] arg1 Parameter of message that will replace %1 in its body. 221 * @param[in] arg2 Parameter of message that will replace %2 in its body. 222 * 223 * @returns Message PropertyValueFormatError formatted to JSON */ 224 nlohmann::json propertyValueFormatError(std::string_view arg1, 225 std::string_view arg2); 226 227 void propertyValueFormatError(crow::Response& res, std::string_view arg1, 228 std::string_view arg2); 229 230 /** 231 * @brief Formats PropertyValueNotInList message into JSON 232 * Message body: "The value <arg1> for the property <arg2> is not in the list of 233 * acceptable values." 234 * 235 * @param[in] arg1 Parameter of message that will replace %1 in its body. 236 * @param[in] arg2 Parameter of message that will replace %2 in its body. 237 * 238 * @returns Message PropertyValueNotInList formatted to JSON */ 239 nlohmann::json propertyValueNotInList(std::string_view arg1, 240 std::string_view arg2); 241 242 void propertyValueNotInList(crow::Response& res, std::string_view arg1, 243 std::string_view arg2); 244 245 /** 246 * @brief Formats ResourceAtUriInUnknownFormat message into JSON 247 * Message body: "The resource at <arg1> is in a format not recognized by the 248 * service." 249 * 250 * @param[in] arg1 Parameter of message that will replace %1 in its body. 251 * 252 * @returns Message ResourceAtUriInUnknownFormat formatted to JSON */ 253 nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1); 254 255 void resourceAtUriInUnknownFormat(crow::Response& res, 256 const boost::urls::url_view& arg1); 257 258 /** 259 * @brief Formats ServiceDisabled message into JSON 260 * Message body: "The operation failed because the service at <arg1> is disabled 261 * and " cannot accept requests." 262 * 263 * @param[in] arg1 Parameter of message that will replace %1 in its body. 264 * 265 * @returns Message ServiceDisabled formatted to JSON */ 266 nlohmann::json serviceDisabled(std::string_view arg1); 267 268 void serviceDisabled(crow::Response& res, std::string_view arg1); 269 270 /** 271 * @brief Formats ServiceInUnknownState message into JSON 272 * Message body: "The operation failed because the service is in an unknown 273 * state and can no longer take incoming requests." 274 * 275 * 276 * @returns Message ServiceInUnknownState formatted to JSON */ 277 nlohmann::json serviceInUnknownState(); 278 279 void serviceInUnknownState(crow::Response& res); 280 281 /** 282 * @brief Formats EventSubscriptionLimitExceeded message into JSON 283 * Message body: "The event subscription failed due to the number of 284 * simultaneous subscriptions exceeding the limit of the implementation." 285 * 286 * 287 * @returns Message EventSubscriptionLimitExceeded formatted to JSON */ 288 nlohmann::json eventSubscriptionLimitExceeded(); 289 290 void eventSubscriptionLimitExceeded(crow::Response& res); 291 292 /** 293 * @brief Formats ActionParameterMissing message into JSON 294 * Message body: "The action <arg1> requires the parameter <arg2> to be present 295 * in the request body." 296 * 297 * @param[in] arg1 Parameter of message that will replace %1 in its body. 298 * @param[in] arg2 Parameter of message that will replace %2 in its body. 299 * 300 * @returns Message ActionParameterMissing formatted to JSON */ 301 nlohmann::json actionParameterMissing(std::string_view arg1, 302 std::string_view arg2); 303 304 void actionParameterMissing(crow::Response& res, std::string_view arg1, 305 std::string_view arg2); 306 307 /** 308 * @brief Formats StringValueTooLong message into JSON 309 * Message body: "The string <arg1> exceeds the length limit <arg2>." 310 * 311 * @param[in] arg1 Parameter of message that will replace %1 in its body. 312 * @param[in] arg2 Parameter of message that will replace %2 in its body. 313 * 314 * @returns Message StringValueTooLong formatted to JSON */ 315 nlohmann::json stringValueTooLong(std::string_view arg1, int arg2); 316 317 void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2); 318 319 /** 320 * @brief Formats SessionTerminated message into JSON 321 * Message body: "The session was successfully terminated." 322 * 323 * 324 * @returns Message SessionTerminated formatted to JSON */ 325 nlohmann::json sessionTerminated(); 326 327 void sessionTerminated(crow::Response& res); 328 329 /** 330 * @brief Formats SubscriptionTerminated message into JSON 331 * Message body: "The event subscription has been terminated." 332 * 333 * 334 * @returns Message SubscriptionTerminated formatted to JSON */ 335 nlohmann::json subscriptionTerminated(); 336 337 void subscriptionTerminated(crow::Response& res); 338 339 /** 340 * @brief Formats ResourceTypeIncompatible message into JSON 341 * Message body: "The @odata.type of the request body <arg1> is incompatible 342 * with the @odata.type of the resource which is <arg2>." 343 * 344 * @param[in] arg1 Parameter of message that will replace %1 in its body. 345 * @param[in] arg2 Parameter of message that will replace %2 in its body. 346 * 347 * @returns Message ResourceTypeIncompatible formatted to JSON */ 348 nlohmann::json resourceTypeIncompatible(std::string_view arg1, 349 std::string_view arg2); 350 351 void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 352 std::string_view arg2); 353 354 /** 355 * @brief Formats ResetRequired message into JSON 356 * Message body: "In order to complete the operation, a component reset is 357 * required with the Reset action URI '<arg1>' and ResetType '<arg2>'." 358 * 359 * @param[in] arg1 Parameter of message that will replace %1 in its body. 360 * @param[in] arg2 Parameter of message that will replace %2 in its body. 361 * 362 * @returns Message ResetRequired formatted to JSON */ 363 nlohmann::json resetRequired(const boost::urls::url_view& arg1, 364 std::string_view arg2); 365 366 void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 367 std::string_view arg2); 368 369 /** 370 * @brief Formats ChassisPowerStateOnRequired message into JSON 371 * Message body: "The Chassis with Id '<arg1>' requires to be powered on to 372 * perform this request." 373 * 374 * @param[in] arg1 Parameter of message that will replace %1 in its body. 375 * 376 * @returns Message ChassisPowerStateOnRequired formatted to JSON */ 377 nlohmann::json chassisPowerStateOnRequired(std::string_view arg1); 378 379 void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1); 380 381 /** 382 * @brief Formats ChassisPowerStateOffRequired message into JSON 383 * Message body: "The Chassis with Id '<arg1>' requires to be powered off to 384 * perform this request." 385 * 386 * @param[in] arg1 Parameter of message that will replace %1 in its body. 387 * 388 * @returns Message ChassisPowerStateOffRequired formatted to JSON */ 389 nlohmann::json chassisPowerStateOffRequired(std::string_view arg1); 390 391 void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1); 392 393 /** 394 * @brief Formats PropertyValueConflict message into JSON 395 * Message body: "The property '<arg1>' could not be written because its value 396 * would conflict with the value of the '<arg2>' property." 397 * 398 * @param[in] arg1 Parameter of message that will replace %1 in its body. 399 * @param[in] arg2 Parameter of message that will replace %2 in its body. 400 * 401 * @returns Message PropertyValueConflict formatted to JSON */ 402 nlohmann::json propertyValueConflict(std::string_view arg1, 403 std::string_view arg2); 404 405 void propertyValueConflict(crow::Response& res, std::string_view arg1, 406 std::string_view arg2); 407 408 /** 409 * @brief Formats PropertyValueIncorrect message into JSON 410 * Message body: "The property '<arg1>' with the requested value of '<arg2>' 411 * could not be written because the value does not meet the constraints of the 412 * implementation." 413 * 414 * @param[in] arg1 Parameter of message that will replace %1 in its body. 415 * @param[in] arg2 Parameter of message that will replace %2 in its body. 416 * 417 * @returns Message PropertyValueIncorrect formatted to JSON */ 418 nlohmann::json propertyValueIncorrect(std::string_view arg1, 419 std::string_view arg2); 420 421 void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 422 std::string_view arg2); 423 424 /** 425 * @brief Formats ResourceCreationConflict message into JSON 426 * Message body: "The resource could not be created. The service has a resource 427 * at URI '<arg1>' that conflicts with the creation request." 428 * 429 * @param[in] arg1 Parameter of message that will replace %1 in its body. 430 * 431 * @returns Message ResourceCreationConflict formatted to JSON */ 432 nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1); 433 434 void resourceCreationConflict(crow::Response& res, 435 const boost::urls::url_view& arg1); 436 437 /** 438 * @brief Formats MaximumErrorsExceeded message into JSON 439 * Message body: "Too many errors have occurred to report them all." 440 * 441 * 442 * @returns Message MaximumErrorsExceeded formatted to JSON */ 443 nlohmann::json maximumErrorsExceeded(); 444 445 void maximumErrorsExceeded(crow::Response& res); 446 447 /** 448 * @brief Formats PreconditionFailed message into JSON 449 * Message body: "The ETag supplied did not match the ETag required to change 450 * this resource." 451 * 452 * 453 * @returns Message PreconditionFailed formatted to JSON */ 454 nlohmann::json preconditionFailed(); 455 456 void preconditionFailed(crow::Response& res); 457 458 /** 459 * @brief Formats PreconditionRequired message into JSON 460 * Message body: "A precondition header or annotation is required to change this 461 * resource." 462 * 463 * 464 * @returns Message PreconditionRequired formatted to JSON */ 465 nlohmann::json preconditionRequired(); 466 467 void preconditionRequired(crow::Response& res); 468 469 /** 470 * @brief Formats OperationFailed message into JSON 471 * Message body: "An error occurred internal to the service as part of the 472 * overall request. Partial results may have been returned." 473 * 474 * 475 * @returns Message OperationFailed formatted to JSON */ 476 nlohmann::json operationFailed(); 477 478 void operationFailed(crow::Response& res); 479 480 /** 481 * @brief Formats OperationTimeout message into JSON 482 * Message body: "A timeout internal to the service occured as part of the 483 * request. Partial results may have been returned." 484 * 485 * 486 * @returns Message OperationTimeout formatted to JSON */ 487 nlohmann::json operationTimeout(); 488 489 void operationTimeout(crow::Response& res); 490 491 /** 492 * @brief Formats PropertyValueTypeError message into JSON 493 * Message body: "The value <arg1> for the property <arg2> is of a different 494 * type than the property can accept." 495 * 496 * @param[in] arg1 Parameter of message that will replace %1 in its body. 497 * @param[in] arg2 Parameter of message that will replace %2 in its body. 498 * 499 * @returns Message PropertyValueTypeError formatted to JSON */ 500 nlohmann::json propertyValueTypeError(std::string_view arg1, 501 std::string_view arg2); 502 503 void propertyValueTypeError(crow::Response& res, std::string_view arg1, 504 std::string_view arg2); 505 506 /** 507 * @brief Formats ResourceNotFound message into JSON 508 * Message body: "The requested resource of type <arg1> named <arg2> was not 509 * found." 510 * 511 * @param[in] arg1 Parameter of message that will replace %1 in its body. 512 * @param[in] arg2 Parameter of message that will replace %2 in its body. 513 * 514 * @returns Message ResourceNotFound formatted to JSON */ 515 nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2); 516 517 void resourceNotFound(crow::Response& res, std::string_view arg1, 518 std::string_view arg2); 519 520 /** 521 * @brief Formats CouldNotEstablishConnection message into JSON 522 * Message body: "The service failed to establish a Connection with the URI 523 * <arg1>." 524 * 525 * @param[in] arg1 Parameter of message that will replace %1 in its body. 526 * 527 * @returns Message CouldNotEstablishConnection formatted to JSON */ 528 nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1); 529 530 void couldNotEstablishConnection(crow::Response& res, 531 const boost::urls::url_view& arg1); 532 533 /** 534 * @brief Formats PropertyNotWritable message into JSON 535 * Message body: "The property <arg1> is a read only property and cannot be 536 * assigned a value." 537 * 538 * @param[in] arg1 Parameter of message that will replace %1 in its body. 539 * 540 * @returns Message PropertyNotWritable formatted to JSON */ 541 nlohmann::json propertyNotWritable(std::string_view arg1); 542 543 void propertyNotWritable(crow::Response& res, std::string_view arg1); 544 545 /** 546 * @brief Formats QueryParameterValueTypeError message into JSON 547 * Message body: "The value <arg1> for the query parameter <arg2> is of a 548 * different type than the parameter can accept." 549 * 550 * @param[in] arg1 Parameter of message that will replace %1 in its body. 551 * @param[in] arg2 Parameter of message that will replace %2 in its body. 552 * 553 * @returns Message QueryParameterValueTypeError formatted to JSON */ 554 nlohmann::json queryParameterValueTypeError(std::string_view arg1, 555 std::string_view arg2); 556 557 void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 558 std::string_view arg2); 559 560 /** 561 * @brief Formats ServiceShuttingDown message into JSON 562 * Message body: "The operation failed because the service is shutting down and 563 * can no longer take incoming requests." 564 * 565 * 566 * @returns Message ServiceShuttingDown formatted to JSON */ 567 nlohmann::json serviceShuttingDown(); 568 569 void serviceShuttingDown(crow::Response& res); 570 571 /** 572 * @brief Formats ActionParameterDuplicate message into JSON 573 * Message body: "The action <arg1> was submitted with more than one value for 574 * the parameter <arg2>." 575 * 576 * @param[in] arg1 Parameter of message that will replace %1 in its body. 577 * @param[in] arg2 Parameter of message that will replace %2 in its body. 578 * 579 * @returns Message ActionParameterDuplicate formatted to JSON */ 580 nlohmann::json actionParameterDuplicate(std::string_view arg1, 581 std::string_view arg2); 582 583 void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 584 std::string_view arg2); 585 586 /** 587 * @brief Formats ActionParameterNotSupported message into JSON 588 * Message body: "The parameter <arg1> for the action <arg2> is not supported on 589 * the target resource." 590 * 591 * @param[in] arg1 Parameter of message that will replace %1 in its body. 592 * @param[in] arg2 Parameter of message that will replace %2 in its body. 593 * 594 * @returns Message ActionParameterNotSupported formatted to JSON */ 595 nlohmann::json actionParameterNotSupported(std::string_view arg1, 596 std::string_view arg2); 597 598 void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 599 std::string_view arg2); 600 601 /** 602 * @brief Formats SourceDoesNotSupportProtocol message into JSON 603 * Message body: "The other end of the Connection at <arg1> does not support the 604 * specified protocol <arg2>." 605 * 606 * @param[in] arg1 Parameter of message that will replace %1 in its body. 607 * @param[in] arg2 Parameter of message that will replace %2 in its body. 608 * 609 * @returns Message SourceDoesNotSupportProtocol formatted to JSON */ 610 nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 611 std::string_view arg2); 612 613 void sourceDoesNotSupportProtocol(crow::Response& res, 614 const boost::urls::url_view& arg1, 615 std::string_view arg2); 616 617 /** 618 * @brief Formats AccountRemoved message into JSON 619 * Message body: "The account was successfully removed." 620 * 621 * 622 * @returns Message AccountRemoved formatted to JSON */ 623 nlohmann::json accountRemoved(); 624 625 void accountRemoved(crow::Response& res); 626 627 /** 628 * @brief Formats AccessDenied message into JSON 629 * Message body: "While attempting to establish a Connection to <arg1>, the 630 * service denied access." 631 * 632 * @param[in] arg1 Parameter of message that will replace %1 in its body. 633 * 634 * @returns Message AccessDenied formatted to JSON */ 635 nlohmann::json accessDenied(const boost::urls::url_view& arg1); 636 637 void accessDenied(crow::Response& res, const boost::urls::url_view& arg1); 638 639 /** 640 * @brief Formats QueryNotSupported message into JSON 641 * Message body: "Querying is not supported by the implementation." 642 * 643 * 644 * @returns Message QueryNotSupported formatted to JSON */ 645 nlohmann::json queryNotSupported(); 646 647 void queryNotSupported(crow::Response& res); 648 649 /** 650 * @brief Formats CreateLimitReachedForResource message into JSON 651 * Message body: "The create operation failed because the resource has reached 652 * the limit of possible resources." 653 * 654 * 655 * @returns Message CreateLimitReachedForResource formatted to JSON */ 656 nlohmann::json createLimitReachedForResource(); 657 658 void createLimitReachedForResource(crow::Response& res); 659 660 /** 661 * @brief Formats GeneralError message into JSON 662 * Message body: "A general error has occurred. See ExtendedInfo for more 663 * information." 664 * 665 * 666 * @returns Message GeneralError formatted to JSON */ 667 nlohmann::json generalError(); 668 669 void generalError(crow::Response& res); 670 671 /** 672 * @brief Formats Success message into JSON 673 * Message body: "Successfully Completed Request" 674 * 675 * 676 * @returns Message Success formatted to JSON */ 677 nlohmann::json success(); 678 679 void success(crow::Response& res); 680 681 /** 682 * @brief Formats Created message into JSON 683 * Message body: "The resource has been created successfully" 684 * 685 * 686 * @returns Message Created formatted to JSON */ 687 nlohmann::json created(); 688 689 void created(crow::Response& res); 690 691 /** 692 * @brief Formats NoOperation message into JSON 693 * Message body: "The request body submitted contain no data to act upon and 694 * no changes to the resource took place." 695 * 696 * 697 * @returns Message NoOperation formatted to JSON */ 698 nlohmann::json noOperation(); 699 700 void noOperation(crow::Response& res); 701 702 /** 703 * @brief Formats PropertyUnknown message into JSON 704 * Message body: "The property <arg1> is not in the list of valid properties for 705 * the resource." 706 * 707 * @param[in] arg1 Parameter of message that will replace %1 in its body. 708 * 709 * @returns Message PropertyUnknown formatted to JSON */ 710 nlohmann::json propertyUnknown(std::string_view arg1); 711 712 void propertyUnknown(crow::Response& res, std::string_view arg1); 713 714 /** 715 * @brief Formats NoValidSession message into JSON 716 * Message body: "There is no valid session established with the 717 * implementation." 718 * 719 * 720 * @returns Message NoValidSession formatted to JSON */ 721 nlohmann::json noValidSession(); 722 723 void noValidSession(crow::Response& res); 724 725 /** 726 * @brief Formats InvalidObject message into JSON 727 * Message body: "The object at <arg1> is invalid." 728 * 729 * @param[in] arg1 Parameter of message that will replace %1 in its body. 730 * 731 * @returns Message InvalidObject formatted to JSON */ 732 nlohmann::json invalidObject(const boost::urls::url_view& arg1); 733 734 void invalidObject(crow::Response& res, const boost::urls::url_view& arg1); 735 736 /** 737 * @brief Formats ResourceInStandby message into JSON 738 * Message body: "The request could not be performed because the resource is in 739 * standby." 740 * 741 * 742 * @returns Message ResourceInStandby formatted to JSON */ 743 nlohmann::json resourceInStandby(); 744 745 void resourceInStandby(crow::Response& res); 746 747 /** 748 * @brief Formats ActionParameterValueTypeError message into JSON 749 * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3> 750 * is of a different type than the parameter can accept." 751 * 752 * @param[in] arg1 Parameter of message that will replace %1 in its body. 753 * @param[in] arg2 Parameter of message that will replace %2 in its body. 754 * @param[in] arg3 Parameter of message that will replace %3 in its body. 755 * 756 * @returns Message ActionParameterValueTypeError formatted to JSON */ 757 nlohmann::json actionParameterValueTypeError(std::string_view arg1, 758 std::string_view arg2, 759 std::string_view arg3); 760 761 void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 762 std::string_view arg2, 763 std::string_view arg3); 764 765 /** 766 * @brief Formats SessionLimitExceeded message into JSON 767 * Message body: "The session establishment failed due to the number of 768 * simultaneous sessions exceeding the limit of the implementation." 769 * 770 * 771 * @returns Message SessionLimitExceeded formatted to JSON */ 772 nlohmann::json sessionLimitExceeded(); 773 774 void sessionLimitExceeded(crow::Response& res); 775 776 /** 777 * @brief Formats ActionNotSupported message into JSON 778 * Message body: "The action <arg1> is not supported by the resource." 779 * 780 * @param[in] arg1 Parameter of message that will replace %1 in its body. 781 * 782 * @returns Message ActionNotSupported formatted to JSON */ 783 nlohmann::json actionNotSupported(std::string_view arg1); 784 785 void actionNotSupported(crow::Response& res, std::string_view arg1); 786 787 /** 788 * @brief Formats InvalidIndex message into JSON 789 * Message body: "The index <arg1> is not a valid offset into the array." 790 * 791 * @param[in] arg1 Parameter of message that will replace %1 in its body. 792 * 793 * @returns Message InvalidIndex formatted to JSON */ 794 nlohmann::json invalidIndex(int64_t arg1); 795 796 void invalidIndex(crow::Response& res, int64_t arg1); 797 798 /** 799 * @brief Formats EmptyJSON message into JSON 800 * Message body: "The request body submitted contained an empty JSON object and 801 * the service is unable to process it." 802 * 803 * 804 * @returns Message EmptyJSON formatted to JSON */ 805 nlohmann::json emptyJSON(); 806 807 void emptyJSON(crow::Response& res); 808 809 /** 810 * @brief Formats QueryNotSupportedOnResource message into JSON 811 * Message body: "Querying is not supported on the requested resource." 812 * 813 * 814 * @returns Message QueryNotSupportedOnResource formatted to JSON */ 815 nlohmann::json queryNotSupportedOnResource(); 816 817 void queryNotSupportedOnResource(crow::Response& res); 818 819 /** 820 * @brief Formats QueryNotSupportedOnOperation message into JSON 821 * Message body: "Querying is not supported with the requested operation." 822 * 823 * 824 * @returns Message QueryNotSupportedOnOperation formatted to JSON */ 825 nlohmann::json queryNotSupportedOnOperation(); 826 827 void queryNotSupportedOnOperation(crow::Response& res); 828 829 /** 830 * @brief Formats QueryCombinationInvalid message into JSON 831 * Message body: "Two or more query parameters in the request cannot be used 832 * together." 833 * 834 * 835 * @returns Message QueryCombinationInvalid formatted to JSON */ 836 nlohmann::json queryCombinationInvalid(); 837 838 void queryCombinationInvalid(crow::Response& res); 839 840 /** 841 * @brief Formats InsufficientPrivilege message into JSON 842 * Message body: "There are insufficient privileges for the account or 843 * credentials associated with the current session to perform the requested 844 * operation." 845 * 846 * 847 * @returns Message InsufficientPrivilege formatted to JSON */ 848 nlohmann::json insufficientPrivilege(); 849 850 void insufficientPrivilege(crow::Response& res); 851 852 /** 853 * @brief Formats PropertyValueModified message into JSON 854 * Message body: "The property <arg1> was assigned the value <arg2> due to 855 * modification by the service." 856 * 857 * @param[in] arg1 Parameter of message that will replace %1 in its body. 858 * @param[in] arg2 Parameter of message that will replace %2 in its body. 859 * 860 * @returns Message PropertyValueModified formatted to JSON */ 861 nlohmann::json propertyValueModified(std::string_view arg1, 862 std::string_view arg2); 863 864 void propertyValueModified(crow::Response& res, std::string_view arg1, 865 std::string_view arg2); 866 867 /** 868 * @brief Formats AccountNotModified message into JSON 869 * Message body: "The account modification request failed." 870 * 871 * 872 * @returns Message AccountNotModified formatted to JSON */ 873 nlohmann::json accountNotModified(); 874 875 void accountNotModified(crow::Response& res); 876 877 /** 878 * @brief Formats QueryParameterValueFormatError message into JSON 879 * Message body: "The value <arg1> for the parameter <arg2> is of a different 880 * format than the parameter can accept." 881 * 882 * @param[in] arg1 Parameter of message that will replace %1 in its body. 883 * @param[in] arg2 Parameter of message that will replace %2 in its body. 884 * 885 * @returns Message QueryParameterValueFormatError formatted to JSON */ 886 887 nlohmann::json queryParameterValueFormatError(std::string_view arg1, 888 std::string_view arg2); 889 890 void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 891 std::string_view arg2); 892 893 /** 894 * @brief Formats PropertyMissing message into JSON 895 * Message body: "The property <arg1> is a required property and must be 896 * included in the request." 897 * 898 * @param[in] arg1 Parameter of message that will replace %1 in its body. 899 * 900 * @returns Message PropertyMissing formatted to JSON */ 901 nlohmann::json propertyMissing(std::string_view arg1); 902 903 void propertyMissing(crow::Response& res, std::string_view arg1); 904 905 /** 906 * @brief Formats ResourceExhaustion message into JSON 907 * Message body: "The resource <arg1> was unable to satisfy the request due to 908 * unavailability of resources." 909 * 910 * @param[in] arg1 Parameter of message that will replace %1 in its body. 911 * 912 * @returns Message ResourceExhaustion formatted to JSON */ 913 nlohmann::json resourceExhaustion(std::string_view arg1); 914 915 void resourceExhaustion(crow::Response& res, std::string_view arg1); 916 917 /** 918 * @brief Formats AccountModified message into JSON 919 * Message body: "The account was successfully modified." 920 * 921 * 922 * @returns Message AccountModified formatted to JSON */ 923 nlohmann::json accountModified(); 924 925 void accountModified(crow::Response& res); 926 927 /** 928 * @brief Formats QueryParameterOutOfRange message into JSON 929 * Message body: "The value <arg1> for the query parameter <arg2> is out of 930 * range <arg3>." 931 * 932 * @param[in] arg1 Parameter of message that will replace %1 in its body. 933 * @param[in] arg2 Parameter of message that will replace %2 in its body. 934 * @param[in] arg3 Parameter of message that will replace %3 in its body. 935 * 936 * @returns Message QueryParameterOutOfRange formatted to JSON */ 937 nlohmann::json queryParameterOutOfRange(std::string_view arg1, 938 std::string_view arg2, 939 std::string_view arg3); 940 941 void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 942 std::string_view arg2, std::string_view arg3); 943 944 /** 945 * @brief Formats PasswordChangeRequired message into JSON 946 * Message body: The password provided for this account must be changed 947 * before access is granted. PATCH the 'Password' property for this 948 * account located at the target URI '%1' to complete this process. 949 * 950 * @param[in] arg1 Parameter of message that will replace %1 in its body. 951 * 952 * @returns Message PasswordChangeRequired formatted to JSON */ 953 954 nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1); 955 956 void passwordChangeRequired(crow::Response& res, 957 const boost::urls::url_view& arg1); 958 959 /** 960 * @brief Formats InvalidUpload message into JSON 961 * Message body: Invalid file uploaded to %1: %2.* 962 * @param[in] arg1 Parameter of message that will replace %1 in its body. 963 * @param[in] arg2 Parameter of message that will replace %2 in its body. 964 * 965 * @returns Message InvalidUpload formatted to JSON */ 966 nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2); 967 968 void invalidUpload(crow::Response& res, std::string_view arg1, 969 std::string_view arg2); 970 971 } // namespace messages 972 973 } // namespace redfish 974