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