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