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 PropertyValueResourceConflict message into JSON 410 * Message body: "The property '%1' with the requested value of '%2' could 411 * not be written because the value conflicts with the state or configuration 412 * of the resource at '%3'." 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 * @param[in] arg3 Parameter of message that will replace %3 in its body. 417 * 418 * @returns Message PropertyValueResourceConflict to JSON */ 419 nlohmann::json propertyValueResourceConflict(std::string_view arg1, 420 std::string_view arg2, 421 const boost::urls::url_view& arg3); 422 423 void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 424 std::string_view arg2, 425 const boost::urls::url_view& arg3); 426 427 /** 428 * @brief Formats PropertyValueIncorrect message into JSON 429 * Message body: "The property '<arg1>' with the requested value of '<arg2>' 430 * could not be written because the value does not meet the constraints of the 431 * implementation." 432 * 433 * @param[in] arg1 Parameter of message that will replace %1 in its body. 434 * @param[in] arg2 Parameter of message that will replace %2 in its body. 435 * 436 * @returns Message PropertyValueIncorrect formatted to JSON */ 437 nlohmann::json propertyValueIncorrect(std::string_view arg1, 438 std::string_view arg2); 439 440 void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 441 std::string_view arg2); 442 443 /** 444 * @brief Formats ResourceCreationConflict message into JSON 445 * Message body: "The resource could not be created. The service has a resource 446 * at URI '<arg1>' that conflicts with the creation request." 447 * 448 * @param[in] arg1 Parameter of message that will replace %1 in its body. 449 * 450 * @returns Message ResourceCreationConflict formatted to JSON */ 451 nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1); 452 453 void resourceCreationConflict(crow::Response& res, 454 const boost::urls::url_view& arg1); 455 456 /** 457 * @brief Formats MaximumErrorsExceeded message into JSON 458 * Message body: "Too many errors have occurred to report them all." 459 * 460 * 461 * @returns Message MaximumErrorsExceeded formatted to JSON */ 462 nlohmann::json maximumErrorsExceeded(); 463 464 void maximumErrorsExceeded(crow::Response& res); 465 466 /** 467 * @brief Formats PreconditionFailed message into JSON 468 * Message body: "The ETag supplied did not match the ETag required to change 469 * this resource." 470 * 471 * 472 * @returns Message PreconditionFailed formatted to JSON */ 473 nlohmann::json preconditionFailed(); 474 475 void preconditionFailed(crow::Response& res); 476 477 /** 478 * @brief Formats PreconditionRequired message into JSON 479 * Message body: "A precondition header or annotation is required to change this 480 * resource." 481 * 482 * 483 * @returns Message PreconditionRequired formatted to JSON */ 484 nlohmann::json preconditionRequired(); 485 486 void preconditionRequired(crow::Response& res); 487 488 /** 489 * @brief Formats OperationFailed message into JSON 490 * Message body: "An error occurred internal to the service as part of the 491 * overall request. Partial results may have been returned." 492 * 493 * 494 * @returns Message OperationFailed formatted to JSON */ 495 nlohmann::json operationFailed(); 496 497 void operationFailed(crow::Response& res); 498 499 /** 500 * @brief Formats OperationTimeout message into JSON 501 * Message body: "A timeout internal to the service occured as part of the 502 * request. Partial results may have been returned." 503 * 504 * 505 * @returns Message OperationTimeout formatted to JSON */ 506 nlohmann::json operationTimeout(); 507 508 void operationTimeout(crow::Response& res); 509 510 /** 511 * @brief Formats PropertyValueTypeError message into JSON 512 * Message body: "The value <arg1> for the property <arg2> is of a different 513 * type than the property can accept." 514 * 515 * @param[in] arg1 Parameter of message that will replace %1 in its body. 516 * @param[in] arg2 Parameter of message that will replace %2 in its body. 517 * 518 * @returns Message PropertyValueTypeError formatted to JSON */ 519 nlohmann::json propertyValueTypeError(std::string_view arg1, 520 std::string_view arg2); 521 522 void propertyValueTypeError(crow::Response& res, std::string_view arg1, 523 std::string_view arg2); 524 525 /** 526 * @brief Formats ResourceNotFound message into JSON 527 * Message body: "The requested resource of type <arg1> named <arg2> was not 528 * found." 529 * 530 * @param[in] arg1 Parameter of message that will replace %1 in its body. 531 * @param[in] arg2 Parameter of message that will replace %2 in its body. 532 * 533 * @returns Message ResourceNotFound formatted to JSON */ 534 nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2); 535 536 void resourceNotFound(crow::Response& res, std::string_view arg1, 537 std::string_view arg2); 538 539 /** 540 * @brief Formats CouldNotEstablishConnection message into JSON 541 * Message body: "The service failed to establish a Connection with the URI 542 * <arg1>." 543 * 544 * @param[in] arg1 Parameter of message that will replace %1 in its body. 545 * 546 * @returns Message CouldNotEstablishConnection formatted to JSON */ 547 nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1); 548 549 void couldNotEstablishConnection(crow::Response& res, 550 const boost::urls::url_view& arg1); 551 552 /** 553 * @brief Formats PropertyNotWritable message into JSON 554 * Message body: "The property <arg1> is a read only property and cannot be 555 * assigned a value." 556 * 557 * @param[in] arg1 Parameter of message that will replace %1 in its body. 558 * 559 * @returns Message PropertyNotWritable formatted to JSON */ 560 nlohmann::json propertyNotWritable(std::string_view arg1); 561 562 void propertyNotWritable(crow::Response& res, std::string_view arg1); 563 564 /** 565 * @brief Formats QueryParameterValueTypeError message into JSON 566 * Message body: "The value <arg1> for the query parameter <arg2> is of a 567 * different type than the parameter can accept." 568 * 569 * @param[in] arg1 Parameter of message that will replace %1 in its body. 570 * @param[in] arg2 Parameter of message that will replace %2 in its body. 571 * 572 * @returns Message QueryParameterValueTypeError formatted to JSON */ 573 nlohmann::json queryParameterValueTypeError(std::string_view arg1, 574 std::string_view arg2); 575 576 void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 577 std::string_view arg2); 578 579 /** 580 * @brief Formats ServiceShuttingDown message into JSON 581 * Message body: "The operation failed because the service is shutting down and 582 * can no longer take incoming requests." 583 * 584 * 585 * @returns Message ServiceShuttingDown formatted to JSON */ 586 nlohmann::json serviceShuttingDown(); 587 588 void serviceShuttingDown(crow::Response& res); 589 590 /** 591 * @brief Formats ActionParameterDuplicate message into JSON 592 * Message body: "The action <arg1> was submitted with more than one value for 593 * the parameter <arg2>." 594 * 595 * @param[in] arg1 Parameter of message that will replace %1 in its body. 596 * @param[in] arg2 Parameter of message that will replace %2 in its body. 597 * 598 * @returns Message ActionParameterDuplicate formatted to JSON */ 599 nlohmann::json actionParameterDuplicate(std::string_view arg1, 600 std::string_view arg2); 601 602 void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 603 std::string_view arg2); 604 605 /** 606 * @brief Formats ActionParameterNotSupported message into JSON 607 * Message body: "The parameter <arg1> for the action <arg2> is not supported on 608 * the target resource." 609 * 610 * @param[in] arg1 Parameter of message that will replace %1 in its body. 611 * @param[in] arg2 Parameter of message that will replace %2 in its body. 612 * 613 * @returns Message ActionParameterNotSupported formatted to JSON */ 614 nlohmann::json actionParameterNotSupported(std::string_view arg1, 615 std::string_view arg2); 616 617 void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 618 std::string_view arg2); 619 620 /** 621 * @brief Formats SourceDoesNotSupportProtocol message into JSON 622 * Message body: "The other end of the Connection at <arg1> does not support the 623 * specified protocol <arg2>." 624 * 625 * @param[in] arg1 Parameter of message that will replace %1 in its body. 626 * @param[in] arg2 Parameter of message that will replace %2 in its body. 627 * 628 * @returns Message SourceDoesNotSupportProtocol formatted to JSON */ 629 nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 630 std::string_view arg2); 631 632 void sourceDoesNotSupportProtocol(crow::Response& res, 633 const boost::urls::url_view& arg1, 634 std::string_view arg2); 635 636 /** 637 * @brief Formats AccountRemoved message into JSON 638 * Message body: "The account was successfully removed." 639 * 640 * 641 * @returns Message AccountRemoved formatted to JSON */ 642 nlohmann::json accountRemoved(); 643 644 void accountRemoved(crow::Response& res); 645 646 /** 647 * @brief Formats AccessDenied message into JSON 648 * Message body: "While attempting to establish a Connection to <arg1>, the 649 * service denied access." 650 * 651 * @param[in] arg1 Parameter of message that will replace %1 in its body. 652 * 653 * @returns Message AccessDenied formatted to JSON */ 654 nlohmann::json accessDenied(const boost::urls::url_view& arg1); 655 656 void accessDenied(crow::Response& res, const boost::urls::url_view& arg1); 657 658 /** 659 * @brief Formats QueryNotSupported message into JSON 660 * Message body: "Querying is not supported by the implementation." 661 * 662 * 663 * @returns Message QueryNotSupported formatted to JSON */ 664 nlohmann::json queryNotSupported(); 665 666 void queryNotSupported(crow::Response& res); 667 668 /** 669 * @brief Formats CreateLimitReachedForResource message into JSON 670 * Message body: "The create operation failed because the resource has reached 671 * the limit of possible resources." 672 * 673 * 674 * @returns Message CreateLimitReachedForResource formatted to JSON */ 675 nlohmann::json createLimitReachedForResource(); 676 677 void createLimitReachedForResource(crow::Response& res); 678 679 /** 680 * @brief Formats GeneralError message into JSON 681 * Message body: "A general error has occurred. See ExtendedInfo for more 682 * information." 683 * 684 * 685 * @returns Message GeneralError formatted to JSON */ 686 nlohmann::json generalError(); 687 688 void generalError(crow::Response& res); 689 690 /** 691 * @brief Formats Success message into JSON 692 * Message body: "Successfully Completed Request" 693 * 694 * 695 * @returns Message Success formatted to JSON */ 696 nlohmann::json success(); 697 698 void success(crow::Response& res); 699 700 /** 701 * @brief Formats Created message into JSON 702 * Message body: "The resource has been created successfully" 703 * 704 * 705 * @returns Message Created formatted to JSON */ 706 nlohmann::json created(); 707 708 void created(crow::Response& res); 709 710 /** 711 * @brief Formats NoOperation message into JSON 712 * Message body: "The request body submitted contain no data to act upon and 713 * no changes to the resource took place." 714 * 715 * 716 * @returns Message NoOperation formatted to JSON */ 717 nlohmann::json noOperation(); 718 719 void noOperation(crow::Response& res); 720 721 /** 722 * @brief Formats PropertyUnknown message into JSON 723 * Message body: "The property <arg1> is not in the list of valid properties for 724 * the resource." 725 * 726 * @param[in] arg1 Parameter of message that will replace %1 in its body. 727 * 728 * @returns Message PropertyUnknown formatted to JSON */ 729 nlohmann::json propertyUnknown(std::string_view arg1); 730 731 void propertyUnknown(crow::Response& res, std::string_view arg1); 732 733 /** 734 * @brief Formats NoValidSession message into JSON 735 * Message body: "There is no valid session established with the 736 * implementation." 737 * 738 * 739 * @returns Message NoValidSession formatted to JSON */ 740 nlohmann::json noValidSession(); 741 742 void noValidSession(crow::Response& res); 743 744 /** 745 * @brief Formats InvalidObject message into JSON 746 * Message body: "The object at <arg1> is invalid." 747 * 748 * @param[in] arg1 Parameter of message that will replace %1 in its body. 749 * 750 * @returns Message InvalidObject formatted to JSON */ 751 nlohmann::json invalidObject(const boost::urls::url_view& arg1); 752 753 void invalidObject(crow::Response& res, const boost::urls::url_view& arg1); 754 755 /** 756 * @brief Formats ResourceInStandby message into JSON 757 * Message body: "The request could not be performed because the resource is in 758 * standby." 759 * 760 * 761 * @returns Message ResourceInStandby formatted to JSON */ 762 nlohmann::json resourceInStandby(); 763 764 void resourceInStandby(crow::Response& res); 765 766 /** 767 * @brief Formats ActionParameterValueTypeError message into JSON 768 * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3> 769 * is of a different type than the parameter can accept." 770 * 771 * @param[in] arg1 Parameter of message that will replace %1 in its body. 772 * @param[in] arg2 Parameter of message that will replace %2 in its body. 773 * @param[in] arg3 Parameter of message that will replace %3 in its body. 774 * 775 * @returns Message ActionParameterValueTypeError formatted to JSON */ 776 nlohmann::json actionParameterValueTypeError(std::string_view arg1, 777 std::string_view arg2, 778 std::string_view arg3); 779 780 void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 781 std::string_view arg2, 782 std::string_view arg3); 783 784 /** 785 * @brief Formats SessionLimitExceeded message into JSON 786 * Message body: "The session establishment failed due to the number of 787 * simultaneous sessions exceeding the limit of the implementation." 788 * 789 * 790 * @returns Message SessionLimitExceeded formatted to JSON */ 791 nlohmann::json sessionLimitExceeded(); 792 793 void sessionLimitExceeded(crow::Response& res); 794 795 /** 796 * @brief Formats ActionNotSupported message into JSON 797 * Message body: "The action <arg1> is not supported by the resource." 798 * 799 * @param[in] arg1 Parameter of message that will replace %1 in its body. 800 * 801 * @returns Message ActionNotSupported formatted to JSON */ 802 nlohmann::json actionNotSupported(std::string_view arg1); 803 804 void actionNotSupported(crow::Response& res, std::string_view arg1); 805 806 /** 807 * @brief Formats InvalidIndex message into JSON 808 * Message body: "The index <arg1> is not a valid offset into the array." 809 * 810 * @param[in] arg1 Parameter of message that will replace %1 in its body. 811 * 812 * @returns Message InvalidIndex formatted to JSON */ 813 nlohmann::json invalidIndex(int64_t arg1); 814 815 void invalidIndex(crow::Response& res, int64_t arg1); 816 817 /** 818 * @brief Formats EmptyJSON message into JSON 819 * Message body: "The request body submitted contained an empty JSON object and 820 * the service is unable to process it." 821 * 822 * 823 * @returns Message EmptyJSON formatted to JSON */ 824 nlohmann::json emptyJSON(); 825 826 void emptyJSON(crow::Response& res); 827 828 /** 829 * @brief Formats QueryNotSupportedOnResource message into JSON 830 * Message body: "Querying is not supported on the requested resource." 831 * 832 * 833 * @returns Message QueryNotSupportedOnResource formatted to JSON */ 834 nlohmann::json queryNotSupportedOnResource(); 835 836 void queryNotSupportedOnResource(crow::Response& res); 837 838 /** 839 * @brief Formats QueryNotSupportedOnOperation message into JSON 840 * Message body: "Querying is not supported with the requested operation." 841 * 842 * 843 * @returns Message QueryNotSupportedOnOperation formatted to JSON */ 844 nlohmann::json queryNotSupportedOnOperation(); 845 846 void queryNotSupportedOnOperation(crow::Response& res); 847 848 /** 849 * @brief Formats QueryCombinationInvalid message into JSON 850 * Message body: "Two or more query parameters in the request cannot be used 851 * together." 852 * 853 * 854 * @returns Message QueryCombinationInvalid formatted to JSON */ 855 nlohmann::json queryCombinationInvalid(); 856 857 void queryCombinationInvalid(crow::Response& res); 858 859 /** 860 * @brief Formats InsufficientPrivilege message into JSON 861 * Message body: "There are insufficient privileges for the account or 862 * credentials associated with the current session to perform the requested 863 * operation." 864 * 865 * 866 * @returns Message InsufficientPrivilege formatted to JSON */ 867 nlohmann::json insufficientPrivilege(); 868 869 void insufficientPrivilege(crow::Response& res); 870 871 /** 872 * @brief Formats PropertyValueModified message into JSON 873 * Message body: "The property <arg1> was assigned the value <arg2> due to 874 * modification by the service." 875 * 876 * @param[in] arg1 Parameter of message that will replace %1 in its body. 877 * @param[in] arg2 Parameter of message that will replace %2 in its body. 878 * 879 * @returns Message PropertyValueModified formatted to JSON */ 880 nlohmann::json propertyValueModified(std::string_view arg1, 881 std::string_view arg2); 882 883 void propertyValueModified(crow::Response& res, std::string_view arg1, 884 std::string_view arg2); 885 886 /** 887 * @brief Formats AccountNotModified message into JSON 888 * Message body: "The account modification request failed." 889 * 890 * 891 * @returns Message AccountNotModified formatted to JSON */ 892 nlohmann::json accountNotModified(); 893 894 void accountNotModified(crow::Response& res); 895 896 /** 897 * @brief Formats QueryParameterValueFormatError message into JSON 898 * Message body: "The value <arg1> for the parameter <arg2> is of a different 899 * format than the parameter can accept." 900 * 901 * @param[in] arg1 Parameter of message that will replace %1 in its body. 902 * @param[in] arg2 Parameter of message that will replace %2 in its body. 903 * 904 * @returns Message QueryParameterValueFormatError formatted to JSON */ 905 906 nlohmann::json queryParameterValueFormatError(std::string_view arg1, 907 std::string_view arg2); 908 909 void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 910 std::string_view arg2); 911 912 /** 913 * @brief Formats PropertyMissing message into JSON 914 * Message body: "The property <arg1> is a required property and must be 915 * included in the request." 916 * 917 * @param[in] arg1 Parameter of message that will replace %1 in its body. 918 * 919 * @returns Message PropertyMissing formatted to JSON */ 920 nlohmann::json propertyMissing(std::string_view arg1); 921 922 void propertyMissing(crow::Response& res, std::string_view arg1); 923 924 /** 925 * @brief Formats ResourceExhaustion message into JSON 926 * Message body: "The resource <arg1> was unable to satisfy the request due to 927 * unavailability of resources." 928 * 929 * @param[in] arg1 Parameter of message that will replace %1 in its body. 930 * 931 * @returns Message ResourceExhaustion formatted to JSON */ 932 nlohmann::json resourceExhaustion(std::string_view arg1); 933 934 void resourceExhaustion(crow::Response& res, std::string_view arg1); 935 936 /** 937 * @brief Formats AccountModified message into JSON 938 * Message body: "The account was successfully modified." 939 * 940 * 941 * @returns Message AccountModified formatted to JSON */ 942 nlohmann::json accountModified(); 943 944 void accountModified(crow::Response& res); 945 946 /** 947 * @brief Formats QueryParameterOutOfRange message into JSON 948 * Message body: "The value <arg1> for the query parameter <arg2> is out of 949 * range <arg3>." 950 * 951 * @param[in] arg1 Parameter of message that will replace %1 in its body. 952 * @param[in] arg2 Parameter of message that will replace %2 in its body. 953 * @param[in] arg3 Parameter of message that will replace %3 in its body. 954 * 955 * @returns Message QueryParameterOutOfRange formatted to JSON */ 956 nlohmann::json queryParameterOutOfRange(std::string_view arg1, 957 std::string_view arg2, 958 std::string_view arg3); 959 960 void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 961 std::string_view arg2, std::string_view arg3); 962 963 /** 964 * @brief Formats PasswordChangeRequired message into JSON 965 * Message body: The password provided for this account must be changed 966 * before access is granted. PATCH the 'Password' property for this 967 * account located at the target URI '%1' to complete this process. 968 * 969 * @param[in] arg1 Parameter of message that will replace %1 in its body. 970 * 971 * @returns Message PasswordChangeRequired formatted to JSON */ 972 973 nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1); 974 975 void passwordChangeRequired(crow::Response& res, 976 const boost::urls::url_view& arg1); 977 978 /** 979 * @brief Formats InvalidUpload message into JSON 980 * Message body: Invalid file uploaded to %1: %2.* 981 * @param[in] arg1 Parameter of message that will replace %1 in its body. 982 * @param[in] arg2 Parameter of message that will replace %2 in its body. 983 * 984 * @returns Message InvalidUpload formatted to JSON */ 985 nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2); 986 987 void invalidUpload(crow::Response& res, std::string_view arg1, 988 std::string_view arg2); 989 990 } // namespace messages 991 992 } // namespace redfish 993