xref: /openbmc/bmcweb/features/redfish/include/error_messages.hpp (revision 1668ce6d0d427088b7bb8ab7c2927763fb57c8c3)
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 PropertyValueIncorrect message into JSON
410  * Message body: "The property '<arg1>' with the requested value of '<arg2>'
411  * could not be written because the value does not meet the constraints of the
412  * implementation."
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  *
417  * @returns Message PropertyValueIncorrect formatted to JSON */
418 nlohmann::json propertyValueIncorrect(std::string_view arg1,
419                                       std::string_view arg2);
420 
421 void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
422                             std::string_view arg2);
423 
424 /**
425  * @brief Formats ResourceCreationConflict message into JSON
426  * Message body: "The resource could not be created.  The service has a resource
427  * at URI '<arg1>' that conflicts with the creation request."
428  *
429  * @param[in] arg1 Parameter of message that will replace %1 in its body.
430  *
431  * @returns Message ResourceCreationConflict formatted to JSON */
432 nlohmann::json resourceCreationConflict(std::string_view arg1);
433 
434 void resourceCreationConflict(crow::Response& res, std::string_view arg1);
435 
436 /**
437  * @brief Formats MaximumErrorsExceeded message into JSON
438  * Message body: "Too many errors have occurred to report them all."
439  *
440  *
441  * @returns Message MaximumErrorsExceeded formatted to JSON */
442 nlohmann::json maximumErrorsExceeded();
443 
444 void maximumErrorsExceeded(crow::Response& res);
445 
446 /**
447  * @brief Formats PreconditionFailed message into JSON
448  * Message body: "The ETag supplied did not match the ETag required to change
449  * this resource."
450  *
451  *
452  * @returns Message PreconditionFailed formatted to JSON */
453 nlohmann::json preconditionFailed();
454 
455 void preconditionFailed(crow::Response& res);
456 
457 /**
458  * @brief Formats PreconditionRequired message into JSON
459  * Message body: "A precondition header or annotation is required to change this
460  * resource."
461  *
462  *
463  * @returns Message PreconditionRequired formatted to JSON */
464 nlohmann::json preconditionRequired();
465 
466 void preconditionRequired(crow::Response& res);
467 
468 /**
469  * @brief Formats OperationFailed message into JSON
470  * Message body: "An error occurred internal to the service as part of the
471  * overall request.  Partial results may have been returned."
472  *
473  *
474  * @returns Message OperationFailed formatted to JSON */
475 nlohmann::json operationFailed();
476 
477 void operationFailed(crow::Response& res);
478 
479 /**
480  * @brief Formats OperationTimeout message into JSON
481  * Message body: "A timeout internal to the service occured as part of the
482  * request.  Partial results may have been returned."
483  *
484  *
485  * @returns Message OperationTimeout formatted to JSON */
486 nlohmann::json operationTimeout();
487 
488 void operationTimeout(crow::Response& res);
489 
490 /**
491  * @brief Formats PropertyValueTypeError message into JSON
492  * Message body: "The value <arg1> for the property <arg2> is of a different
493  * type than the property can accept."
494  *
495  * @param[in] arg1 Parameter of message that will replace %1 in its body.
496  * @param[in] arg2 Parameter of message that will replace %2 in its body.
497  *
498  * @returns Message PropertyValueTypeError formatted to JSON */
499 nlohmann::json propertyValueTypeError(std::string_view arg1,
500                                       std::string_view arg2);
501 
502 void propertyValueTypeError(crow::Response& res, std::string_view arg1,
503                             std::string_view arg2);
504 
505 /**
506  * @brief Formats ResourceNotFound message into JSON
507  * Message body: "The requested resource of type <arg1> named <arg2> was not
508  * found."
509  *
510  * @param[in] arg1 Parameter of message that will replace %1 in its body.
511  * @param[in] arg2 Parameter of message that will replace %2 in its body.
512  *
513  * @returns Message ResourceNotFound formatted to JSON */
514 nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2);
515 
516 void resourceNotFound(crow::Response& res, std::string_view arg1,
517                       std::string_view arg2);
518 
519 /**
520  * @brief Formats CouldNotEstablishConnection message into JSON
521  * Message body: "The service failed to establish a Connection with the URI
522  * <arg1>."
523  *
524  * @param[in] arg1 Parameter of message that will replace %1 in its body.
525  *
526  * @returns Message CouldNotEstablishConnection formatted to JSON */
527 nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1);
528 
529 void couldNotEstablishConnection(crow::Response& res,
530                                  const boost::urls::url_view& arg1);
531 
532 /**
533  * @brief Formats PropertyNotWritable message into JSON
534  * Message body: "The property <arg1> is a read only property and cannot be
535  * assigned a value."
536  *
537  * @param[in] arg1 Parameter of message that will replace %1 in its body.
538  *
539  * @returns Message PropertyNotWritable formatted to JSON */
540 nlohmann::json propertyNotWritable(std::string_view arg1);
541 
542 void propertyNotWritable(crow::Response& res, std::string_view arg1);
543 
544 /**
545  * @brief Formats QueryParameterValueTypeError message into JSON
546  * Message body: "The value <arg1> for the query parameter <arg2> is of a
547  * different type than the parameter can accept."
548  *
549  * @param[in] arg1 Parameter of message that will replace %1 in its body.
550  * @param[in] arg2 Parameter of message that will replace %2 in its body.
551  *
552  * @returns Message QueryParameterValueTypeError formatted to JSON */
553 nlohmann::json queryParameterValueTypeError(std::string_view arg1,
554                                             std::string_view arg2);
555 
556 void queryParameterValueTypeError(crow::Response& res, std::string_view arg1,
557                                   std::string_view arg2);
558 
559 /**
560  * @brief Formats ServiceShuttingDown message into JSON
561  * Message body: "The operation failed because the service is shutting down and
562  * can no longer take incoming requests."
563  *
564  *
565  * @returns Message ServiceShuttingDown formatted to JSON */
566 nlohmann::json serviceShuttingDown();
567 
568 void serviceShuttingDown(crow::Response& res);
569 
570 /**
571  * @brief Formats ActionParameterDuplicate message into JSON
572  * Message body: "The action <arg1> was submitted with more than one value for
573  * the parameter <arg2>."
574  *
575  * @param[in] arg1 Parameter of message that will replace %1 in its body.
576  * @param[in] arg2 Parameter of message that will replace %2 in its body.
577  *
578  * @returns Message ActionParameterDuplicate formatted to JSON */
579 nlohmann::json actionParameterDuplicate(std::string_view arg1,
580                                         std::string_view arg2);
581 
582 void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
583                               std::string_view arg2);
584 
585 /**
586  * @brief Formats ActionParameterNotSupported message into JSON
587  * Message body: "The parameter <arg1> for the action <arg2> is not supported on
588  * the target resource."
589  *
590  * @param[in] arg1 Parameter of message that will replace %1 in its body.
591  * @param[in] arg2 Parameter of message that will replace %2 in its body.
592  *
593  * @returns Message ActionParameterNotSupported formatted to JSON */
594 nlohmann::json actionParameterNotSupported(std::string_view arg1,
595                                            std::string_view arg2);
596 
597 void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
598                                  std::string_view arg2);
599 
600 /**
601  * @brief Formats SourceDoesNotSupportProtocol message into JSON
602  * Message body: "The other end of the Connection at <arg1> does not support the
603  * specified protocol <arg2>."
604  *
605  * @param[in] arg1 Parameter of message that will replace %1 in its body.
606  * @param[in] arg2 Parameter of message that will replace %2 in its body.
607  *
608  * @returns Message SourceDoesNotSupportProtocol formatted to JSON */
609 nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1,
610                                             std::string_view arg2);
611 
612 void sourceDoesNotSupportProtocol(crow::Response& res,
613                                   const boost::urls::url_view& arg1,
614                                   std::string_view arg2);
615 
616 /**
617  * @brief Formats AccountRemoved message into JSON
618  * Message body: "The account was successfully removed."
619  *
620  *
621  * @returns Message AccountRemoved formatted to JSON */
622 nlohmann::json accountRemoved();
623 
624 void accountRemoved(crow::Response& res);
625 
626 /**
627  * @brief Formats AccessDenied message into JSON
628  * Message body: "While attempting to establish a Connection to <arg1>, the
629  * service denied access."
630  *
631  * @param[in] arg1 Parameter of message that will replace %1 in its body.
632  *
633  * @returns Message AccessDenied formatted to JSON */
634 nlohmann::json accessDenied(std::string_view arg1);
635 
636 void accessDenied(crow::Response& res, std::string_view arg1);
637 
638 /**
639  * @brief Formats QueryNotSupported message into JSON
640  * Message body: "Querying is not supported by the implementation."
641  *
642  *
643  * @returns Message QueryNotSupported formatted to JSON */
644 nlohmann::json queryNotSupported();
645 
646 void queryNotSupported(crow::Response& res);
647 
648 /**
649  * @brief Formats CreateLimitReachedForResource message into JSON
650  * Message body: "The create operation failed because the resource has reached
651  * the limit of possible resources."
652  *
653  *
654  * @returns Message CreateLimitReachedForResource formatted to JSON */
655 nlohmann::json createLimitReachedForResource();
656 
657 void createLimitReachedForResource(crow::Response& res);
658 
659 /**
660  * @brief Formats GeneralError message into JSON
661  * Message body: "A general error has occurred. See ExtendedInfo for more
662  * information."
663  *
664  *
665  * @returns Message GeneralError formatted to JSON */
666 nlohmann::json generalError();
667 
668 void generalError(crow::Response& res);
669 
670 /**
671  * @brief Formats Success message into JSON
672  * Message body: "Successfully Completed Request"
673  *
674  *
675  * @returns Message Success formatted to JSON */
676 nlohmann::json success();
677 
678 void success(crow::Response& res);
679 
680 /**
681  * @brief Formats Created message into JSON
682  * Message body: "The resource has been created successfully"
683  *
684  *
685  * @returns Message Created formatted to JSON */
686 nlohmann::json created();
687 
688 void created(crow::Response& res);
689 
690 /**
691  * @brief Formats NoOperation message into JSON
692  * Message body: "The request body submitted contain no data to act upon and
693  * no changes to the resource took place."
694  *
695  *
696  * @returns Message NoOperation formatted to JSON */
697 nlohmann::json noOperation();
698 
699 void noOperation(crow::Response& res);
700 
701 /**
702  * @brief Formats PropertyUnknown message into JSON
703  * Message body: "The property <arg1> is not in the list of valid properties for
704  * the resource."
705  *
706  * @param[in] arg1 Parameter of message that will replace %1 in its body.
707  *
708  * @returns Message PropertyUnknown formatted to JSON */
709 nlohmann::json propertyUnknown(std::string_view arg1);
710 
711 void propertyUnknown(crow::Response& res, std::string_view arg1);
712 
713 /**
714  * @brief Formats NoValidSession message into JSON
715  * Message body: "There is no valid session established with the
716  * implementation."
717  *
718  *
719  * @returns Message NoValidSession formatted to JSON */
720 nlohmann::json noValidSession();
721 
722 void noValidSession(crow::Response& res);
723 
724 /**
725  * @brief Formats InvalidObject message into JSON
726  * Message body: "The object at <arg1> is invalid."
727  *
728  * @param[in] arg1 Parameter of message that will replace %1 in its body.
729  *
730  * @returns Message InvalidObject formatted to JSON */
731 nlohmann::json invalidObject(const boost::urls::url_view& arg1);
732 
733 void invalidObject(crow::Response& res, const boost::urls::url_view& arg1);
734 
735 /**
736  * @brief Formats ResourceInStandby message into JSON
737  * Message body: "The request could not be performed because the resource is in
738  * standby."
739  *
740  *
741  * @returns Message ResourceInStandby formatted to JSON */
742 nlohmann::json resourceInStandby();
743 
744 void resourceInStandby(crow::Response& res);
745 
746 /**
747  * @brief Formats ActionParameterValueTypeError message into JSON
748  * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
749  * is of a different type than the parameter can accept."
750  *
751  * @param[in] arg1 Parameter of message that will replace %1 in its body.
752  * @param[in] arg2 Parameter of message that will replace %2 in its body.
753  * @param[in] arg3 Parameter of message that will replace %3 in its body.
754  *
755  * @returns Message ActionParameterValueTypeError formatted to JSON */
756 nlohmann::json actionParameterValueTypeError(std::string_view arg1,
757                                              std::string_view arg2,
758                                              std::string_view arg3);
759 
760 void actionParameterValueTypeError(crow::Response& res, std::string_view arg1,
761                                    std::string_view arg2,
762                                    std::string_view arg3);
763 
764 /**
765  * @brief Formats SessionLimitExceeded message into JSON
766  * Message body: "The session establishment failed due to the number of
767  * simultaneous sessions exceeding the limit of the implementation."
768  *
769  *
770  * @returns Message SessionLimitExceeded formatted to JSON */
771 nlohmann::json sessionLimitExceeded();
772 
773 void sessionLimitExceeded(crow::Response& res);
774 
775 /**
776  * @brief Formats ActionNotSupported message into JSON
777  * Message body: "The action <arg1> is not supported by the resource."
778  *
779  * @param[in] arg1 Parameter of message that will replace %1 in its body.
780  *
781  * @returns Message ActionNotSupported formatted to JSON */
782 nlohmann::json actionNotSupported(std::string_view arg1);
783 
784 void actionNotSupported(crow::Response& res, std::string_view arg1);
785 
786 /**
787  * @brief Formats InvalidIndex message into JSON
788  * Message body: "The index <arg1> is not a valid offset into the array."
789  *
790  * @param[in] arg1 Parameter of message that will replace %1 in its body.
791  *
792  * @returns Message InvalidIndex formatted to JSON */
793 nlohmann::json invalidIndex(int64_t arg1);
794 
795 void invalidIndex(crow::Response& res, int64_t arg1);
796 
797 /**
798  * @brief Formats EmptyJSON message into JSON
799  * Message body: "The request body submitted contained an empty JSON object and
800  * the service is unable to process it."
801  *
802  *
803  * @returns Message EmptyJSON formatted to JSON */
804 nlohmann::json emptyJSON();
805 
806 void emptyJSON(crow::Response& res);
807 
808 /**
809  * @brief Formats QueryNotSupportedOnResource message into JSON
810  * Message body: "Querying is not supported on the requested resource."
811  *
812  *
813  * @returns Message QueryNotSupportedOnResource formatted to JSON */
814 nlohmann::json queryNotSupportedOnResource();
815 
816 void queryNotSupportedOnResource(crow::Response& res);
817 
818 /**
819  * @brief Formats QueryNotSupportedOnOperation message into JSON
820  * Message body: "Querying is not supported with the requested operation."
821  *
822  *
823  * @returns Message QueryNotSupportedOnOperation formatted to JSON */
824 nlohmann::json queryNotSupportedOnOperation();
825 
826 void queryNotSupportedOnOperation(crow::Response& res);
827 
828 /**
829  * @brief Formats QueryCombinationInvalid message into JSON
830  * Message body: "Two or more query parameters in the request cannot be used
831  * together."
832  *
833  *
834  * @returns Message QueryCombinationInvalid formatted to JSON */
835 nlohmann::json queryCombinationInvalid();
836 
837 void queryCombinationInvalid(crow::Response& res);
838 
839 /**
840  * @brief Formats InsufficientPrivilege message into JSON
841  * Message body: "There are insufficient privileges for the account or
842  * credentials associated with the current session to perform the requested
843  * operation."
844  *
845  *
846  * @returns Message InsufficientPrivilege formatted to JSON */
847 nlohmann::json insufficientPrivilege();
848 
849 void insufficientPrivilege(crow::Response& res);
850 
851 /**
852  * @brief Formats PropertyValueModified message into JSON
853  * Message body: "The property <arg1> was assigned the value <arg2> due to
854  * modification by the service."
855  *
856  * @param[in] arg1 Parameter of message that will replace %1 in its body.
857  * @param[in] arg2 Parameter of message that will replace %2 in its body.
858  *
859  * @returns Message PropertyValueModified formatted to JSON */
860 nlohmann::json propertyValueModified(std::string_view arg1,
861                                      std::string_view arg2);
862 
863 void propertyValueModified(crow::Response& res, std::string_view arg1,
864                            std::string_view arg2);
865 
866 /**
867  * @brief Formats AccountNotModified message into JSON
868  * Message body: "The account modification request failed."
869  *
870  *
871  * @returns Message AccountNotModified formatted to JSON */
872 nlohmann::json accountNotModified();
873 
874 void accountNotModified(crow::Response& res);
875 
876 /**
877  * @brief Formats QueryParameterValueFormatError message into JSON
878  * Message body: "The value <arg1> for the parameter <arg2> is of a different
879  * format than the parameter can accept."
880  *
881  * @param[in] arg1 Parameter of message that will replace %1 in its body.
882  * @param[in] arg2 Parameter of message that will replace %2 in its body.
883  *
884  * @returns Message QueryParameterValueFormatError formatted to JSON */
885 
886 nlohmann::json queryParameterValueFormatError(std::string_view arg1,
887                                               std::string_view arg2);
888 
889 void queryParameterValueFormatError(crow::Response& res, std::string_view arg1,
890                                     std::string_view arg2);
891 
892 /**
893  * @brief Formats PropertyMissing message into JSON
894  * Message body: "The property <arg1> is a required property and must be
895  * included in the request."
896  *
897  * @param[in] arg1 Parameter of message that will replace %1 in its body.
898  *
899  * @returns Message PropertyMissing formatted to JSON */
900 nlohmann::json propertyMissing(std::string_view arg1);
901 
902 void propertyMissing(crow::Response& res, std::string_view arg1);
903 
904 /**
905  * @brief Formats ResourceExhaustion message into JSON
906  * Message body: "The resource <arg1> was unable to satisfy the request due to
907  * unavailability of resources."
908  *
909  * @param[in] arg1 Parameter of message that will replace %1 in its body.
910  *
911  * @returns Message ResourceExhaustion formatted to JSON */
912 nlohmann::json resourceExhaustion(std::string_view arg1);
913 
914 void resourceExhaustion(crow::Response& res, std::string_view arg1);
915 
916 /**
917  * @brief Formats AccountModified message into JSON
918  * Message body: "The account was successfully modified."
919  *
920  *
921  * @returns Message AccountModified formatted to JSON */
922 nlohmann::json accountModified();
923 
924 void accountModified(crow::Response& res);
925 
926 /**
927  * @brief Formats QueryParameterOutOfRange message into JSON
928  * Message body: "The value <arg1> for the query parameter <arg2> is out of
929  * range <arg3>."
930  *
931  * @param[in] arg1 Parameter of message that will replace %1 in its body.
932  * @param[in] arg2 Parameter of message that will replace %2 in its body.
933  * @param[in] arg3 Parameter of message that will replace %3 in its body.
934  *
935  * @returns Message QueryParameterOutOfRange formatted to JSON */
936 nlohmann::json queryParameterOutOfRange(std::string_view arg1,
937                                         std::string_view arg2,
938                                         std::string_view arg3);
939 
940 void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
941                               std::string_view arg2, std::string_view arg3);
942 
943 /**
944  * @brief Formats PasswordChangeRequired message into JSON
945  * Message body: The password provided for this account must be changed
946  * before access is granted.  PATCH the 'Password' property for this
947  * account located at the target URI '%1' to complete this process.
948  *
949  * @param[in] arg1 Parameter of message that will replace %1 in its body.
950  *
951  * @returns Message PasswordChangeRequired formatted to JSON */
952 
953 nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1);
954 
955 void passwordChangeRequired(crow::Response& res,
956                             const boost::urls::url_view& arg1);
957 
958 /**
959  * @brief Formats InvalidUpload message into JSON
960  * Message body: Invalid file uploaded to %1: %2.*
961  * @param[in] arg1 Parameter of message that will replace %1 in its body.
962  * @param[in] arg2 Parameter of message that will replace %2 in its body.
963  *
964  * @returns Message InvalidUpload formatted to JSON */
965 nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2);
966 
967 void invalidUpload(crow::Response& res, std::string_view arg1,
968                    std::string_view arg2);
969 
970 } // namespace messages
971 
972 } // namespace redfish
973