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