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