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