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