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 /****************************************************************
17  * This is an auto-generated header which contains definitions
18  * to use Redfish DMTF defined messages.
19  *
20  * This header contains preprocessor defines which wrap
21  * preparation functions for message with given id. The message
22  * ids can be retrieved from Base.__ver__.json file.
23  ***************************************************************/
24 #pragma once
25 #include <nlohmann/json.hpp>
26 
27 namespace redfish
28 {
29 
30 namespace messages
31 {
32 
33 constexpr const char* messageVersionPrefix = "Base.1.2.0.";
34 constexpr const char* messageAnnotation = "@Message.ExtendedInfo";
35 
36 /**
37  * @brief Adds Message JSON object to error object
38  *
39  * @param[out] target   Target JSON to which message will be added
40  * @param[in]  message  Message JSON that should be added to target
41  *
42  * @return None
43  */
44 void addMessageToErrorJson(nlohmann::json& target,
45                            const nlohmann::json& message);
46 
47 /**
48  * @brief Adds Message JSON object to target JSON
49  *
50  * @internal
51  * This function has similar implementation to addMessageToJson(...), but
52  * does not use nlohmann::json_pointer to avoid costly construction
53  * @endinternal
54  *
55  * @param[out] target   Target JSON to which message will be added
56  * @param[in]  message  Message JSON that should be added to target
57  *
58  * @return None
59  */
60 void addMessageToJsonRoot(nlohmann::json& target,
61                           const nlohmann::json& message);
62 
63 /**
64  * @brief Adds Message JSON object connected with specific field to target JSON
65  *
66  * @param[out] target      Target JSON to which message will be added
67  * @param[in]  message     Message JSON that should be added to target
68  * @param[in]  fieldPath   Path of related field
69  *
70  * @return None
71  */
72 void addMessageToJson(nlohmann::json& target, const nlohmann::json& message,
73                       const std::string& fieldPath);
74 
75 /*********************************
76  * AUTOGENERATED FUNCTIONS START *
77  *********************************/
78 
79 /**
80  * @brief Formats ResourceInUse message into JSON
81  * Message body: "The change to the requested resource failed because the
82  * resource is in use or in transition."
83  *
84  *
85  * @returns Message ResourceInUse formatted to JSON */
86 nlohmann::json resourceInUse();
87 
88 /**
89  * @brief Formats MalformedJSON message into JSON
90  * Message body: "The request body submitted was malformed JSON and could not be
91  * parsed by the receiving service."
92  *
93  *
94  * @returns Message MalformedJSON formatted to JSON */
95 nlohmann::json malformedJSON();
96 
97 /**
98  * @brief Formats ResourceMissingAtURI message into JSON
99  * Message body: "The resource at the URI <arg0> was not found."
100  *
101  * @param[in] arg1 Parameter of message that will replace %1 in its body.
102  *
103  * @returns Message ResourceMissingAtURI formatted to JSON */
104 nlohmann::json resourceMissingAtURI(const std::string& arg1);
105 
106 /**
107  * @brief Formats ActionParameterValueFormatError message into JSON
108  * Message body: "The value <arg0> for the parameter <arg1> in the action <arg2>
109  * is of a different format than the parameter can accept."
110  *
111  * @param[in] arg1 Parameter of message that will replace %1 in its body.
112  * @param[in] arg2 Parameter of message that will replace %2 in its body.
113  * @param[in] arg3 Parameter of message that will replace %3 in its body.
114  *
115  * @returns Message ActionParameterValueFormatError formatted to JSON */
116 nlohmann::json actionParameterValueFormatError(const std::string& arg1,
117                                                const std::string& arg2,
118                                                const std::string& arg3);
119 
120 /**
121  * @brief Formats InternalError message into JSON
122  * Message body: "The request failed due to an internal service error.  The
123  * service is still operational."
124  *
125  *
126  * @returns Message InternalError formatted to JSON */
127 nlohmann::json internalError();
128 
129 /**
130  * @brief Formats UnrecognizedRequestBody message into JSON
131  * Message body: "The service detected a malformed request body that it was
132  * unable to interpret."
133  *
134  *
135  * @returns Message UnrecognizedRequestBody formatted to JSON */
136 nlohmann::json unrecognizedRequestBody();
137 
138 /**
139  * @brief Formats ResourceAtUriUnauthorized message into JSON
140  * Message body: "While accessing the resource at <arg0>, the service received
141  * an authorization error <arg1>."
142  *
143  * @param[in] arg1 Parameter of message that will replace %1 in its body.
144  * @param[in] arg2 Parameter of message that will replace %2 in its body.
145  *
146  * @returns Message ResourceAtUriUnauthorized formatted to JSON */
147 nlohmann::json resourceAtUriUnauthorized(const std::string& arg1,
148                                          const std::string& arg2);
149 
150 /**
151  * @brief Formats ActionParameterUnknown message into JSON
152  * Message body: "The action <arg0> was submitted with the invalid parameter
153  * <arg1>."
154  *
155  * @param[in] arg1 Parameter of message that will replace %1 in its body.
156  * @param[in] arg2 Parameter of message that will replace %2 in its body.
157  *
158  * @returns Message ActionParameterUnknown formatted to JSON */
159 nlohmann::json actionParameterUnknown(const std::string& arg1,
160                                       const std::string& arg2);
161 
162 /**
163  * @brief Formats ResourceCannotBeDeleted message into JSON
164  * Message body: "The delete request failed because the resource requested
165  * cannot be deleted."
166  *
167  *
168  * @returns Message ResourceCannotBeDeleted formatted to JSON */
169 nlohmann::json resourceCannotBeDeleted();
170 
171 /**
172  * @brief Formats PropertyDuplicate message into JSON
173  * Message body: "The property <arg0> was duplicated in the request."
174  *
175  * @param[in] arg1 Parameter of message that will replace %1 in its body.
176  *
177  * @returns Message PropertyDuplicate formatted to JSON */
178 nlohmann::json propertyDuplicate(const std::string& arg1);
179 
180 /**
181  * @brief Formats ServiceTemporarilyUnavailable message into JSON
182  * Message body: "The service is temporarily unavailable.  Retry in <arg0>
183  * seconds."
184  *
185  * @param[in] arg1 Parameter of message that will replace %1 in its body.
186  *
187  * @returns Message ServiceTemporarilyUnavailable formatted to JSON */
188 nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1);
189 
190 /**
191  * @brief Formats ResourceAlreadyExists message into JSON
192  * Message body: "The requested resource of type <arg0> with the property <arg1>
193  * with the value <arg2> already exists."
194  *
195  * @param[in] arg1 Parameter of message that will replace %1 in its body.
196  * @param[in] arg2 Parameter of message that will replace %2 in its body.
197  * @param[in] arg3 Parameter of message that will replace %3 in its body.
198  *
199  * @returns Message ResourceAlreadyExists formatted to JSON */
200 nlohmann::json resourceAlreadyExists(const std::string& arg1,
201                                      const std::string& arg2,
202                                      const std::string& arg3);
203 
204 /**
205  * @brief Formats AccountForSessionNoLongerExists message into JSON
206  * Message body: "The account for the current session has been removed, thus the
207  * current session has been removed as well."
208  *
209  *
210  * @returns Message AccountForSessionNoLongerExists formatted to JSON */
211 nlohmann::json accountForSessionNoLongerExists();
212 
213 /**
214  * @brief Formats CreateFailedMissingReqProperties message into JSON
215  * Message body: "The create operation failed because the required property
216  * <arg0> was missing from the request."
217  *
218  * @param[in] arg1 Parameter of message that will replace %1 in its body.
219  *
220  * @returns Message CreateFailedMissingReqProperties formatted to JSON */
221 nlohmann::json createFailedMissingReqProperties(const std::string& arg1);
222 
223 /**
224  * @brief Formats PropertyValueFormatError message into JSON
225  * Message body: "The value <arg0> for the property <arg1> is of a different
226  * format than the property can accept."
227  *
228  * @param[in] arg1 Parameter of message that will replace %1 in its body.
229  * @param[in] arg2 Parameter of message that will replace %2 in its body.
230  *
231  * @returns Message PropertyValueFormatError formatted to JSON */
232 nlohmann::json propertyValueFormatError(const std::string& arg1,
233                                         const std::string& arg2);
234 
235 /**
236  * @brief Formats PropertyValueNotInList message into JSON
237  * Message body: "The value <arg0> for the property <arg1> is not in the list of
238  * acceptable values."
239  *
240  * @param[in] arg1 Parameter of message that will replace %1 in its body.
241  * @param[in] arg2 Parameter of message that will replace %2 in its body.
242  *
243  * @returns Message PropertyValueNotInList formatted to JSON */
244 nlohmann::json propertyValueNotInList(const std::string& arg1,
245                                       const std::string& arg2);
246 
247 /**
248  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
249  * Message body: "The resource at <arg0> is in a format not recognized by the
250  * service."
251  *
252  * @param[in] arg1 Parameter of message that will replace %1 in its body.
253  *
254  * @returns Message ResourceAtUriInUnknownFormat formatted to JSON */
255 nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1);
256 
257 /**
258  * @brief Formats ServiceInUnknownState message into JSON
259  * Message body: "The operation failed because the service is in an unknown
260  * state and can no longer take incoming requests."
261  *
262  *
263  * @returns Message ServiceInUnknownState formatted to JSON */
264 nlohmann::json serviceInUnknownState();
265 
266 /**
267  * @brief Formats EventSubscriptionLimitExceeded message into JSON
268  * Message body: "The event subscription failed due to the number of
269  * simultaneous subscriptions exceeding the limit of the implementation."
270  *
271  *
272  * @returns Message EventSubscriptionLimitExceeded formatted to JSON */
273 nlohmann::json eventSubscriptionLimitExceeded();
274 
275 /**
276  * @brief Formats ActionParameterMissing message into JSON
277  * Message body: "The action <arg0> requires the parameter <arg1> to be present
278  * in the request body."
279  *
280  * @param[in] arg1 Parameter of message that will replace %1 in its body.
281  * @param[in] arg2 Parameter of message that will replace %2 in its body.
282  *
283  * @returns Message ActionParameterMissing formatted to JSON */
284 nlohmann::json actionParameterMissing(const std::string& arg1,
285                                       const std::string& arg2);
286 
287 /**
288  * @brief Formats StringValueTooLong message into JSON
289  * Message body: "The string <arg0> exceeds the length limit <arg1>."
290  *
291  * @param[in] arg1 Parameter of message that will replace %1 in its body.
292  * @param[in] arg2 Parameter of message that will replace %2 in its body.
293  *
294  * @returns Message StringValueTooLong formatted to JSON */
295 nlohmann::json stringValueTooLong(const std::string& arg1, const int& arg2);
296 
297 /**
298  * @brief Formats PropertyValueTypeError message into JSON
299  * Message body: "The value <arg0> for the property <arg1> is of a different
300  * type than the property can accept."
301  *
302  * @param[in] arg1 Parameter of message that will replace %1 in its body.
303  * @param[in] arg2 Parameter of message that will replace %2 in its body.
304  *
305  * @returns Message PropertyValueTypeError formatted to JSON */
306 nlohmann::json propertyValueTypeError(const std::string& arg1,
307                                       const std::string& arg2);
308 
309 /**
310  * @brief Formats ResourceNotFound message into JSON
311  * Message body: "The requested resource of type <arg0> named <arg1> was not
312  * found."
313  *
314  * @param[in] arg1 Parameter of message that will replace %1 in its body.
315  * @param[in] arg2 Parameter of message that will replace %2 in its body.
316  *
317  * @returns Message ResourceNotFound formatted to JSON */
318 nlohmann::json resourceNotFound(const std::string& arg1,
319                                 const std::string& arg2);
320 
321 /**
322  * @brief Formats CouldNotEstablishConnection message into JSON
323  * Message body: "The service failed to establish a Connection with the URI
324  * <arg0>."
325  *
326  * @param[in] arg1 Parameter of message that will replace %1 in its body.
327  *
328  * @returns Message CouldNotEstablishConnection formatted to JSON */
329 nlohmann::json couldNotEstablishConnection(const std::string& arg1);
330 
331 /**
332  * @brief Formats PropertyNotWritable message into JSON
333  * Message body: "The property <arg0> is a read only property and cannot be
334  * assigned a value."
335  *
336  * @param[in] arg1 Parameter of message that will replace %1 in its body.
337  *
338  * @returns Message PropertyNotWritable formatted to JSON */
339 nlohmann::json propertyNotWritable(const std::string& arg1);
340 
341 /**
342  * @brief Formats QueryParameterValueTypeError message into JSON
343  * Message body: "The value <arg0> for the query parameter <arg1> is of a
344  * different type than the parameter can accept."
345  *
346  * @param[in] arg1 Parameter of message that will replace %1 in its body.
347  * @param[in] arg2 Parameter of message that will replace %2 in its body.
348  *
349  * @returns Message QueryParameterValueTypeError formatted to JSON */
350 nlohmann::json queryParameterValueTypeError(const std::string& arg1,
351                                             const std::string& arg2);
352 
353 /**
354  * @brief Formats ServiceShuttingDown message into JSON
355  * Message body: "The operation failed because the service is shutting down and
356  * can no longer take incoming requests."
357  *
358  *
359  * @returns Message ServiceShuttingDown formatted to JSON */
360 nlohmann::json serviceShuttingDown();
361 
362 /**
363  * @brief Formats ActionParameterDuplicate message into JSON
364  * Message body: "The action <arg0> was submitted with more than one value for
365  * the parameter <arg1>."
366  *
367  * @param[in] arg1 Parameter of message that will replace %1 in its body.
368  * @param[in] arg2 Parameter of message that will replace %2 in its body.
369  *
370  * @returns Message ActionParameterDuplicate formatted to JSON */
371 nlohmann::json actionParameterDuplicate(const std::string& arg1,
372                                         const std::string& arg2);
373 
374 /**
375  * @brief Formats ActionParameterNotSupported message into JSON
376  * Message body: "The parameter <arg0> for the action <arg1> is not supported on
377  * the target resource."
378  *
379  * @param[in] arg1 Parameter of message that will replace %1 in its body.
380  * @param[in] arg2 Parameter of message that will replace %2 in its body.
381  *
382  * @returns Message ActionParameterNotSupported formatted to JSON */
383 nlohmann::json actionParameterNotSupported(const std::string& arg1,
384                                            const std::string& arg2);
385 
386 /**
387  * @brief Formats SourceDoesNotSupportProtocol message into JSON
388  * Message body: "The other end of the Connection at <arg0> does not support the
389  * specified protocol <arg1>."
390  *
391  * @param[in] arg1 Parameter of message that will replace %1 in its body.
392  * @param[in] arg2 Parameter of message that will replace %2 in its body.
393  *
394  * @returns Message SourceDoesNotSupportProtocol formatted to JSON */
395 nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1,
396                                             const std::string& arg2);
397 
398 /**
399  * @brief Formats AccountRemoved message into JSON
400  * Message body: "The account was successfully removed."
401  *
402  *
403  * @returns Message AccountRemoved formatted to JSON */
404 nlohmann::json accountRemoved();
405 
406 /**
407  * @brief Formats AccessDenied message into JSON
408  * Message body: "While attempting to establish a Connection to <arg0>, the
409  * service denied access."
410  *
411  * @param[in] arg1 Parameter of message that will replace %1 in its body.
412  *
413  * @returns Message AccessDenied formatted to JSON */
414 nlohmann::json accessDenied(const std::string& arg1);
415 
416 /**
417  * @brief Formats QueryNotSupported message into JSON
418  * Message body: "Querying is not supported by the implementation."
419  *
420  *
421  * @returns Message QueryNotSupported formatted to JSON */
422 nlohmann::json queryNotSupported();
423 
424 /**
425  * @brief Formats CreateLimitReachedForResource message into JSON
426  * Message body: "The create operation failed because the resource has reached
427  * the limit of possible resources."
428  *
429  *
430  * @returns Message CreateLimitReachedForResource formatted to JSON */
431 nlohmann::json createLimitReachedForResource();
432 
433 /**
434  * @brief Formats GeneralError message into JSON
435  * Message body: "A general error has occurred. See ExtendedInfo for more
436  * information."
437  *
438  *
439  * @returns Message GeneralError formatted to JSON */
440 nlohmann::json generalError();
441 
442 /**
443  * @brief Formats Success message into JSON
444  * Message body: "Successfully Completed Request"
445  *
446  *
447  * @returns Message Success formatted to JSON */
448 nlohmann::json success();
449 
450 /**
451  * @brief Formats Created message into JSON
452  * Message body: "The resource has been created successfully"
453  *
454  *
455  * @returns Message Created formatted to JSON */
456 nlohmann::json created();
457 
458 /**
459  * @brief Formats PropertyUnknown message into JSON
460  * Message body: "The property <arg0> is not in the list of valid properties for
461  * the resource."
462  *
463  * @param[in] arg1 Parameter of message that will replace %1 in its body.
464  *
465  * @returns Message PropertyUnknown formatted to JSON */
466 nlohmann::json propertyUnknown(const std::string& arg1);
467 
468 /**
469  * @brief Formats NoValidSession message into JSON
470  * Message body: "There is no valid session established with the
471  * implementation."
472  *
473  *
474  * @returns Message NoValidSession formatted to JSON */
475 nlohmann::json noValidSession();
476 
477 /**
478  * @brief Formats InvalidObject message into JSON
479  * Message body: "The object at <arg0> is invalid."
480  *
481  * @param[in] arg1 Parameter of message that will replace %1 in its body.
482  *
483  * @returns Message InvalidObject formatted to JSON */
484 nlohmann::json invalidObject(const std::string& arg1);
485 
486 /**
487  * @brief Formats ResourceInStandby message into JSON
488  * Message body: "The request could not be performed because the resource is in
489  * standby."
490  *
491  *
492  * @returns Message ResourceInStandby formatted to JSON */
493 nlohmann::json resourceInStandby();
494 
495 /**
496  * @brief Formats ActionParameterValueTypeError message into JSON
497  * Message body: "The value <arg0> for the parameter <arg1> in the action <arg2>
498  * is of a different type than the parameter can accept."
499  *
500  * @param[in] arg1 Parameter of message that will replace %1 in its body.
501  * @param[in] arg2 Parameter of message that will replace %2 in its body.
502  * @param[in] arg3 Parameter of message that will replace %3 in its body.
503  *
504  * @returns Message ActionParameterValueTypeError formatted to JSON */
505 nlohmann::json actionParameterValueTypeError(const std::string& arg1,
506                                              const std::string& arg2,
507                                              const std::string& arg3);
508 
509 /**
510  * @brief Formats SessionLimitExceeded message into JSON
511  * Message body: "The session establishment failed due to the number of
512  * simultaneous sessions exceeding the limit of the implementation."
513  *
514  *
515  * @returns Message SessionLimitExceeded formatted to JSON */
516 nlohmann::json sessionLimitExceeded();
517 
518 /**
519  * @brief Formats ActionNotSupported message into JSON
520  * Message body: "The action <arg0> is not supported by the resource."
521  *
522  * @param[in] arg1 Parameter of message that will replace %1 in its body.
523  *
524  * @returns Message ActionNotSupported formatted to JSON */
525 nlohmann::json actionNotSupported(const std::string& arg1);
526 
527 /**
528  * @brief Formats InvalidIndex message into JSON
529  * Message body: "The index <arg0> is not a valid offset into the array."
530  *
531  * @param[in] arg1 Parameter of message that will replace %1 in its body.
532  *
533  * @returns Message InvalidIndex formatted to JSON */
534 nlohmann::json invalidIndex(const int& arg1);
535 
536 /**
537  * @brief Formats EmptyJSON message into JSON
538  * Message body: "The request body submitted contained an empty JSON object and
539  * the service is unable to process it."
540  *
541  *
542  * @returns Message EmptyJSON formatted to JSON */
543 nlohmann::json emptyJSON();
544 
545 /**
546  * @brief Formats QueryNotSupportedOnResource message into JSON
547  * Message body: "Querying is not supported on the requested resource."
548  *
549  *
550  * @returns Message QueryNotSupportedOnResource formatted to JSON */
551 nlohmann::json queryNotSupportedOnResource();
552 
553 /**
554  * @brief Formats InsufficientPrivilege message into JSON
555  * Message body: "There are insufficient privileges for the account or
556  * credentials associated with the current session to perform the requested
557  * operation."
558  *
559  *
560  * @returns Message InsufficientPrivilege formatted to JSON */
561 nlohmann::json insufficientPrivilege();
562 
563 /**
564  * @brief Formats PropertyValueModified message into JSON
565  * Message body: "The property <arg0> was assigned the value <arg1> due to
566  * modification by the service."
567  *
568  * @param[in] arg1 Parameter of message that will replace %1 in its body.
569  * @param[in] arg2 Parameter of message that will replace %2 in its body.
570  *
571  * @returns Message PropertyValueModified formatted to JSON */
572 nlohmann::json propertyValueModified(const std::string& arg1,
573                                      const std::string& arg2);
574 
575 /**
576  * @brief Formats AccountNotModified message into JSON
577  * Message body: "The account modification request failed."
578  *
579  *
580  * @returns Message AccountNotModified formatted to JSON */
581 nlohmann::json accountNotModified();
582 
583 /**
584  * @brief Formats QueryParameterValueFormatError message into JSON
585  * Message body: "The value <arg0> for the parameter <arg1> is of a different
586  * format than the parameter can accept."
587  *
588  * @param[in] arg1 Parameter of message that will replace %1 in its body.
589  * @param[in] arg2 Parameter of message that will replace %2 in its body.
590  *
591  * @returns Message QueryParameterValueFormatError formatted to JSON */
592 nlohmann::json queryParameterValueFormatError(const std::string& arg1,
593                                               const std::string& arg2);
594 
595 /**
596  * @brief Formats PropertyMissing message into JSON
597  * Message body: "The property <arg0> is a required property and must be
598  * included in the request."
599  *
600  * @param[in] arg1 Parameter of message that will replace %1 in its body.
601  *
602  * @returns Message PropertyMissing formatted to JSON */
603 nlohmann::json propertyMissing(const std::string& arg1);
604 
605 /**
606  * @brief Formats ResourceExhaustion message into JSON
607  * Message body: "The resource <arg0> was unable to satisfy the request due to
608  * unavailability of resources."
609  *
610  * @param[in] arg1 Parameter of message that will replace %1 in its body.
611  *
612  * @returns Message ResourceExhaustion formatted to JSON */
613 nlohmann::json resourceExhaustion(const std::string& arg1);
614 
615 /**
616  * @brief Formats AccountModified message into JSON
617  * Message body: "The account was successfully modified."
618  *
619  *
620  * @returns Message AccountModified formatted to JSON */
621 nlohmann::json accountModified();
622 
623 /**
624  * @brief Formats QueryParameterOutOfRange message into JSON
625  * Message body: "The value <arg0> for the query parameter <arg1> is out of
626  * range <arg2>."
627  *
628  * @param[in] arg1 Parameter of message that will replace %1 in its body.
629  * @param[in] arg2 Parameter of message that will replace %2 in its body.
630  * @param[in] arg3 Parameter of message that will replace %3 in its body.
631  *
632  * @returns Message QueryParameterOutOfRange formatted to JSON */
633 nlohmann::json queryParameterOutOfRange(const std::string& arg1,
634                                         const std::string& arg2,
635                                         const std::string& arg3);
636 
637 /*********************************
638  * AUTOGENERATED FUNCTIONS END *
639  *********************************/
640 
641 } // namespace messages
642 
643 } // namespace redfish
644