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