xref: /openbmc/bmcweb/features/redfish/src/error_messages.cpp (revision 789fdab3cfb9ae8e3338b9d855ef3dc144ed173f)
1f4c4dcf4SKowalski, Kamil /*
2f4c4dcf4SKowalski, Kamil // Copyright (c) 2018 Intel Corporation
3f4c4dcf4SKowalski, Kamil //
4f4c4dcf4SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License");
5f4c4dcf4SKowalski, Kamil // you may not use this file except in compliance with the License.
6f4c4dcf4SKowalski, Kamil // You may obtain a copy of the License at
7f4c4dcf4SKowalski, Kamil //
8f4c4dcf4SKowalski, Kamil //      http://www.apache.org/licenses/LICENSE-2.0
9f4c4dcf4SKowalski, Kamil //
10f4c4dcf4SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software
11f4c4dcf4SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS,
12f4c4dcf4SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f4c4dcf4SKowalski, Kamil // See the License for the specific language governing permissions and
14f4c4dcf4SKowalski, Kamil // limitations under the License.
15f4c4dcf4SKowalski, Kamil */
16c94ad49bSEd Tanous #include <logging.h>
17f4c4dcf4SKowalski, Kamil 
181abe55efSEd Tanous #include <error_messages.hpp>
19f4c4dcf4SKowalski, Kamil 
201abe55efSEd Tanous namespace redfish
211abe55efSEd Tanous {
221abe55efSEd Tanous 
231abe55efSEd Tanous namespace messages
241abe55efSEd Tanous {
25f4c4dcf4SKowalski, Kamil 
26f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target,
271abe55efSEd Tanous                                   const nlohmann::json& message)
281abe55efSEd Tanous {
29f4c4dcf4SKowalski, Kamil     auto& error = target["error"];
30f4c4dcf4SKowalski, Kamil 
311abe55efSEd Tanous     // If this is the first error message, fill in the information from the
321abe55efSEd Tanous     // first error message to the top level struct
331abe55efSEd Tanous     if (!error.is_object())
341abe55efSEd Tanous     {
35c074230bSJason M. Bills         auto messageIdIterator = message.find("MessageId");
36c074230bSJason M. Bills         if (messageIdIterator == message.end())
371abe55efSEd Tanous         {
381abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
391abe55efSEd Tanous                 << "Attempt to add error message without MessageId";
40f4c4dcf4SKowalski, Kamil             return;
41f4c4dcf4SKowalski, Kamil         }
42f4c4dcf4SKowalski, Kamil 
43c074230bSJason M. Bills         auto messageFieldIterator = message.find("Message");
44c074230bSJason M. Bills         if (messageFieldIterator == message.end())
451abe55efSEd Tanous         {
461abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
471abe55efSEd Tanous                 << "Attempt to add error message without Message";
48f4c4dcf4SKowalski, Kamil             return;
49f4c4dcf4SKowalski, Kamil         }
50c21055aaSEd Tanous         error = {{"code", *messageIdIterator},
51c21055aaSEd Tanous                  {"message", *messageFieldIterator}};
521abe55efSEd Tanous     }
531abe55efSEd Tanous     else
541abe55efSEd Tanous     {
55f4c4dcf4SKowalski, Kamil         // More than 1 error occurred, so the message has to be generic
5655c7b7a2SEd Tanous         error["code"] = std::string(messageVersionPrefix) + "GeneralError";
57cc9139ecSJason M. Bills         error["message"] = "A general error has occurred. See Resolution for "
58cc9139ecSJason M. Bills                            "information on how to resolve the error.";
59f4c4dcf4SKowalski, Kamil     }
60f4c4dcf4SKowalski, Kamil 
61f4c4dcf4SKowalski, Kamil     // This check could technically be done in in the default construction
62f4c4dcf4SKowalski, Kamil     // branch above, but because we need the pointer to the extended info field
63f4c4dcf4SKowalski, Kamil     // anyway, it's more efficient to do it here.
64c074230bSJason M. Bills     auto& extendedInfo = error[messages::messageAnnotation];
65c074230bSJason M. Bills     if (!extendedInfo.is_array())
661abe55efSEd Tanous     {
67c074230bSJason M. Bills         extendedInfo = nlohmann::json::array();
68f4c4dcf4SKowalski, Kamil     }
69f4c4dcf4SKowalski, Kamil 
70c074230bSJason M. Bills     extendedInfo.push_back(message);
71f4c4dcf4SKowalski, Kamil }
72f4c4dcf4SKowalski, Kamil 
73f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target,
74f12894f8SJason M. Bills                                  const nlohmann::json& message)
751abe55efSEd Tanous {
761abe55efSEd Tanous     if (!target[messages::messageAnnotation].is_array())
771abe55efSEd Tanous     {
78f4c4dcf4SKowalski, Kamil         // Force object to be an array
7955c7b7a2SEd Tanous         target[messages::messageAnnotation] = nlohmann::json::array();
80f4c4dcf4SKowalski, Kamil     }
81f4c4dcf4SKowalski, Kamil 
8255c7b7a2SEd Tanous     target[messages::messageAnnotation].push_back(message);
83f4c4dcf4SKowalski, Kamil }
84f4c4dcf4SKowalski, Kamil 
85f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target,
86f12894f8SJason M. Bills                              const nlohmann::json& message,
871abe55efSEd Tanous                              const std::string& fieldPath)
881abe55efSEd Tanous {
89a08b46ccSJason M. Bills     std::string extendedInfo(fieldPath + messages::messageAnnotation);
90f4c4dcf4SKowalski, Kamil 
911abe55efSEd Tanous     if (!target[extendedInfo].is_array())
921abe55efSEd Tanous     {
93f4c4dcf4SKowalski, Kamil         // Force object to be an array
94f4c4dcf4SKowalski, Kamil         target[extendedInfo] = nlohmann::json::array();
95f4c4dcf4SKowalski, Kamil     }
96f4c4dcf4SKowalski, Kamil 
97f4c4dcf4SKowalski, Kamil     // Object exists and it is an array so we can just push in the message
98f4c4dcf4SKowalski, Kamil     target[extendedInfo].push_back(message);
99f4c4dcf4SKowalski, Kamil }
100f4c4dcf4SKowalski, Kamil 
101f4c4dcf4SKowalski, Kamil /**
102f4c4dcf4SKowalski, Kamil  * @internal
103f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInUse message into JSON
104f4c4dcf4SKowalski, Kamil  *
105f4c4dcf4SKowalski, Kamil  * See header file for more information
106f4c4dcf4SKowalski, Kamil  * @endinternal
107f4c4dcf4SKowalski, Kamil  */
108b5c07418SJames Feist nlohmann::json resourceInUse(void)
1091abe55efSEd Tanous {
110b5c07418SJames Feist     return nlohmann::json{
111b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
112684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceInUse"},
11366ac2b8cSJason M. Bills         {"Message", "The change to the requested resource failed because "
11466ac2b8cSJason M. Bills                     "the resource is in use or in transition."},
11585659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
116684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
11766ac2b8cSJason M. Bills         {"Resolution", "Remove the condition and resubmit the request if "
118b5c07418SJames Feist                        "the operation failed."}};
119b5c07418SJames Feist }
120b5c07418SJames Feist 
121b5c07418SJames Feist void resourceInUse(crow::Response& res)
122b5c07418SJames Feist {
123b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
124b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInUse());
125f4c4dcf4SKowalski, Kamil }
126f4c4dcf4SKowalski, Kamil 
127f4c4dcf4SKowalski, Kamil /**
128f4c4dcf4SKowalski, Kamil  * @internal
129f4c4dcf4SKowalski, Kamil  * @brief Formats MalformedJSON message into JSON
130f4c4dcf4SKowalski, Kamil  *
131f4c4dcf4SKowalski, Kamil  * See header file for more information
132f4c4dcf4SKowalski, Kamil  * @endinternal
133f4c4dcf4SKowalski, Kamil  */
134b5c07418SJames Feist nlohmann::json malformedJSON(void)
1351abe55efSEd Tanous {
136b5c07418SJames Feist     return nlohmann::json{
137b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
138684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.MalformedJSON"},
13966ac2b8cSJason M. Bills         {"Message", "The request body submitted was malformed JSON and "
14066ac2b8cSJason M. Bills                     "could not be parsed by the receiving service."},
14185659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
142684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1431abe55efSEd Tanous         {"Resolution", "Ensure that the request body is valid JSON and "
144b5c07418SJames Feist                        "resubmit the request."}};
145b5c07418SJames Feist }
146b5c07418SJames Feist 
147b5c07418SJames Feist void malformedJSON(crow::Response& res)
148b5c07418SJames Feist {
149b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
150b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, malformedJSON());
151f4c4dcf4SKowalski, Kamil }
152f4c4dcf4SKowalski, Kamil 
153f4c4dcf4SKowalski, Kamil /**
154f4c4dcf4SKowalski, Kamil  * @internal
155f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceMissingAtURI message into JSON
156f4c4dcf4SKowalski, Kamil  *
157f4c4dcf4SKowalski, Kamil  * See header file for more information
158f4c4dcf4SKowalski, Kamil  * @endinternal
159f4c4dcf4SKowalski, Kamil  */
160b5c07418SJames Feist nlohmann::json resourceMissingAtURI(const std::string& arg1)
1611abe55efSEd Tanous {
162b5c07418SJames Feist     return nlohmann::json{
163b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
164684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceMissingAtURI"},
165f4c4dcf4SKowalski, Kamil         {"Message", "The resource at the URI " + arg1 + " was not found."},
16685659adfSJason M. Bills         {"MessageArgs", {arg1}},
167684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
16866ac2b8cSJason M. Bills         {"Resolution", "Place a valid resource at the URI or correct the "
169b5c07418SJames Feist                        "URI and resubmit the request."}};
170b5c07418SJames Feist }
171b5c07418SJames Feist 
172b5c07418SJames Feist void resourceMissingAtURI(crow::Response& res, const std::string& arg1)
173b5c07418SJames Feist {
174b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
175b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
176f4c4dcf4SKowalski, Kamil }
177f4c4dcf4SKowalski, Kamil 
178f4c4dcf4SKowalski, Kamil /**
179f4c4dcf4SKowalski, Kamil  * @internal
180f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueFormatError message into JSON
181f4c4dcf4SKowalski, Kamil  *
182f4c4dcf4SKowalski, Kamil  * See header file for more information
183f4c4dcf4SKowalski, Kamil  * @endinternal
184f4c4dcf4SKowalski, Kamil  */
185b5c07418SJames Feist nlohmann::json actionParameterValueFormatError(const std::string& arg1,
186f4c4dcf4SKowalski, Kamil                                                const std::string& arg2,
1871abe55efSEd Tanous                                                const std::string& arg3)
1881abe55efSEd Tanous {
189b5c07418SJames Feist     return nlohmann::json{
190b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
191684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterValueFormatError"},
192f4c4dcf4SKowalski, Kamil         {"Message",
1931abe55efSEd Tanous          "The value " + arg1 + " for the parameter " + arg2 +
1941abe55efSEd Tanous              " in the action " + arg3 +
1951abe55efSEd Tanous              " is of a different format than the parameter can accept."},
19685659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
197684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
19866ac2b8cSJason M. Bills         {"Resolution",
19966ac2b8cSJason M. Bills          "Correct the value for the parameter in the request body and "
200b5c07418SJames Feist          "resubmit the request if the operation failed."}};
201b5c07418SJames Feist }
202b5c07418SJames Feist 
203b5c07418SJames Feist void actionParameterValueFormatError(crow::Response& res,
204b5c07418SJames Feist                                      const std::string& arg1,
205b5c07418SJames Feist                                      const std::string& arg2,
206b5c07418SJames Feist                                      const std::string& arg3)
207b5c07418SJames Feist {
208b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
209b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
210b5c07418SJames Feist                           actionParameterValueFormatError(arg1, arg2, arg3));
211f4c4dcf4SKowalski, Kamil }
212f4c4dcf4SKowalski, Kamil 
213f4c4dcf4SKowalski, Kamil /**
214f4c4dcf4SKowalski, Kamil  * @internal
215f4c4dcf4SKowalski, Kamil  * @brief Formats InternalError message into JSON
216f4c4dcf4SKowalski, Kamil  *
217f4c4dcf4SKowalski, Kamil  * See header file for more information
218f4c4dcf4SKowalski, Kamil  * @endinternal
219f4c4dcf4SKowalski, Kamil  */
220b5c07418SJames Feist nlohmann::json internalError(void)
2211abe55efSEd Tanous {
222b5c07418SJames Feist     return nlohmann::json{
223b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
224684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InternalError"},
225f12894f8SJason M. Bills         {"Message", "The request failed due to an internal service error.  "
22666ac2b8cSJason M. Bills                     "The service is still operational."},
22785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
228684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
2291abe55efSEd Tanous         {"Resolution", "Resubmit the request.  If the problem persists, "
230b5c07418SJames Feist                        "consider resetting the service."}};
231b5c07418SJames Feist }
232b5c07418SJames Feist 
233b5c07418SJames Feist void internalError(crow::Response& res)
234b5c07418SJames Feist {
235b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
236b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, internalError());
237f12894f8SJason M. Bills }
238f12894f8SJason M. Bills 
239f12894f8SJason M. Bills /**
240f12894f8SJason M. Bills  * @internal
241f4c4dcf4SKowalski, Kamil  * @brief Formats UnrecognizedRequestBody message into JSON
242f4c4dcf4SKowalski, Kamil  *
243f4c4dcf4SKowalski, Kamil  * See header file for more information
244f4c4dcf4SKowalski, Kamil  * @endinternal
245f4c4dcf4SKowalski, Kamil  */
246b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void)
2471abe55efSEd Tanous {
248b5c07418SJames Feist     return nlohmann::json{
249b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
250684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.UnrecognizedRequestBody"},
251f12894f8SJason M. Bills         {"Message", "The service detected a malformed request body that it "
25266ac2b8cSJason M. Bills                     "was unable to interpret."},
25385659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
254684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
255f12894f8SJason M. Bills         {"Resolution", "Correct the request body and resubmit the request "
256b5c07418SJames Feist                        "if it failed."}};
257b5c07418SJames Feist }
258b5c07418SJames Feist 
259b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res)
260b5c07418SJames Feist {
261b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
262b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
263f4c4dcf4SKowalski, Kamil }
264f4c4dcf4SKowalski, Kamil 
265f4c4dcf4SKowalski, Kamil /**
266f4c4dcf4SKowalski, Kamil  * @internal
267f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriUnauthorized message into JSON
268f4c4dcf4SKowalski, Kamil  *
269f4c4dcf4SKowalski, Kamil  * See header file for more information
270f4c4dcf4SKowalski, Kamil  * @endinternal
271f4c4dcf4SKowalski, Kamil  */
272b5c07418SJames Feist nlohmann::json resourceAtUriUnauthorized(const std::string& arg1,
2731abe55efSEd Tanous                                          const std::string& arg2)
2741abe55efSEd Tanous {
275b5c07418SJames Feist     return nlohmann::json{
276b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
277684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAtUriUnauthorized"},
278f4c4dcf4SKowalski, Kamil         {"Message", "While accessing the resource at " + arg1 +
2791abe55efSEd Tanous                         ", the service received an authorization error " +
2801abe55efSEd Tanous                         arg2 + "."},
28185659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
282684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
283f12894f8SJason M. Bills         {"Resolution", "Ensure that the appropriate access is provided for "
284b5c07418SJames Feist                        "the service in order for it to access the URI."}};
285b5c07418SJames Feist }
286b5c07418SJames Feist 
287b5c07418SJames Feist void resourceAtUriUnauthorized(crow::Response& res, const std::string& arg1,
288b5c07418SJames Feist                                const std::string& arg2)
289b5c07418SJames Feist {
290b5c07418SJames Feist     res.result(boost::beast::http::status::unauthorized);
291b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
292f4c4dcf4SKowalski, Kamil }
293f4c4dcf4SKowalski, Kamil 
294f4c4dcf4SKowalski, Kamil /**
295f4c4dcf4SKowalski, Kamil  * @internal
296f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterUnknown message into JSON
297f4c4dcf4SKowalski, Kamil  *
298f4c4dcf4SKowalski, Kamil  * See header file for more information
299f4c4dcf4SKowalski, Kamil  * @endinternal
300f4c4dcf4SKowalski, Kamil  */
301b5c07418SJames Feist nlohmann::json actionParameterUnknown(const std::string& arg1,
302b5c07418SJames Feist                                       const std::string& arg2)
303b5c07418SJames Feist {
304b5c07418SJames Feist     return nlohmann::json{
305b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
306684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterUnknown"},
307b5c07418SJames Feist         {"Message", "The action " + arg1 +
308b5c07418SJames Feist                         " was submitted with the invalid parameter " + arg2 +
309b5c07418SJames Feist                         "."},
310b5c07418SJames Feist         {"MessageArgs", {arg1, arg2}},
311684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
312b5c07418SJames Feist         {"Resolution", "Correct the invalid parameter and resubmit the "
313b5c07418SJames Feist                        "request if the operation failed."}};
314b5c07418SJames Feist }
315b5c07418SJames Feist 
316f12894f8SJason M. Bills void actionParameterUnknown(crow::Response& res, const std::string& arg1,
3171abe55efSEd Tanous                             const std::string& arg2)
3181abe55efSEd Tanous {
319f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
320b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
321f4c4dcf4SKowalski, Kamil }
322f4c4dcf4SKowalski, Kamil 
323f4c4dcf4SKowalski, Kamil /**
324f4c4dcf4SKowalski, Kamil  * @internal
325f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceCannotBeDeleted message into JSON
326f4c4dcf4SKowalski, Kamil  *
327f4c4dcf4SKowalski, Kamil  * See header file for more information
328f4c4dcf4SKowalski, Kamil  * @endinternal
329f4c4dcf4SKowalski, Kamil  */
330b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void)
3311abe55efSEd Tanous {
332b5c07418SJames Feist     return nlohmann::json{
333b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
334684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceCannotBeDeleted"},
335f12894f8SJason M. Bills         {"Message", "The delete request failed because the resource "
33666ac2b8cSJason M. Bills                     "requested cannot be deleted."},
33785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
338684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
339b5c07418SJames Feist         {"Resolution", "Do not attempt to delete a non-deletable resource."}};
340b5c07418SJames Feist }
341b5c07418SJames Feist 
342b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res)
343b5c07418SJames Feist {
344b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
345b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
346f4c4dcf4SKowalski, Kamil }
347f4c4dcf4SKowalski, Kamil 
348f4c4dcf4SKowalski, Kamil /**
349f4c4dcf4SKowalski, Kamil  * @internal
350f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyDuplicate message into JSON
351f4c4dcf4SKowalski, Kamil  *
352f4c4dcf4SKowalski, Kamil  * See header file for more information
353f4c4dcf4SKowalski, Kamil  * @endinternal
354f4c4dcf4SKowalski, Kamil  */
355b5c07418SJames Feist nlohmann::json propertyDuplicate(const std::string& arg1)
3561abe55efSEd Tanous {
357b5c07418SJames Feist     return nlohmann::json{
358b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
359684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyDuplicate"},
360b5c07418SJames Feist         {"Message", "The property " + arg1 + " was duplicated in the request."},
36185659adfSJason M. Bills         {"MessageArgs", {arg1}},
362684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
36366ac2b8cSJason M. Bills         {"Resolution",
36466ac2b8cSJason M. Bills          "Remove the duplicate property from the request body and resubmit "
365b5c07418SJames Feist          "the request if the operation failed."}};
366b5c07418SJames Feist }
367b5c07418SJames Feist 
368b5c07418SJames Feist void propertyDuplicate(crow::Response& res, const std::string& arg1)
369b5c07418SJames Feist {
370b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
371b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1);
372f4c4dcf4SKowalski, Kamil }
373f4c4dcf4SKowalski, Kamil 
374f4c4dcf4SKowalski, Kamil /**
375f4c4dcf4SKowalski, Kamil  * @internal
376f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceTemporarilyUnavailable message into JSON
377f4c4dcf4SKowalski, Kamil  *
378f4c4dcf4SKowalski, Kamil  * See header file for more information
379f4c4dcf4SKowalski, Kamil  * @endinternal
380f4c4dcf4SKowalski, Kamil  */
381b5c07418SJames Feist nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1)
3821abe55efSEd Tanous {
383b5c07418SJames Feist     return nlohmann::json{
384b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
385684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceTemporarilyUnavailable"},
3861abe55efSEd Tanous         {"Message", "The service is temporarily unavailable.  Retry in " +
3871abe55efSEd Tanous                         arg1 + " seconds."},
38885659adfSJason M. Bills         {"MessageArgs", {arg1}},
389684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
390f12894f8SJason M. Bills         {"Resolution", "Wait for the indicated retry duration and retry "
391b5c07418SJames Feist                        "the operation."}};
392b5c07418SJames Feist }
393b5c07418SJames Feist 
394b5c07418SJames Feist void serviceTemporarilyUnavailable(crow::Response& res, const std::string& arg1)
395b5c07418SJames Feist {
396b5c07418SJames Feist     res.addHeader("Retry-After", arg1);
397b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
398b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
399f4c4dcf4SKowalski, Kamil }
400f4c4dcf4SKowalski, Kamil 
401f4c4dcf4SKowalski, Kamil /**
402f4c4dcf4SKowalski, Kamil  * @internal
403f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAlreadyExists message into JSON
404f4c4dcf4SKowalski, Kamil  *
405f4c4dcf4SKowalski, Kamil  * See header file for more information
406f4c4dcf4SKowalski, Kamil  * @endinternal
407f4c4dcf4SKowalski, Kamil  */
408b5c07418SJames Feist nlohmann::json resourceAlreadyExists(const std::string& arg1,
409b5c07418SJames Feist                                      const std::string& arg2,
410b5c07418SJames Feist                                      const std::string& arg3)
4111abe55efSEd Tanous {
412b5c07418SJames Feist     return nlohmann::json{
413b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
414684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAlreadyExists"},
415f4c4dcf4SKowalski, Kamil         {"Message", "The requested resource of type " + arg1 +
4161abe55efSEd Tanous                         " with the property " + arg2 + " with the value " +
4171abe55efSEd Tanous                         arg3 + " already exists."},
41885659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
419684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
420f12894f8SJason M. Bills         {"Resolution", "Do not repeat the create operation as the resource "
421b5c07418SJames Feist                        "has already been created."}};
422b5c07418SJames Feist }
423b5c07418SJames Feist 
424b5c07418SJames Feist void resourceAlreadyExists(crow::Response& res, const std::string& arg1,
425b5c07418SJames Feist                            const std::string& arg2, const std::string& arg3)
426b5c07418SJames Feist {
427b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
428b5c07418SJames Feist     addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
429a08b46ccSJason M. Bills                      arg2);
430f4c4dcf4SKowalski, Kamil }
431f4c4dcf4SKowalski, Kamil 
432f4c4dcf4SKowalski, Kamil /**
433f4c4dcf4SKowalski, Kamil  * @internal
434f4c4dcf4SKowalski, Kamil  * @brief Formats AccountForSessionNoLongerExists message into JSON
435f4c4dcf4SKowalski, Kamil  *
436f4c4dcf4SKowalski, Kamil  * See header file for more information
437f4c4dcf4SKowalski, Kamil  * @endinternal
438f4c4dcf4SKowalski, Kamil  */
439b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void)
4401abe55efSEd Tanous {
441b5c07418SJames Feist     return nlohmann::json{
442b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
443684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccountForSessionNoLongerExists"},
4441abe55efSEd Tanous         {"Message", "The account for the current session has been removed, "
44566ac2b8cSJason M. Bills                     "thus the current session has been removed as well."},
44685659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
447684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
448b5c07418SJames Feist         {"Resolution", "Attempt to connect with a valid account."}};
449b5c07418SJames Feist }
450b5c07418SJames Feist 
451b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res)
452b5c07418SJames Feist {
453b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
454b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
455f4c4dcf4SKowalski, Kamil }
456f4c4dcf4SKowalski, Kamil 
457f4c4dcf4SKowalski, Kamil /**
458f4c4dcf4SKowalski, Kamil  * @internal
459f4c4dcf4SKowalski, Kamil  * @brief Formats CreateFailedMissingReqProperties message into JSON
460f4c4dcf4SKowalski, Kamil  *
461f4c4dcf4SKowalski, Kamil  * See header file for more information
462f4c4dcf4SKowalski, Kamil  * @endinternal
463f4c4dcf4SKowalski, Kamil  */
464b5c07418SJames Feist nlohmann::json createFailedMissingReqProperties(const std::string& arg1)
4651abe55efSEd Tanous {
466b5c07418SJames Feist     return nlohmann::json{
467b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
468684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CreateFailedMissingReqProperties"},
4691abe55efSEd Tanous         {"Message",
470b5c07418SJames Feist          "The create operation failed because the required property " + arg1 +
471b5c07418SJames Feist              " was missing from the request."},
47285659adfSJason M. Bills         {"MessageArgs", {arg1}},
473684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
474f4c4dcf4SKowalski, Kamil         {"Resolution",
475f12894f8SJason M. Bills          "Correct the body to include the required property with a valid "
476b5c07418SJames Feist          "value and resubmit the request if the operation failed."}};
477b5c07418SJames Feist }
478b5c07418SJames Feist 
479b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res,
480b5c07418SJames Feist                                       const std::string& arg1)
481b5c07418SJames Feist {
482b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
483b5c07418SJames Feist     addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
484a08b46ccSJason M. Bills                      arg1);
485f12894f8SJason M. Bills }
486f12894f8SJason M. Bills 
487f12894f8SJason M. Bills /**
488f12894f8SJason M. Bills  * @internal
489f12894f8SJason M. Bills  * @brief Formats PropertyValueFormatError message into JSON for the specified
490f12894f8SJason M. Bills  * property
491f12894f8SJason M. Bills  *
492f12894f8SJason M. Bills  * See header file for more information
493f12894f8SJason M. Bills  * @endinternal
494f12894f8SJason M. Bills  */
495b5c07418SJames Feist nlohmann::json propertyValueFormatError(const std::string& arg1,
496a08b46ccSJason M. Bills                                         const std::string& arg2)
497f12894f8SJason M. Bills {
498b5c07418SJames Feist     return nlohmann::json{
499b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
500684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueFormatError"},
501f12894f8SJason M. Bills         {"Message",
502f12894f8SJason M. Bills          "The value " + arg1 + " for the property " + arg2 +
503f12894f8SJason M. Bills              " is of a different format than the property can accept."},
50485659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
505684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
50666ac2b8cSJason M. Bills         {"Resolution",
50766ac2b8cSJason M. Bills          "Correct the value for the property in the request body and "
508b5c07418SJames Feist          "resubmit the request if the operation failed."}};
509b5c07418SJames Feist }
510b5c07418SJames Feist 
511b5c07418SJames Feist void propertyValueFormatError(crow::Response& res, const std::string& arg1,
512b5c07418SJames Feist                               const std::string& arg2)
513b5c07418SJames Feist {
514b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
515b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2);
516f12894f8SJason M. Bills }
517f12894f8SJason M. Bills 
518f12894f8SJason M. Bills /**
519f12894f8SJason M. Bills  * @internal
520f12894f8SJason M. Bills  * @brief Formats PropertyValueNotInList message into JSON for the specified
521f12894f8SJason M. Bills  * property
522f12894f8SJason M. Bills  *
523f12894f8SJason M. Bills  * See header file for more information
524f12894f8SJason M. Bills  * @endinternal
525f12894f8SJason M. Bills  */
526b5c07418SJames Feist nlohmann::json propertyValueNotInList(const std::string& arg1,
527a08b46ccSJason M. Bills                                       const std::string& arg2)
528f12894f8SJason M. Bills {
529b5c07418SJames Feist     return nlohmann::json{
530b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
531684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueNotInList"},
532f12894f8SJason M. Bills         {"Message", "The value " + arg1 + " for the property " + arg2 +
533f12894f8SJason M. Bills                         " is not in the list of acceptable values."},
53485659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
535684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
536b5c07418SJames Feist         {"Resolution", "Choose a value from the enumeration list that "
537b5c07418SJames Feist                        "the implementation "
538b5c07418SJames Feist                        "can support and resubmit the request if the "
539b5c07418SJames Feist                        "operation failed."}};
540b5c07418SJames Feist }
541b5c07418SJames Feist 
542b5c07418SJames Feist void propertyValueNotInList(crow::Response& res, const std::string& arg1,
543b5c07418SJames Feist                             const std::string& arg2)
544b5c07418SJames Feist {
545b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
546b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2);
547f4c4dcf4SKowalski, Kamil }
548f4c4dcf4SKowalski, Kamil 
549f4c4dcf4SKowalski, Kamil /**
550f4c4dcf4SKowalski, Kamil  * @internal
551f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
552f4c4dcf4SKowalski, Kamil  *
553f4c4dcf4SKowalski, Kamil  * See header file for more information
554f4c4dcf4SKowalski, Kamil  * @endinternal
555f4c4dcf4SKowalski, Kamil  */
556b5c07418SJames Feist nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1)
5571abe55efSEd Tanous {
558b5c07418SJames Feist     return nlohmann::json{
559b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
560684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAtUriInUnknownFormat"},
561f4c4dcf4SKowalski, Kamil         {"Message", "The resource at " + arg1 +
562f4c4dcf4SKowalski, Kamil                         " is in a format not recognized by the service."},
56385659adfSJason M. Bills         {"MessageArgs", {arg1}},
564684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
565f12894f8SJason M. Bills         {"Resolution", "Place an image or resource or file that is "
566b5c07418SJames Feist                        "recognized by the service at the URI."}};
567b5c07418SJames Feist }
568b5c07418SJames Feist 
569b5c07418SJames Feist void resourceAtUriInUnknownFormat(crow::Response& res, const std::string& arg1)
570b5c07418SJames Feist {
571b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
572b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
573f4c4dcf4SKowalski, Kamil }
574f4c4dcf4SKowalski, Kamil 
575f4c4dcf4SKowalski, Kamil /**
576f4c4dcf4SKowalski, Kamil  * @internal
577f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceInUnknownState message into JSON
578f4c4dcf4SKowalski, Kamil  *
579f4c4dcf4SKowalski, Kamil  * See header file for more information
580f4c4dcf4SKowalski, Kamil  * @endinternal
581f4c4dcf4SKowalski, Kamil  */
582b5c07418SJames Feist nlohmann::json serviceInUnknownState(void)
5831abe55efSEd Tanous {
584b5c07418SJames Feist     return nlohmann::json{
585b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
586684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceInUnknownState"},
58766ac2b8cSJason M. Bills         {"Message",
58866ac2b8cSJason M. Bills          "The operation failed because the service is in an unknown state "
58966ac2b8cSJason M. Bills          "and can no longer take incoming requests."},
59085659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
591684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
59266ac2b8cSJason M. Bills         {"Resolution", "Restart the service and resubmit the request if "
593b5c07418SJames Feist                        "the operation failed."}};
594b5c07418SJames Feist }
595b5c07418SJames Feist 
596b5c07418SJames Feist void serviceInUnknownState(crow::Response& res)
597b5c07418SJames Feist {
598b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
599b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
600f4c4dcf4SKowalski, Kamil }
601f4c4dcf4SKowalski, Kamil 
602f4c4dcf4SKowalski, Kamil /**
603f4c4dcf4SKowalski, Kamil  * @internal
604f4c4dcf4SKowalski, Kamil  * @brief Formats EventSubscriptionLimitExceeded message into JSON
605f4c4dcf4SKowalski, Kamil  *
606f4c4dcf4SKowalski, Kamil  * See header file for more information
607f4c4dcf4SKowalski, Kamil  * @endinternal
608f4c4dcf4SKowalski, Kamil  */
609b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void)
6101abe55efSEd Tanous {
611b5c07418SJames Feist     return nlohmann::json{
612b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
613684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.EventSubscriptionLimitExceeded"},
614f4c4dcf4SKowalski, Kamil         {"Message",
615f4c4dcf4SKowalski, Kamil          "The event subscription failed due to the number of simultaneous "
616f4c4dcf4SKowalski, Kamil          "subscriptions exceeding the limit of the implementation."},
61785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
618684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
619f4c4dcf4SKowalski, Kamil         {"Resolution",
620f12894f8SJason M. Bills          "Reduce the number of other subscriptions before trying to "
62166ac2b8cSJason M. Bills          "establish the event subscription or increase the limit of "
622b5c07418SJames Feist          "simultaneous subscriptions (if supported)."}};
623b5c07418SJames Feist }
624b5c07418SJames Feist 
625b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res)
626b5c07418SJames Feist {
627*789fdab3SEd Tanous     res.result(boost::beast::http::status::service_unavailable);
628b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
629f4c4dcf4SKowalski, Kamil }
630f4c4dcf4SKowalski, Kamil 
631f4c4dcf4SKowalski, Kamil /**
632f4c4dcf4SKowalski, Kamil  * @internal
633f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterMissing message into JSON
634f4c4dcf4SKowalski, Kamil  *
635f4c4dcf4SKowalski, Kamil  * See header file for more information
636f4c4dcf4SKowalski, Kamil  * @endinternal
637f4c4dcf4SKowalski, Kamil  */
638b5c07418SJames Feist nlohmann::json actionParameterMissing(const std::string& arg1,
6391abe55efSEd Tanous                                       const std::string& arg2)
6401abe55efSEd Tanous {
641b5c07418SJames Feist     return nlohmann::json{
642b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
643684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterMissing"},
644b5c07418SJames Feist         {"Message", "The action " + arg1 + " requires the parameter " + arg2 +
645b5c07418SJames Feist                         " to be present in the request body."},
64685659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
647684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
648f12894f8SJason M. Bills         {"Resolution",
64966ac2b8cSJason M. Bills          "Supply the action with the required parameter in the request "
650b5c07418SJames Feist          "body when the request is resubmitted."}};
651b5c07418SJames Feist }
652b5c07418SJames Feist 
653b5c07418SJames Feist void actionParameterMissing(crow::Response& res, const std::string& arg1,
654b5c07418SJames Feist                             const std::string& arg2)
655b5c07418SJames Feist {
656b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
657b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2));
658f4c4dcf4SKowalski, Kamil }
659f4c4dcf4SKowalski, Kamil 
660f4c4dcf4SKowalski, Kamil /**
661f4c4dcf4SKowalski, Kamil  * @internal
662f4c4dcf4SKowalski, Kamil  * @brief Formats StringValueTooLong message into JSON
663f4c4dcf4SKowalski, Kamil  *
664f4c4dcf4SKowalski, Kamil  * See header file for more information
665f4c4dcf4SKowalski, Kamil  * @endinternal
666f4c4dcf4SKowalski, Kamil  */
667b5c07418SJames Feist nlohmann::json stringValueTooLong(const std::string& arg1, const int& arg2)
6681abe55efSEd Tanous {
669b5c07418SJames Feist     return nlohmann::json{
670b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
671684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.StringValueTooLong"},
672f4c4dcf4SKowalski, Kamil         {"Message", "The string " + arg1 + " exceeds the length limit " +
673f4c4dcf4SKowalski, Kamil                         std::to_string(arg2) + "."},
67485659adfSJason M. Bills         {"MessageArgs", {arg1, std::to_string(arg2)}},
675684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
676f4c4dcf4SKowalski, Kamil         {"Resolution",
677b5c07418SJames Feist          "Resubmit the request with an appropriate string length."}};
678b5c07418SJames Feist }
679b5c07418SJames Feist 
680b5c07418SJames Feist void stringValueTooLong(crow::Response& res, const std::string& arg1,
681b5c07418SJames Feist                         const int& arg2)
682b5c07418SJames Feist {
683b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
684b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2));
685f4c4dcf4SKowalski, Kamil }
686f4c4dcf4SKowalski, Kamil 
687f4c4dcf4SKowalski, Kamil /**
688f4c4dcf4SKowalski, Kamil  * @internal
689cc9139ecSJason M. Bills  * @brief Formats SessionTerminated message into JSON
690cc9139ecSJason M. Bills  *
691cc9139ecSJason M. Bills  * See header file for more information
692cc9139ecSJason M. Bills  * @endinternal
693cc9139ecSJason M. Bills  */
694b5c07418SJames Feist nlohmann::json sessionTerminated(void)
695cc9139ecSJason M. Bills {
696b5c07418SJames Feist     return nlohmann::json{
697b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
698684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SessionTerminated"},
699cc9139ecSJason M. Bills         {"Message", "The session was successfully terminated."},
70085659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
701684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
702b5c07418SJames Feist         {"Resolution", "No resolution is required."}};
703b5c07418SJames Feist }
704b5c07418SJames Feist 
705b5c07418SJames Feist void sessionTerminated(crow::Response& res)
706b5c07418SJames Feist {
707b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
708b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, sessionTerminated());
709cc9139ecSJason M. Bills }
710cc9139ecSJason M. Bills 
711cc9139ecSJason M. Bills /**
712cc9139ecSJason M. Bills  * @internal
713684bb4b8SJason M. Bills  * @brief Formats SubscriptionTerminated message into JSON
714684bb4b8SJason M. Bills  *
715684bb4b8SJason M. Bills  * See header file for more information
716684bb4b8SJason M. Bills  * @endinternal
717684bb4b8SJason M. Bills  */
718684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void)
719684bb4b8SJason M. Bills {
720684bb4b8SJason M. Bills     return nlohmann::json{
721684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
722684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SubscriptionTerminated"},
723684bb4b8SJason M. Bills         {"Message", "The event subscription has been terminated."},
724684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
725684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
726684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
727684bb4b8SJason M. Bills }
728684bb4b8SJason M. Bills 
729684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res)
730684bb4b8SJason M. Bills {
731684bb4b8SJason M. Bills     res.result(boost::beast::http::status::ok);
732684bb4b8SJason M. Bills     addMessageToJsonRoot(res.jsonValue, subscriptionTerminated());
733684bb4b8SJason M. Bills }
734684bb4b8SJason M. Bills 
735684bb4b8SJason M. Bills /**
736684bb4b8SJason M. Bills  * @internal
737cc9139ecSJason M. Bills  * @brief Formats ResourceTypeIncompatible message into JSON
738cc9139ecSJason M. Bills  *
739cc9139ecSJason M. Bills  * See header file for more information
740cc9139ecSJason M. Bills  * @endinternal
741cc9139ecSJason M. Bills  */
742b5c07418SJames Feist nlohmann::json resourceTypeIncompatible(const std::string& arg1,
743cc9139ecSJason M. Bills                                         const std::string& arg2)
744cc9139ecSJason M. Bills {
745b5c07418SJames Feist     return nlohmann::json{
746b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
747684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceTypeIncompatible"},
748cc9139ecSJason M. Bills         {"Message", "The @odata.type of the request body " + arg1 +
749cc9139ecSJason M. Bills                         " is incompatible with the @odata.type of the "
750cc9139ecSJason M. Bills                         "resource which is " +
751cc9139ecSJason M. Bills                         arg2 + "."},
75285659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
753684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
754cc9139ecSJason M. Bills         {"Resolution", "Resubmit the request with a payload compatible "
755b5c07418SJames Feist                        "with the resource's schema."}};
756b5c07418SJames Feist }
757b5c07418SJames Feist 
758b5c07418SJames Feist void resourceTypeIncompatible(crow::Response& res, const std::string& arg1,
759b5c07418SJames Feist                               const std::string& arg2)
760b5c07418SJames Feist {
761b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
762b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2));
763cc9139ecSJason M. Bills }
764cc9139ecSJason M. Bills 
765cc9139ecSJason M. Bills /**
766cc9139ecSJason M. Bills  * @internal
767684bb4b8SJason M. Bills  * @brief Formats ResetRequired message into JSON
768684bb4b8SJason M. Bills  *
769684bb4b8SJason M. Bills  * See header file for more information
770684bb4b8SJason M. Bills  * @endinternal
771684bb4b8SJason M. Bills  */
772684bb4b8SJason M. Bills nlohmann::json resetRequired(const std::string& arg1, const std::string& arg2)
773684bb4b8SJason M. Bills {
774684bb4b8SJason M. Bills     return nlohmann::json{
775684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
776684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResetRequired"},
777684bb4b8SJason M. Bills         {"Message", "In order to complete the operation, a component reset is "
778684bb4b8SJason M. Bills                     "required with the Reset action URI '" +
779684bb4b8SJason M. Bills                         arg1 + "' and ResetType '" + arg2 + "'."},
780684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
781684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
782684bb4b8SJason M. Bills         {"Resolution",
783684bb4b8SJason M. Bills          "Perform the required Reset action on the specified component."}};
784684bb4b8SJason M. Bills }
785684bb4b8SJason M. Bills 
786684bb4b8SJason M. Bills void resetRequired(crow::Response& res, const std::string& arg1,
787684bb4b8SJason M. Bills                    const std::string& arg2)
788684bb4b8SJason M. Bills {
789684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
790684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2));
791684bb4b8SJason M. Bills }
792684bb4b8SJason M. Bills 
793684bb4b8SJason M. Bills /**
794684bb4b8SJason M. Bills  * @internal
795684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOnRequired message into JSON
796684bb4b8SJason M. Bills  *
797684bb4b8SJason M. Bills  * See header file for more information
798684bb4b8SJason M. Bills  * @endinternal
799684bb4b8SJason M. Bills  */
800684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOnRequired(const std::string& arg1)
801684bb4b8SJason M. Bills {
802684bb4b8SJason M. Bills     return nlohmann::json{
803684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
804684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ChassisPowerStateOnRequired"},
805684bb4b8SJason M. Bills         {"Message", "The Chassis with Id '" + arg1 +
806684bb4b8SJason M. Bills                         "' requires to be powered on to perform this request."},
807684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
808684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
809684bb4b8SJason M. Bills         {"Resolution",
810684bb4b8SJason M. Bills          "Power on the specified Chassis and resubmit the request."}};
811684bb4b8SJason M. Bills }
812684bb4b8SJason M. Bills 
813684bb4b8SJason M. Bills void chassisPowerStateOnRequired(crow::Response& res, const std::string& arg1)
814684bb4b8SJason M. Bills {
815684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
816684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1));
817684bb4b8SJason M. Bills }
818684bb4b8SJason M. Bills 
819684bb4b8SJason M. Bills /**
820684bb4b8SJason M. Bills  * @internal
821684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOffRequired message into JSON
822684bb4b8SJason M. Bills  *
823684bb4b8SJason M. Bills  * See header file for more information
824684bb4b8SJason M. Bills  * @endinternal
825684bb4b8SJason M. Bills  */
826684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOffRequired(const std::string& arg1)
827684bb4b8SJason M. Bills {
828684bb4b8SJason M. Bills     return nlohmann::json{
829684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
830684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ChassisPowerStateOffRequired"},
831684bb4b8SJason M. Bills         {"Message",
832684bb4b8SJason M. Bills          "The Chassis with Id '" + arg1 +
833684bb4b8SJason M. Bills              "' requires to be powered off to perform this request."},
834684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
835684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
836684bb4b8SJason M. Bills         {"Resolution",
837684bb4b8SJason M. Bills          "Power off the specified Chassis and resubmit the request."}};
838684bb4b8SJason M. Bills }
839684bb4b8SJason M. Bills 
840684bb4b8SJason M. Bills void chassisPowerStateOffRequired(crow::Response& res, const std::string& arg1)
841684bb4b8SJason M. Bills {
842684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
843684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1));
844684bb4b8SJason M. Bills }
845684bb4b8SJason M. Bills 
846684bb4b8SJason M. Bills /**
847684bb4b8SJason M. Bills  * @internal
848684bb4b8SJason M. Bills  * @brief Formats PropertyValueConflict message into JSON
849684bb4b8SJason M. Bills  *
850684bb4b8SJason M. Bills  * See header file for more information
851684bb4b8SJason M. Bills  * @endinternal
852684bb4b8SJason M. Bills  */
853684bb4b8SJason M. Bills nlohmann::json propertyValueConflict(const std::string& arg1,
854684bb4b8SJason M. Bills                                      const std::string& arg2)
855684bb4b8SJason M. Bills {
856684bb4b8SJason M. Bills     return nlohmann::json{
857684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
858684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueConflict"},
859684bb4b8SJason M. Bills         {"Message", "The property '" + arg1 +
860684bb4b8SJason M. Bills                         "' could not be written because its value would "
861684bb4b8SJason M. Bills                         "conflict with the value of the '" +
862684bb4b8SJason M. Bills                         arg2 + "' property."},
863684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
864684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
865684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
866684bb4b8SJason M. Bills }
867684bb4b8SJason M. Bills 
868684bb4b8SJason M. Bills void propertyValueConflict(crow::Response& res, const std::string& arg1,
869684bb4b8SJason M. Bills                            const std::string& arg2)
870684bb4b8SJason M. Bills {
871684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
872684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2));
873684bb4b8SJason M. Bills }
874684bb4b8SJason M. Bills 
875684bb4b8SJason M. Bills /**
876684bb4b8SJason M. Bills  * @internal
877684bb4b8SJason M. Bills  * @brief Formats PropertyValueIncorrect message into JSON
878684bb4b8SJason M. Bills  *
879684bb4b8SJason M. Bills  * See header file for more information
880684bb4b8SJason M. Bills  * @endinternal
881684bb4b8SJason M. Bills  */
882684bb4b8SJason M. Bills nlohmann::json propertyValueIncorrect(const std::string& arg1,
883684bb4b8SJason M. Bills                                       const std::string& arg2)
884684bb4b8SJason M. Bills {
885684bb4b8SJason M. Bills     return nlohmann::json{
886684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
887684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueIncorrect"},
888684bb4b8SJason M. Bills         {"Message", "The property '" + arg1 +
889684bb4b8SJason M. Bills                         "' with the requested value of '" + arg2 +
890684bb4b8SJason M. Bills                         "' could not be written because the value does not "
891684bb4b8SJason M. Bills                         "meet the constraints of the implementation."},
892684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
893684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
894684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
895684bb4b8SJason M. Bills }
896684bb4b8SJason M. Bills 
897684bb4b8SJason M. Bills void propertyValueIncorrect(crow::Response& res, const std::string& arg1,
898684bb4b8SJason M. Bills                             const std::string& arg2)
899684bb4b8SJason M. Bills {
900684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
901684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));
902684bb4b8SJason M. Bills }
903684bb4b8SJason M. Bills 
904684bb4b8SJason M. Bills /**
905684bb4b8SJason M. Bills  * @internal
906684bb4b8SJason M. Bills  * @brief Formats ResourceCreationConflict message into JSON
907684bb4b8SJason M. Bills  *
908684bb4b8SJason M. Bills  * See header file for more information
909684bb4b8SJason M. Bills  * @endinternal
910684bb4b8SJason M. Bills  */
911684bb4b8SJason M. Bills nlohmann::json resourceCreationConflict(const std::string& arg1)
912684bb4b8SJason M. Bills {
913684bb4b8SJason M. Bills     return nlohmann::json{
914684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
915684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceCreationConflict"},
916684bb4b8SJason M. Bills         {"Message", "The resource could not be created.  The service has a "
917684bb4b8SJason M. Bills                     "resource at URI '" +
918684bb4b8SJason M. Bills                         arg1 + "' that conflicts with the creation request."},
919684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
920684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
921684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
922684bb4b8SJason M. Bills }
923684bb4b8SJason M. Bills 
924684bb4b8SJason M. Bills void resourceCreationConflict(crow::Response& res, const std::string& arg1)
925684bb4b8SJason M. Bills {
926684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
927684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1));
928684bb4b8SJason M. Bills }
929684bb4b8SJason M. Bills 
930684bb4b8SJason M. Bills /**
931684bb4b8SJason M. Bills  * @internal
932684bb4b8SJason M. Bills  * @brief Formats MaximumErrorsExceeded message into JSON
933684bb4b8SJason M. Bills  *
934684bb4b8SJason M. Bills  * See header file for more information
935684bb4b8SJason M. Bills  * @endinternal
936684bb4b8SJason M. Bills  */
937684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void)
938684bb4b8SJason M. Bills {
939684bb4b8SJason M. Bills     return nlohmann::json{
940684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
941684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.MaximumErrorsExceeded"},
942684bb4b8SJason M. Bills         {"Message", "Too many errors have occurred to report them all."},
943684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
944684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
945684bb4b8SJason M. Bills         {"Resolution",
946684bb4b8SJason M. Bills          "Resolve other reported errors and retry the current operation."}};
947684bb4b8SJason M. Bills }
948684bb4b8SJason M. Bills 
949684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res)
950684bb4b8SJason M. Bills {
951684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
952684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded());
953684bb4b8SJason M. Bills }
954684bb4b8SJason M. Bills 
955684bb4b8SJason M. Bills /**
956684bb4b8SJason M. Bills  * @internal
957684bb4b8SJason M. Bills  * @brief Formats PreconditionFailed message into JSON
958684bb4b8SJason M. Bills  *
959684bb4b8SJason M. Bills  * See header file for more information
960684bb4b8SJason M. Bills  * @endinternal
961684bb4b8SJason M. Bills  */
962684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void)
963684bb4b8SJason M. Bills {
964684bb4b8SJason M. Bills     return nlohmann::json{
965684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
966684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PreconditionFailed"},
967684bb4b8SJason M. Bills         {"Message", "The ETag supplied did not match the ETag required to "
968684bb4b8SJason M. Bills                     "change this resource."},
969684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
970684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
971684bb4b8SJason M. Bills         {"Resolution", "Try the operation again using the appropriate ETag."}};
972684bb4b8SJason M. Bills }
973684bb4b8SJason M. Bills 
974684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res)
975684bb4b8SJason M. Bills {
976684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
977684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionFailed());
978684bb4b8SJason M. Bills }
979684bb4b8SJason M. Bills 
980684bb4b8SJason M. Bills /**
981684bb4b8SJason M. Bills  * @internal
982684bb4b8SJason M. Bills  * @brief Formats PreconditionRequired message into JSON
983684bb4b8SJason M. Bills  *
984684bb4b8SJason M. Bills  * See header file for more information
985684bb4b8SJason M. Bills  * @endinternal
986684bb4b8SJason M. Bills  */
987684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void)
988684bb4b8SJason M. Bills {
989684bb4b8SJason M. Bills     return nlohmann::json{
990684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
991684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PreconditionRequired"},
992684bb4b8SJason M. Bills         {"Message", "A precondition header or annotation is required to change "
993684bb4b8SJason M. Bills                     "this resource."},
994684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
995684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
996684bb4b8SJason M. Bills         {"Resolution", "Try the operation again using an If-Match or "
997684bb4b8SJason M. Bills                        "If-None-Match header and appropriate ETag."}};
998684bb4b8SJason M. Bills }
999684bb4b8SJason M. Bills 
1000684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res)
1001684bb4b8SJason M. Bills {
1002684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1003684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionRequired());
1004684bb4b8SJason M. Bills }
1005684bb4b8SJason M. Bills 
1006684bb4b8SJason M. Bills /**
1007684bb4b8SJason M. Bills  * @internal
1008684bb4b8SJason M. Bills  * @brief Formats OperationFailed message into JSON
1009684bb4b8SJason M. Bills  *
1010684bb4b8SJason M. Bills  * See header file for more information
1011684bb4b8SJason M. Bills  * @endinternal
1012684bb4b8SJason M. Bills  */
1013684bb4b8SJason M. Bills nlohmann::json operationFailed(void)
1014684bb4b8SJason M. Bills {
1015684bb4b8SJason M. Bills     return nlohmann::json{
1016684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1017684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.OperationFailed"},
1018684bb4b8SJason M. Bills         {"Message",
1019684bb4b8SJason M. Bills          "An error occurred internal to the service as part of the overall "
1020684bb4b8SJason M. Bills          "request.  Partial results may have been returned."},
1021684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1022684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1023684bb4b8SJason M. Bills         {"Resolution", "Resubmit the request.  If the problem persists, "
1024684bb4b8SJason M. Bills                        "consider resetting the service or provider."}};
1025684bb4b8SJason M. Bills }
1026684bb4b8SJason M. Bills 
1027684bb4b8SJason M. Bills void operationFailed(crow::Response& res)
1028684bb4b8SJason M. Bills {
1029684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
1030684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationFailed());
1031684bb4b8SJason M. Bills }
1032684bb4b8SJason M. Bills 
1033684bb4b8SJason M. Bills /**
1034684bb4b8SJason M. Bills  * @internal
1035684bb4b8SJason M. Bills  * @brief Formats OperationTimeout message into JSON
1036684bb4b8SJason M. Bills  *
1037684bb4b8SJason M. Bills  * See header file for more information
1038684bb4b8SJason M. Bills  * @endinternal
1039684bb4b8SJason M. Bills  */
1040684bb4b8SJason M. Bills nlohmann::json operationTimeout(void)
1041684bb4b8SJason M. Bills {
1042684bb4b8SJason M. Bills     return nlohmann::json{
1043684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1044684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.OperationTimeout"},
1045684bb4b8SJason M. Bills         {"Message", "A timeout internal to the service occured as part of the "
1046684bb4b8SJason M. Bills                     "request.  Partial results may have been returned."},
1047684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1048684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1049684bb4b8SJason M. Bills         {"Resolution", "Resubmit the request.  If the problem persists, "
1050684bb4b8SJason M. Bills                        "consider resetting the service or provider."}};
1051684bb4b8SJason M. Bills }
1052684bb4b8SJason M. Bills 
1053684bb4b8SJason M. Bills void operationTimeout(crow::Response& res)
1054684bb4b8SJason M. Bills {
1055684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
1056684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationTimeout());
1057684bb4b8SJason M. Bills }
1058684bb4b8SJason M. Bills 
1059684bb4b8SJason M. Bills /**
1060684bb4b8SJason M. Bills  * @internal
1061f12894f8SJason M. Bills  * @brief Formats PropertyValueTypeError message into JSON for the specified
1062f12894f8SJason M. Bills  * property
1063f12894f8SJason M. Bills  *
1064f12894f8SJason M. Bills  * See header file for more information
1065f12894f8SJason M. Bills  * @endinternal
1066f12894f8SJason M. Bills  */
1067b5c07418SJames Feist nlohmann::json propertyValueTypeError(const std::string& arg1,
1068a08b46ccSJason M. Bills                                       const std::string& arg2)
1069f12894f8SJason M. Bills {
1070b5c07418SJames Feist     return nlohmann::json{
1071b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1072684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueTypeError"},
1073f12894f8SJason M. Bills         {"Message",
1074f12894f8SJason M. Bills          "The value " + arg1 + " for the property " + arg2 +
1075f12894f8SJason M. Bills              " is of a different type than the property can accept."},
107685659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1077684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
107866ac2b8cSJason M. Bills         {"Resolution",
107966ac2b8cSJason M. Bills          "Correct the value for the property in the request body and "
1080b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1081b5c07418SJames Feist }
1082b5c07418SJames Feist 
1083b5c07418SJames Feist void propertyValueTypeError(crow::Response& res, const std::string& arg1,
1084b5c07418SJames Feist                             const std::string& arg2)
1085b5c07418SJames Feist {
1086b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1087b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
1088f4c4dcf4SKowalski, Kamil }
1089f4c4dcf4SKowalski, Kamil 
1090f4c4dcf4SKowalski, Kamil /**
1091f4c4dcf4SKowalski, Kamil  * @internal
1092f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceNotFound message into JSON
1093f4c4dcf4SKowalski, Kamil  *
1094f4c4dcf4SKowalski, Kamil  * See header file for more information
1095f4c4dcf4SKowalski, Kamil  * @endinternal
1096f4c4dcf4SKowalski, Kamil  */
1097b5c07418SJames Feist nlohmann::json resourceNotFound(const std::string& arg1,
10981abe55efSEd Tanous                                 const std::string& arg2)
10991abe55efSEd Tanous {
1100b5c07418SJames Feist     return nlohmann::json{
1101b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1102684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceNotFound"},
11031abe55efSEd Tanous         {"Message", "The requested resource of type " + arg1 + " named " +
11041abe55efSEd Tanous                         arg2 + " was not found."},
110585659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1106684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1107f4c4dcf4SKowalski, Kamil         {"Resolution",
1108b5c07418SJames Feist          "Provide a valid resource identifier and resubmit the request."}};
1109b5c07418SJames Feist }
1110b5c07418SJames Feist 
1111b5c07418SJames Feist void resourceNotFound(crow::Response& res, const std::string& arg1,
1112b5c07418SJames Feist                       const std::string& arg2)
1113b5c07418SJames Feist {
1114b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1115b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
1116f4c4dcf4SKowalski, Kamil }
1117f4c4dcf4SKowalski, Kamil 
1118f4c4dcf4SKowalski, Kamil /**
1119f4c4dcf4SKowalski, Kamil  * @internal
1120f4c4dcf4SKowalski, Kamil  * @brief Formats CouldNotEstablishConnection message into JSON
1121f4c4dcf4SKowalski, Kamil  *
1122f4c4dcf4SKowalski, Kamil  * See header file for more information
1123f4c4dcf4SKowalski, Kamil  * @endinternal
1124f4c4dcf4SKowalski, Kamil  */
1125b5c07418SJames Feist nlohmann::json couldNotEstablishConnection(const std::string& arg1)
11261abe55efSEd Tanous {
1127b5c07418SJames Feist     return nlohmann::json{
1128b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1129684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CouldNotEstablishConnection"},
11301abe55efSEd Tanous         {"Message",
1131684bb4b8SJason M. Bills          "The service failed to establish a connection with the URI " + arg1 +
1132b5c07418SJames Feist              "."},
113385659adfSJason M. Bills         {"MessageArgs", {arg1}},
1134684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
113566ac2b8cSJason M. Bills         {"Resolution",
113666ac2b8cSJason M. Bills          "Ensure that the URI contains a valid and reachable node name, "
1137b5c07418SJames Feist          "protocol information and other URI components."}};
1138b5c07418SJames Feist }
1139b5c07418SJames Feist 
1140b5c07418SJames Feist void couldNotEstablishConnection(crow::Response& res, const std::string& arg1)
1141b5c07418SJames Feist {
1142b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1143b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
1144f4c4dcf4SKowalski, Kamil }
1145f4c4dcf4SKowalski, Kamil 
1146f4c4dcf4SKowalski, Kamil /**
1147f4c4dcf4SKowalski, Kamil  * @internal
1148f12894f8SJason M. Bills  * @brief Formats PropertyNotWritable message into JSON for the specified
1149f12894f8SJason M. Bills  * property
1150f12894f8SJason M. Bills  *
1151f12894f8SJason M. Bills  * See header file for more information
1152f12894f8SJason M. Bills  * @endinternal
1153f12894f8SJason M. Bills  */
1154b5c07418SJames Feist nlohmann::json propertyNotWritable(const std::string& arg1)
1155f12894f8SJason M. Bills {
1156b5c07418SJames Feist     return nlohmann::json{
1157b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1158684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyNotWritable"},
1159b5c07418SJames Feist         {"Message", "The property " + arg1 +
1160b5c07418SJames Feist                         " is a read only property and cannot be "
1161b5c07418SJames Feist                         "assigned a value."},
116285659adfSJason M. Bills         {"MessageArgs", {arg1}},
1163684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
116466ac2b8cSJason M. Bills         {"Resolution", "Remove the property from the request body and "
1165b5c07418SJames Feist                        "resubmit the request if the operation failed."}};
1166b5c07418SJames Feist }
1167b5c07418SJames Feist 
1168b5c07418SJames Feist void propertyNotWritable(crow::Response& res, const std::string& arg1)
1169b5c07418SJames Feist {
1170b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1171b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
1172f4c4dcf4SKowalski, Kamil }
1173f4c4dcf4SKowalski, Kamil 
1174f4c4dcf4SKowalski, Kamil /**
1175f4c4dcf4SKowalski, Kamil  * @internal
1176f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueTypeError message into JSON
1177f4c4dcf4SKowalski, Kamil  *
1178f4c4dcf4SKowalski, Kamil  * See header file for more information
1179f4c4dcf4SKowalski, Kamil  * @endinternal
1180f4c4dcf4SKowalski, Kamil  */
1181b5c07418SJames Feist nlohmann::json queryParameterValueTypeError(const std::string& arg1,
11821abe55efSEd Tanous                                             const std::string& arg2)
11831abe55efSEd Tanous {
1184b5c07418SJames Feist     return nlohmann::json{
1185b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1186684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterValueTypeError"},
11871abe55efSEd Tanous         {"Message",
11881abe55efSEd Tanous          "The value " + arg1 + " for the query parameter " + arg2 +
1189f4c4dcf4SKowalski, Kamil              " is of a different type than the parameter can accept."},
119085659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1191684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
119266ac2b8cSJason M. Bills         {"Resolution",
119366ac2b8cSJason M. Bills          "Correct the value for the query parameter in the request and "
1194b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1195b5c07418SJames Feist }
1196b5c07418SJames Feist 
1197b5c07418SJames Feist void queryParameterValueTypeError(crow::Response& res, const std::string& arg1,
1198b5c07418SJames Feist                                   const std::string& arg2)
1199b5c07418SJames Feist {
1200b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1201b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1202b5c07418SJames Feist                           queryParameterValueTypeError(arg1, arg2));
1203f4c4dcf4SKowalski, Kamil }
1204f4c4dcf4SKowalski, Kamil 
1205f4c4dcf4SKowalski, Kamil /**
1206f4c4dcf4SKowalski, Kamil  * @internal
1207f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceShuttingDown message into JSON
1208f4c4dcf4SKowalski, Kamil  *
1209f4c4dcf4SKowalski, Kamil  * See header file for more information
1210f4c4dcf4SKowalski, Kamil  * @endinternal
1211f4c4dcf4SKowalski, Kamil  */
1212b5c07418SJames Feist nlohmann::json serviceShuttingDown(void)
12131abe55efSEd Tanous {
1214b5c07418SJames Feist     return nlohmann::json{
1215b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1216684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceShuttingDown"},
1217f12894f8SJason M. Bills         {"Message", "The operation failed because the service is shutting "
121866ac2b8cSJason M. Bills                     "down and can no longer take incoming requests."},
121985659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1220684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
122166ac2b8cSJason M. Bills         {"Resolution", "When the service becomes available, resubmit the "
1222b5c07418SJames Feist                        "request if the operation failed."}};
1223b5c07418SJames Feist }
1224b5c07418SJames Feist 
1225b5c07418SJames Feist void serviceShuttingDown(crow::Response& res)
1226b5c07418SJames Feist {
1227b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1228b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
1229f4c4dcf4SKowalski, Kamil }
1230f4c4dcf4SKowalski, Kamil 
1231f4c4dcf4SKowalski, Kamil /**
1232f4c4dcf4SKowalski, Kamil  * @internal
1233f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterDuplicate message into JSON
1234f4c4dcf4SKowalski, Kamil  *
1235f4c4dcf4SKowalski, Kamil  * See header file for more information
1236f4c4dcf4SKowalski, Kamil  * @endinternal
1237f4c4dcf4SKowalski, Kamil  */
1238b5c07418SJames Feist nlohmann::json actionParameterDuplicate(const std::string& arg1,
12391abe55efSEd Tanous                                         const std::string& arg2)
12401abe55efSEd Tanous {
1241b5c07418SJames Feist     return nlohmann::json{
1242b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1243684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterDuplicate"},
1244f4c4dcf4SKowalski, Kamil         {"Message",
1245f4c4dcf4SKowalski, Kamil          "The action " + arg1 +
12461abe55efSEd Tanous              " was submitted with more than one value for the parameter " +
12471abe55efSEd Tanous              arg2 + "."},
124885659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1249684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
125066ac2b8cSJason M. Bills         {"Resolution",
125166ac2b8cSJason M. Bills          "Resubmit the action with only one instance of the parameter in "
1252b5c07418SJames Feist          "the request body if the operation failed."}};
1253b5c07418SJames Feist }
1254b5c07418SJames Feist 
1255b5c07418SJames Feist void actionParameterDuplicate(crow::Response& res, const std::string& arg1,
1256b5c07418SJames Feist                               const std::string& arg2)
1257b5c07418SJames Feist {
1258b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1259b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
1260f4c4dcf4SKowalski, Kamil }
1261f4c4dcf4SKowalski, Kamil 
1262f4c4dcf4SKowalski, Kamil /**
1263f4c4dcf4SKowalski, Kamil  * @internal
1264f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterNotSupported message into JSON
1265f4c4dcf4SKowalski, Kamil  *
1266f4c4dcf4SKowalski, Kamil  * See header file for more information
1267f4c4dcf4SKowalski, Kamil  * @endinternal
1268f4c4dcf4SKowalski, Kamil  */
1269b5c07418SJames Feist nlohmann::json actionParameterNotSupported(const std::string& arg1,
12701abe55efSEd Tanous                                            const std::string& arg2)
12711abe55efSEd Tanous {
1272b5c07418SJames Feist     return nlohmann::json{
1273b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1274684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterNotSupported"},
1275f4c4dcf4SKowalski, Kamil         {"Message", "The parameter " + arg1 + " for the action " + arg2 +
1276f4c4dcf4SKowalski, Kamil                         " is not supported on the target resource."},
127785659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1278684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
127966ac2b8cSJason M. Bills         {"Resolution", "Remove the parameter supplied and resubmit the "
1280b5c07418SJames Feist                        "request if the operation failed."}};
1281b5c07418SJames Feist }
1282b5c07418SJames Feist 
1283b5c07418SJames Feist void actionParameterNotSupported(crow::Response& res, const std::string& arg1,
1284b5c07418SJames Feist                                  const std::string& arg2)
1285b5c07418SJames Feist {
1286b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1287b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1288b5c07418SJames Feist                           actionParameterNotSupported(arg1, arg2));
1289f4c4dcf4SKowalski, Kamil }
1290f4c4dcf4SKowalski, Kamil 
1291f4c4dcf4SKowalski, Kamil /**
1292f4c4dcf4SKowalski, Kamil  * @internal
1293f4c4dcf4SKowalski, Kamil  * @brief Formats SourceDoesNotSupportProtocol message into JSON
1294f4c4dcf4SKowalski, Kamil  *
1295f4c4dcf4SKowalski, Kamil  * See header file for more information
1296f4c4dcf4SKowalski, Kamil  * @endinternal
1297f4c4dcf4SKowalski, Kamil  */
1298b5c07418SJames Feist nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1,
12991abe55efSEd Tanous                                             const std::string& arg2)
13001abe55efSEd Tanous {
1301b5c07418SJames Feist     return nlohmann::json{
1302b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1303684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SourceDoesNotSupportProtocol"},
1304684bb4b8SJason M. Bills         {"Message", "The other end of the connection at " + arg1 +
13051abe55efSEd Tanous                         " does not support the specified protocol " + arg2 +
13061abe55efSEd Tanous                         "."},
130785659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1308684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1309b5c07418SJames Feist         {"Resolution", "Change protocols or URIs. "}};
1310b5c07418SJames Feist }
1311b5c07418SJames Feist 
1312b5c07418SJames Feist void sourceDoesNotSupportProtocol(crow::Response& res, const std::string& arg1,
1313b5c07418SJames Feist                                   const std::string& arg2)
1314b5c07418SJames Feist {
1315b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1316b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1317b5c07418SJames Feist                           sourceDoesNotSupportProtocol(arg1, arg2));
1318f4c4dcf4SKowalski, Kamil }
1319f4c4dcf4SKowalski, Kamil 
1320f4c4dcf4SKowalski, Kamil /**
1321f4c4dcf4SKowalski, Kamil  * @internal
1322f4c4dcf4SKowalski, Kamil  * @brief Formats AccountRemoved message into JSON
1323f4c4dcf4SKowalski, Kamil  *
1324f4c4dcf4SKowalski, Kamil  * See header file for more information
1325f4c4dcf4SKowalski, Kamil  * @endinternal
1326f4c4dcf4SKowalski, Kamil  */
1327b5c07418SJames Feist nlohmann::json accountRemoved(void)
13281abe55efSEd Tanous {
1329b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1330684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.AccountRemoved"},
1331f4c4dcf4SKowalski, Kamil                           {"Message", "The account was successfully removed."},
133285659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1333684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
1334b5c07418SJames Feist                           {"Resolution", "No resolution is required."}};
1335b5c07418SJames Feist }
1336b5c07418SJames Feist 
1337b5c07418SJames Feist void accountRemoved(crow::Response& res)
1338b5c07418SJames Feist {
1339b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1340b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, accountRemoved());
1341f4c4dcf4SKowalski, Kamil }
1342f4c4dcf4SKowalski, Kamil 
1343f4c4dcf4SKowalski, Kamil /**
1344f4c4dcf4SKowalski, Kamil  * @internal
1345f4c4dcf4SKowalski, Kamil  * @brief Formats AccessDenied message into JSON
1346f4c4dcf4SKowalski, Kamil  *
1347f4c4dcf4SKowalski, Kamil  * See header file for more information
1348f4c4dcf4SKowalski, Kamil  * @endinternal
1349f4c4dcf4SKowalski, Kamil  */
1350b5c07418SJames Feist nlohmann::json accessDenied(const std::string& arg1)
13511abe55efSEd Tanous {
1352b5c07418SJames Feist     return nlohmann::json{
1353b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1354684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccessDenied"},
1355684bb4b8SJason M. Bills         {"Message", "While attempting to establish a connection to " + arg1 +
1356b5c07418SJames Feist                         ", the service denied access."},
135785659adfSJason M. Bills         {"MessageArgs", {arg1}},
1358684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
135966ac2b8cSJason M. Bills         {"Resolution", "Attempt to ensure that the URI is correct and that "
1360b5c07418SJames Feist                        "the service has the appropriate credentials."}};
1361b5c07418SJames Feist }
1362b5c07418SJames Feist 
1363b5c07418SJames Feist void accessDenied(crow::Response& res, const std::string& arg1)
1364b5c07418SJames Feist {
1365b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1366b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
1367f4c4dcf4SKowalski, Kamil }
1368f4c4dcf4SKowalski, Kamil 
1369f4c4dcf4SKowalski, Kamil /**
1370f4c4dcf4SKowalski, Kamil  * @internal
1371f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupported message into JSON
1372f4c4dcf4SKowalski, Kamil  *
1373f4c4dcf4SKowalski, Kamil  * See header file for more information
1374f4c4dcf4SKowalski, Kamil  * @endinternal
1375f4c4dcf4SKowalski, Kamil  */
1376b5c07418SJames Feist nlohmann::json queryNotSupported(void)
13771abe55efSEd Tanous {
1378b5c07418SJames Feist     return nlohmann::json{
1379b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1380684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupported"},
1381f4c4dcf4SKowalski, Kamil         {"Message", "Querying is not supported by the implementation."},
138285659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1383684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
138466ac2b8cSJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the "
1385b5c07418SJames Feist                        "request if the operation failed."}};
1386b5c07418SJames Feist }
1387b5c07418SJames Feist 
1388b5c07418SJames Feist void queryNotSupported(crow::Response& res)
1389b5c07418SJames Feist {
1390b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1391b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupported());
1392f4c4dcf4SKowalski, Kamil }
1393f4c4dcf4SKowalski, Kamil 
1394f4c4dcf4SKowalski, Kamil /**
1395f4c4dcf4SKowalski, Kamil  * @internal
1396f4c4dcf4SKowalski, Kamil  * @brief Formats CreateLimitReachedForResource message into JSON
1397f4c4dcf4SKowalski, Kamil  *
1398f4c4dcf4SKowalski, Kamil  * See header file for more information
1399f4c4dcf4SKowalski, Kamil  * @endinternal
1400f4c4dcf4SKowalski, Kamil  */
1401b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void)
14021abe55efSEd Tanous {
1403b5c07418SJames Feist     return nlohmann::json{
1404b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1405684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CreateLimitReachedForResource"},
14061abe55efSEd Tanous         {"Message", "The create operation failed because the resource has "
140766ac2b8cSJason M. Bills                     "reached the limit of possible resources."},
140885659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1409684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
141066ac2b8cSJason M. Bills         {"Resolution",
141166ac2b8cSJason M. Bills          "Either delete resources and resubmit the request if the "
1412b5c07418SJames Feist          "operation failed or do not resubmit the request."}};
1413b5c07418SJames Feist }
1414b5c07418SJames Feist 
1415b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res)
1416b5c07418SJames Feist {
1417b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1418b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
1419f4c4dcf4SKowalski, Kamil }
1420f4c4dcf4SKowalski, Kamil 
1421f4c4dcf4SKowalski, Kamil /**
1422f4c4dcf4SKowalski, Kamil  * @internal
1423f4c4dcf4SKowalski, Kamil  * @brief Formats GeneralError message into JSON
1424f4c4dcf4SKowalski, Kamil  *
1425f4c4dcf4SKowalski, Kamil  * See header file for more information
1426f4c4dcf4SKowalski, Kamil  * @endinternal
1427f4c4dcf4SKowalski, Kamil  */
1428b5c07418SJames Feist nlohmann::json generalError(void)
14291abe55efSEd Tanous {
1430b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1431684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.GeneralError"},
1432b7e069efSJames Feist                           {"Message",
1433b7e069efSJames Feist                            "A general error has occurred. See Resolution for "
1434cc9139ecSJason M. Bills                            "information on how to resolve the error."},
143585659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1436684bb4b8SJason M. Bills                           {"MessageSeverity", "Critical"},
1437b5c07418SJames Feist                           {"Resolution", "None."}};
1438b5c07418SJames Feist }
1439b5c07418SJames Feist 
1440b5c07418SJames Feist void generalError(crow::Response& res)
1441b5c07418SJames Feist {
1442b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
1443b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, generalError());
1444f4c4dcf4SKowalski, Kamil }
1445f4c4dcf4SKowalski, Kamil 
1446f4c4dcf4SKowalski, Kamil /**
1447f4c4dcf4SKowalski, Kamil  * @internal
1448f4c4dcf4SKowalski, Kamil  * @brief Formats Success message into JSON
1449f4c4dcf4SKowalski, Kamil  *
1450f4c4dcf4SKowalski, Kamil  * See header file for more information
1451f4c4dcf4SKowalski, Kamil  * @endinternal
1452f4c4dcf4SKowalski, Kamil  */
1453b5c07418SJames Feist nlohmann::json success(void)
14541abe55efSEd Tanous {
1455b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1456684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.Success"},
1457f4c4dcf4SKowalski, Kamil                           {"Message", "Successfully Completed Request"},
145885659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1459684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
1460b5c07418SJames Feist                           {"Resolution", "None"}};
1461b5c07418SJames Feist }
1462b5c07418SJames Feist 
1463b5c07418SJames Feist void success(crow::Response& res)
1464b5c07418SJames Feist {
1465b5c07418SJames Feist     // don't set res.result here because success is the default and any
1466b5c07418SJames Feist     // error should overwrite the default
1467b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, success());
1468f12894f8SJason M. Bills }
1469f12894f8SJason M. Bills 
1470f12894f8SJason M. Bills /**
1471f12894f8SJason M. Bills  * @internal
1472f4c4dcf4SKowalski, Kamil  * @brief Formats Created message into JSON
1473f4c4dcf4SKowalski, Kamil  *
1474f4c4dcf4SKowalski, Kamil  * See header file for more information
1475f4c4dcf4SKowalski, Kamil  * @endinternal
1476f4c4dcf4SKowalski, Kamil  */
1477b5c07418SJames Feist nlohmann::json created(void)
14781abe55efSEd Tanous {
1479b5c07418SJames Feist     return nlohmann::json{
1480b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1481684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.Created"},
1482f4c4dcf4SKowalski, Kamil         {"Message", "The resource has been created successfully"},
148385659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1484684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
1485b5c07418SJames Feist         {"Resolution", "None"}};
1486b5c07418SJames Feist }
1487b5c07418SJames Feist 
1488b5c07418SJames Feist void created(crow::Response& res)
1489b5c07418SJames Feist {
1490b5c07418SJames Feist     res.result(boost::beast::http::status::created);
1491b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, created());
1492f4c4dcf4SKowalski, Kamil }
1493f4c4dcf4SKowalski, Kamil 
1494f4c4dcf4SKowalski, Kamil /**
1495f4c4dcf4SKowalski, Kamil  * @internal
1496cc9139ecSJason M. Bills  * @brief Formats NoOperation message into JSON
1497cc9139ecSJason M. Bills  *
1498cc9139ecSJason M. Bills  * See header file for more information
1499cc9139ecSJason M. Bills  * @endinternal
1500cc9139ecSJason M. Bills  */
1501b5c07418SJames Feist nlohmann::json noOperation(void)
1502cc9139ecSJason M. Bills {
1503b5c07418SJames Feist     return nlohmann::json{
1504b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1505684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.NoOperation"},
1506cc9139ecSJason M. Bills         {"Message", "The request body submitted contain no data to act "
1507cc9139ecSJason M. Bills                     "upon and no changes to the resource took place."},
150885659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1509684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1510cc9139ecSJason M. Bills         {"Resolution",
1511b5c07418SJames Feist          "Add properties in the JSON object and resubmit the request."}};
1512b5c07418SJames Feist }
1513b5c07418SJames Feist 
1514b5c07418SJames Feist void noOperation(crow::Response& res)
1515b5c07418SJames Feist {
1516b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1517b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noOperation());
1518cc9139ecSJason M. Bills }
1519cc9139ecSJason M. Bills 
1520cc9139ecSJason M. Bills /**
1521cc9139ecSJason M. Bills  * @internal
1522b5c07418SJames Feist  * @brief Formats PropertyUnknown message into JSON for the specified
1523b5c07418SJames Feist  * property
1524f12894f8SJason M. Bills  *
1525f12894f8SJason M. Bills  * See header file for more information
1526f12894f8SJason M. Bills  * @endinternal
1527f12894f8SJason M. Bills  */
1528b5c07418SJames Feist nlohmann::json propertyUnknown(const std::string& arg1)
1529b5c07418SJames Feist {
1530b5c07418SJames Feist     return nlohmann::json{
1531b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1532684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyUnknown"},
1533b5c07418SJames Feist         {"Message", "The property " + arg1 +
1534b5c07418SJames Feist                         " is not in the list of valid properties for "
1535b5c07418SJames Feist                         "the resource."},
1536b5c07418SJames Feist         {"MessageArgs", {arg1}},
1537684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1538b5c07418SJames Feist         {"Resolution", "Remove the unknown property from the request "
1539b5c07418SJames Feist                        "body and resubmit "
1540b5c07418SJames Feist                        "the request if the operation failed."}};
1541b5c07418SJames Feist }
1542b5c07418SJames Feist 
1543a08b46ccSJason M. Bills void propertyUnknown(crow::Response& res, const std::string& arg1)
1544f12894f8SJason M. Bills {
1545f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1546b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1);
1547f4c4dcf4SKowalski, Kamil }
1548f4c4dcf4SKowalski, Kamil 
1549f4c4dcf4SKowalski, Kamil /**
1550f4c4dcf4SKowalski, Kamil  * @internal
1551f4c4dcf4SKowalski, Kamil  * @brief Formats NoValidSession message into JSON
1552f4c4dcf4SKowalski, Kamil  *
1553f4c4dcf4SKowalski, Kamil  * See header file for more information
1554f4c4dcf4SKowalski, Kamil  * @endinternal
1555f4c4dcf4SKowalski, Kamil  */
1556b5c07418SJames Feist nlohmann::json noValidSession(void)
15571abe55efSEd Tanous {
1558b5c07418SJames Feist     return nlohmann::json{
1559b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1560684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.NoValidSession"},
1561f4c4dcf4SKowalski, Kamil         {"Message",
1562f4c4dcf4SKowalski, Kamil          "There is no valid session established with the implementation."},
156385659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1564684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
15651abe55efSEd Tanous         {"Resolution",
1566684bb4b8SJason M. Bills          "Establish a session before attempting any operations."}};
1567b5c07418SJames Feist }
1568b5c07418SJames Feist 
1569b5c07418SJames Feist void noValidSession(crow::Response& res)
1570b5c07418SJames Feist {
1571b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1572b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noValidSession());
1573f4c4dcf4SKowalski, Kamil }
1574f4c4dcf4SKowalski, Kamil 
1575f4c4dcf4SKowalski, Kamil /**
1576f4c4dcf4SKowalski, Kamil  * @internal
1577f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidObject message into JSON
1578f4c4dcf4SKowalski, Kamil  *
1579f4c4dcf4SKowalski, Kamil  * See header file for more information
1580f4c4dcf4SKowalski, Kamil  * @endinternal
1581f4c4dcf4SKowalski, Kamil  */
1582b5c07418SJames Feist nlohmann::json invalidObject(const std::string& arg1)
15831abe55efSEd Tanous {
1584b5c07418SJames Feist     return nlohmann::json{
1585b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1586684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InvalidObject"},
1587f4c4dcf4SKowalski, Kamil         {"Message", "The object at " + arg1 + " is invalid."},
158885659adfSJason M. Bills         {"MessageArgs", {arg1}},
1589684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1590f12894f8SJason M. Bills         {"Resolution",
159166ac2b8cSJason M. Bills          "Either the object is malformed or the URI is not correct.  "
1592b5c07418SJames Feist          "Correct the condition and resubmit the request if it failed."}};
1593b5c07418SJames Feist }
1594b5c07418SJames Feist 
1595b5c07418SJames Feist void invalidObject(crow::Response& res, const std::string& arg1)
1596b5c07418SJames Feist {
1597b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1598b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
1599f4c4dcf4SKowalski, Kamil }
1600f4c4dcf4SKowalski, Kamil 
1601f4c4dcf4SKowalski, Kamil /**
1602f4c4dcf4SKowalski, Kamil  * @internal
1603f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInStandby message into JSON
1604f4c4dcf4SKowalski, Kamil  *
1605f4c4dcf4SKowalski, Kamil  * See header file for more information
1606f4c4dcf4SKowalski, Kamil  * @endinternal
1607f4c4dcf4SKowalski, Kamil  */
1608b5c07418SJames Feist nlohmann::json resourceInStandby(void)
16091abe55efSEd Tanous {
1610b5c07418SJames Feist     return nlohmann::json{
1611b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1612684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceInStandby"},
161366ac2b8cSJason M. Bills         {"Message", "The request could not be performed because the "
161466ac2b8cSJason M. Bills                     "resource is in standby."},
161585659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1616684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1617f12894f8SJason M. Bills         {"Resolution", "Ensure that the resource is in the correct power "
1618b5c07418SJames Feist                        "state and resubmit the request."}};
1619b5c07418SJames Feist }
1620b5c07418SJames Feist 
1621b5c07418SJames Feist void resourceInStandby(crow::Response& res)
1622b5c07418SJames Feist {
1623b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1624b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInStandby());
1625f4c4dcf4SKowalski, Kamil }
1626f4c4dcf4SKowalski, Kamil 
1627f4c4dcf4SKowalski, Kamil /**
1628f4c4dcf4SKowalski, Kamil  * @internal
1629f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueTypeError message into JSON
1630f4c4dcf4SKowalski, Kamil  *
1631f4c4dcf4SKowalski, Kamil  * See header file for more information
1632f4c4dcf4SKowalski, Kamil  * @endinternal
1633f4c4dcf4SKowalski, Kamil  */
1634b5c07418SJames Feist nlohmann::json actionParameterValueTypeError(const std::string& arg1,
1635f4c4dcf4SKowalski, Kamil                                              const std::string& arg2,
16361abe55efSEd Tanous                                              const std::string& arg3)
16371abe55efSEd Tanous {
1638b5c07418SJames Feist     return nlohmann::json{
1639b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1640684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterValueTypeError"},
16411abe55efSEd Tanous         {"Message",
16421abe55efSEd Tanous          "The value " + arg1 + " for the parameter " + arg2 +
1643f4c4dcf4SKowalski, Kamil              " in the action " + arg3 +
1644f4c4dcf4SKowalski, Kamil              " is of a different type than the parameter can accept."},
164585659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
1646684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
164766ac2b8cSJason M. Bills         {"Resolution",
164866ac2b8cSJason M. Bills          "Correct the value for the parameter in the request body and "
1649b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1650b5c07418SJames Feist }
1651b5c07418SJames Feist 
1652b5c07418SJames Feist void actionParameterValueTypeError(crow::Response& res, const std::string& arg1,
1653b5c07418SJames Feist                                    const std::string& arg2,
1654b5c07418SJames Feist                                    const std::string& arg3)
1655b5c07418SJames Feist {
1656b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1657b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1658b5c07418SJames Feist                           actionParameterValueTypeError(arg1, arg2, arg3));
1659f4c4dcf4SKowalski, Kamil }
1660f4c4dcf4SKowalski, Kamil 
1661f4c4dcf4SKowalski, Kamil /**
1662f4c4dcf4SKowalski, Kamil  * @internal
1663f4c4dcf4SKowalski, Kamil  * @brief Formats SessionLimitExceeded message into JSON
1664f4c4dcf4SKowalski, Kamil  *
1665f4c4dcf4SKowalski, Kamil  * See header file for more information
1666f4c4dcf4SKowalski, Kamil  * @endinternal
1667f4c4dcf4SKowalski, Kamil  */
1668b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void)
16691abe55efSEd Tanous {
1670b5c07418SJames Feist     return nlohmann::json{
1671b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1672684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SessionLimitExceeded"},
1673f12894f8SJason M. Bills         {"Message", "The session establishment failed due to the number of "
167466ac2b8cSJason M. Bills                     "simultaneous sessions exceeding the limit of the "
167566ac2b8cSJason M. Bills                     "implementation."},
167685659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1677684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
167866ac2b8cSJason M. Bills         {"Resolution", "Reduce the number of other sessions before trying "
167966ac2b8cSJason M. Bills                        "to establish the session or increase the limit of "
1680b5c07418SJames Feist                        "simultaneous sessions (if supported)."}};
1681b5c07418SJames Feist }
1682b5c07418SJames Feist 
1683b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res)
1684b5c07418SJames Feist {
1685b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1686b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
1687f4c4dcf4SKowalski, Kamil }
1688f4c4dcf4SKowalski, Kamil 
1689f4c4dcf4SKowalski, Kamil /**
1690f4c4dcf4SKowalski, Kamil  * @internal
1691f4c4dcf4SKowalski, Kamil  * @brief Formats ActionNotSupported message into JSON
1692f4c4dcf4SKowalski, Kamil  *
1693f4c4dcf4SKowalski, Kamil  * See header file for more information
1694f4c4dcf4SKowalski, Kamil  * @endinternal
1695f4c4dcf4SKowalski, Kamil  */
1696b5c07418SJames Feist nlohmann::json actionNotSupported(const std::string& arg1)
16971abe55efSEd Tanous {
1698b5c07418SJames Feist     return nlohmann::json{
1699b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1700684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionNotSupported"},
17011abe55efSEd Tanous         {"Message",
17021abe55efSEd Tanous          "The action " + arg1 + " is not supported by the resource."},
170385659adfSJason M. Bills         {"MessageArgs", {arg1}},
1704684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1705f4c4dcf4SKowalski, Kamil         {"Resolution",
1706f4c4dcf4SKowalski, Kamil          "The action supplied cannot be resubmitted to the implementation. "
1707f12894f8SJason M. Bills          " Perhaps the action was invalid, the wrong resource was the "
170866ac2b8cSJason M. Bills          "target or the implementation documentation may be of "
1709b5c07418SJames Feist          "assistance."}};
1710b5c07418SJames Feist }
1711b5c07418SJames Feist 
1712b5c07418SJames Feist void actionNotSupported(crow::Response& res, const std::string& arg1)
1713b5c07418SJames Feist {
1714b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1715b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
1716f4c4dcf4SKowalski, Kamil }
1717f4c4dcf4SKowalski, Kamil 
1718f4c4dcf4SKowalski, Kamil /**
1719f4c4dcf4SKowalski, Kamil  * @internal
1720f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidIndex message into JSON
1721f4c4dcf4SKowalski, Kamil  *
1722f4c4dcf4SKowalski, Kamil  * See header file for more information
1723f4c4dcf4SKowalski, Kamil  * @endinternal
1724f4c4dcf4SKowalski, Kamil  */
1725b5c07418SJames Feist nlohmann::json invalidIndex(const int& arg1)
17261abe55efSEd Tanous {
1727b5c07418SJames Feist     return nlohmann::json{
1728b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1729684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InvalidIndex"},
1730684bb4b8SJason M. Bills         {"Message", "The Index " + std::to_string(arg1) +
1731f4c4dcf4SKowalski, Kamil                         " is not a valid offset into the array."},
173285659adfSJason M. Bills         {"MessageArgs", {std::to_string(arg1)}},
1733684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1734f12894f8SJason M. Bills         {"Resolution", "Verify the index value provided is within the "
1735b5c07418SJames Feist                        "bounds of the array."}};
1736b5c07418SJames Feist }
1737b5c07418SJames Feist 
1738b5c07418SJames Feist void invalidIndex(crow::Response& res, const int& arg1)
1739b5c07418SJames Feist {
1740b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1741b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
1742f4c4dcf4SKowalski, Kamil }
1743f4c4dcf4SKowalski, Kamil 
1744f4c4dcf4SKowalski, Kamil /**
1745f4c4dcf4SKowalski, Kamil  * @internal
1746f4c4dcf4SKowalski, Kamil  * @brief Formats EmptyJSON message into JSON
1747f4c4dcf4SKowalski, Kamil  *
1748f4c4dcf4SKowalski, Kamil  * See header file for more information
1749f4c4dcf4SKowalski, Kamil  * @endinternal
1750f4c4dcf4SKowalski, Kamil  */
1751b5c07418SJames Feist nlohmann::json emptyJSON(void)
17521abe55efSEd Tanous {
1753b5c07418SJames Feist     return nlohmann::json{
1754b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1755684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.EmptyJSON"},
1756f12894f8SJason M. Bills         {"Message", "The request body submitted contained an empty JSON "
175766ac2b8cSJason M. Bills                     "object and the service is unable to process it."},
175885659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1759684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1760f4c4dcf4SKowalski, Kamil         {"Resolution",
1761b5c07418SJames Feist          "Add properties in the JSON object and resubmit the request."}};
1762b5c07418SJames Feist }
1763b5c07418SJames Feist 
1764b5c07418SJames Feist void emptyJSON(crow::Response& res)
1765b5c07418SJames Feist {
1766b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1767b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, emptyJSON());
1768f4c4dcf4SKowalski, Kamil }
1769f4c4dcf4SKowalski, Kamil 
1770f4c4dcf4SKowalski, Kamil /**
1771f4c4dcf4SKowalski, Kamil  * @internal
1772f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupportedOnResource message into JSON
1773f4c4dcf4SKowalski, Kamil  *
1774f4c4dcf4SKowalski, Kamil  * See header file for more information
1775f4c4dcf4SKowalski, Kamil  * @endinternal
1776f4c4dcf4SKowalski, Kamil  */
1777b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void)
17781abe55efSEd Tanous {
1779b5c07418SJames Feist     return nlohmann::json{
1780b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1781684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupportedOnResource"},
1782f4c4dcf4SKowalski, Kamil         {"Message", "Querying is not supported on the requested resource."},
178385659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1784684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
178566ac2b8cSJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the "
1786b5c07418SJames Feist                        "request if the operation failed."}};
1787b5c07418SJames Feist }
1788b5c07418SJames Feist 
1789b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res)
1790b5c07418SJames Feist {
1791b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1792b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
1793f4c4dcf4SKowalski, Kamil }
1794f4c4dcf4SKowalski, Kamil 
1795f4c4dcf4SKowalski, Kamil /**
1796f4c4dcf4SKowalski, Kamil  * @internal
1797684bb4b8SJason M. Bills  * @brief Formats QueryNotSupportedOnOperation message into JSON
1798684bb4b8SJason M. Bills  *
1799684bb4b8SJason M. Bills  * See header file for more information
1800684bb4b8SJason M. Bills  * @endinternal
1801684bb4b8SJason M. Bills  */
1802684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void)
1803684bb4b8SJason M. Bills {
1804684bb4b8SJason M. Bills     return nlohmann::json{
1805684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1806684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupportedOnOperation"},
1807684bb4b8SJason M. Bills         {"Message", "Querying is not supported with the requested operation."},
1808684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1809684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1810684bb4b8SJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the request "
1811684bb4b8SJason M. Bills                        "if the operation failed."}};
1812684bb4b8SJason M. Bills }
1813684bb4b8SJason M. Bills 
1814684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res)
1815684bb4b8SJason M. Bills {
1816684bb4b8SJason M. Bills     res.result(boost::beast::http::status::forbidden);
1817684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
1818684bb4b8SJason M. Bills }
1819684bb4b8SJason M. Bills 
1820684bb4b8SJason M. Bills /**
1821684bb4b8SJason M. Bills  * @internal
1822684bb4b8SJason M. Bills  * @brief Formats QueryCombinationInvalid message into JSON
1823684bb4b8SJason M. Bills  *
1824684bb4b8SJason M. Bills  * See header file for more information
1825684bb4b8SJason M. Bills  * @endinternal
1826684bb4b8SJason M. Bills  */
1827684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void)
1828684bb4b8SJason M. Bills {
1829684bb4b8SJason M. Bills     return nlohmann::json{
1830684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1831684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryCombinationInvalid"},
1832684bb4b8SJason M. Bills         {"Message", "Two or more query parameters in the request cannot be "
1833684bb4b8SJason M. Bills                     "used together."},
1834684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1835684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1836684bb4b8SJason M. Bills         {"Resolution", "Remove one or more of the query parameters and "
1837684bb4b8SJason M. Bills                        "resubmit the request if the operation failed."}};
1838684bb4b8SJason M. Bills }
1839684bb4b8SJason M. Bills 
1840684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res)
1841684bb4b8SJason M. Bills {
1842684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1843684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
1844684bb4b8SJason M. Bills }
1845684bb4b8SJason M. Bills 
1846684bb4b8SJason M. Bills /**
1847684bb4b8SJason M. Bills  * @internal
1848f4c4dcf4SKowalski, Kamil  * @brief Formats InsufficientPrivilege message into JSON
1849f4c4dcf4SKowalski, Kamil  *
1850f4c4dcf4SKowalski, Kamil  * See header file for more information
1851f4c4dcf4SKowalski, Kamil  * @endinternal
1852f4c4dcf4SKowalski, Kamil  */
1853b5c07418SJames Feist nlohmann::json insufficientPrivilege(void)
18541abe55efSEd Tanous {
1855b5c07418SJames Feist     return nlohmann::json{
1856b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1857684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InsufficientPrivilege"},
185866ac2b8cSJason M. Bills         {"Message", "There are insufficient privileges for the account or "
185966ac2b8cSJason M. Bills                     "credentials associated with the current session to "
186066ac2b8cSJason M. Bills                     "perform the requested operation."},
186185659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1862684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1863f4c4dcf4SKowalski, Kamil         {"Resolution",
1864f12894f8SJason M. Bills          "Either abandon the operation or change the associated access "
1865b5c07418SJames Feist          "rights and resubmit the request if the operation failed."}};
1866b5c07418SJames Feist }
1867b5c07418SJames Feist 
1868b5c07418SJames Feist void insufficientPrivilege(crow::Response& res)
1869b5c07418SJames Feist {
1870b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1871b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
1872f4c4dcf4SKowalski, Kamil }
1873f4c4dcf4SKowalski, Kamil 
1874f4c4dcf4SKowalski, Kamil /**
1875f4c4dcf4SKowalski, Kamil  * @internal
1876f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyValueModified message into JSON
1877f4c4dcf4SKowalski, Kamil  *
1878f4c4dcf4SKowalski, Kamil  * See header file for more information
1879f4c4dcf4SKowalski, Kamil  * @endinternal
1880f4c4dcf4SKowalski, Kamil  */
1881b5c07418SJames Feist nlohmann::json propertyValueModified(const std::string& arg1,
1882b5c07418SJames Feist                                      const std::string& arg2)
1883b5c07418SJames Feist {
1884b5c07418SJames Feist     return nlohmann::json{
1885b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1886684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueModified"},
1887b5c07418SJames Feist         {"Message", "The property " + arg1 + " was assigned the value " + arg2 +
1888b5c07418SJames Feist                         " due to modification by the service."},
1889b5c07418SJames Feist         {"MessageArgs", {arg1, arg2}},
1890684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1891b5c07418SJames Feist         {"Resolution", "No resolution is required."}};
1892b5c07418SJames Feist }
1893b5c07418SJames Feist 
1894f12894f8SJason M. Bills void propertyValueModified(crow::Response& res, const std::string& arg1,
1895a08b46ccSJason M. Bills                            const std::string& arg2)
18961abe55efSEd Tanous {
1897f12894f8SJason M. Bills     res.result(boost::beast::http::status::ok);
1898b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
1899f4c4dcf4SKowalski, Kamil }
1900f4c4dcf4SKowalski, Kamil 
1901f4c4dcf4SKowalski, Kamil /**
1902f4c4dcf4SKowalski, Kamil  * @internal
1903f4c4dcf4SKowalski, Kamil  * @brief Formats AccountNotModified message into JSON
1904f4c4dcf4SKowalski, Kamil  *
1905f4c4dcf4SKowalski, Kamil  * See header file for more information
1906f4c4dcf4SKowalski, Kamil  * @endinternal
1907f4c4dcf4SKowalski, Kamil  */
1908b5c07418SJames Feist nlohmann::json accountNotModified(void)
19091abe55efSEd Tanous {
1910b5c07418SJames Feist     return nlohmann::json{
1911b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1912684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccountNotModified"},
1913f4c4dcf4SKowalski, Kamil         {"Message", "The account modification request failed."},
191485659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1915684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1916f12894f8SJason M. Bills         {"Resolution", "The modification may have failed due to permission "
1917b5c07418SJames Feist                        "issues or issues with the request body."}};
1918b5c07418SJames Feist }
1919b5c07418SJames Feist 
1920b5c07418SJames Feist void accountNotModified(crow::Response& res)
1921b5c07418SJames Feist {
1922b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1923b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountNotModified());
1924f4c4dcf4SKowalski, Kamil }
1925f4c4dcf4SKowalski, Kamil 
1926f4c4dcf4SKowalski, Kamil /**
1927f4c4dcf4SKowalski, Kamil  * @internal
1928f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueFormatError message into JSON
1929f4c4dcf4SKowalski, Kamil  *
1930f4c4dcf4SKowalski, Kamil  * See header file for more information
1931f4c4dcf4SKowalski, Kamil  * @endinternal
1932f4c4dcf4SKowalski, Kamil  */
1933b5c07418SJames Feist nlohmann::json queryParameterValueFormatError(const std::string& arg1,
19341abe55efSEd Tanous                                               const std::string& arg2)
19351abe55efSEd Tanous {
1936b5c07418SJames Feist     return nlohmann::json{
1937b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1938684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterValueFormatError"},
1939f4c4dcf4SKowalski, Kamil         {"Message",
1940f4c4dcf4SKowalski, Kamil          "The value " + arg1 + " for the parameter " + arg2 +
1941f4c4dcf4SKowalski, Kamil              " is of a different format than the parameter can accept."},
194285659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1943684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
194466ac2b8cSJason M. Bills         {"Resolution",
194566ac2b8cSJason M. Bills          "Correct the value for the query parameter in the request and "
1946b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1947b5c07418SJames Feist }
1948b5c07418SJames Feist 
1949b5c07418SJames Feist void queryParameterValueFormatError(crow::Response& res,
1950b5c07418SJames Feist                                     const std::string& arg1,
1951b5c07418SJames Feist                                     const std::string& arg2)
1952b5c07418SJames Feist {
1953b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1954b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1955b5c07418SJames Feist                           queryParameterValueFormatError(arg1, arg2));
1956f4c4dcf4SKowalski, Kamil }
1957f4c4dcf4SKowalski, Kamil 
1958f4c4dcf4SKowalski, Kamil /**
1959f4c4dcf4SKowalski, Kamil  * @internal
1960b5c07418SJames Feist  * @brief Formats PropertyMissing message into JSON for the specified
1961b5c07418SJames Feist  * property
1962f12894f8SJason M. Bills  *
1963f12894f8SJason M. Bills  * See header file for more information
1964f12894f8SJason M. Bills  * @endinternal
1965f12894f8SJason M. Bills  */
1966b5c07418SJames Feist nlohmann::json propertyMissing(const std::string& arg1)
1967f12894f8SJason M. Bills {
1968b5c07418SJames Feist     return nlohmann::json{
1969b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1970684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyMissing"},
1971f12894f8SJason M. Bills         {"Message", "The property " + arg1 +
1972f12894f8SJason M. Bills                         " is a required property and must be included in "
1973f12894f8SJason M. Bills                         "the request."},
197485659adfSJason M. Bills         {"MessageArgs", {arg1}},
1975684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1976f12894f8SJason M. Bills         {"Resolution",
1977b5c07418SJames Feist          "Ensure that the property is in the request body and has a "
1978b5c07418SJames Feist          "valid "
1979b5c07418SJames Feist          "value and resubmit the request if the operation failed."}};
1980b5c07418SJames Feist }
1981b5c07418SJames Feist 
1982b5c07418SJames Feist void propertyMissing(crow::Response& res, const std::string& arg1)
1983b5c07418SJames Feist {
1984b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1985b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
1986f4c4dcf4SKowalski, Kamil }
1987f4c4dcf4SKowalski, Kamil 
1988f4c4dcf4SKowalski, Kamil /**
1989f4c4dcf4SKowalski, Kamil  * @internal
1990f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceExhaustion message into JSON
1991f4c4dcf4SKowalski, Kamil  *
1992f4c4dcf4SKowalski, Kamil  * See header file for more information
1993f4c4dcf4SKowalski, Kamil  * @endinternal
1994f4c4dcf4SKowalski, Kamil  */
1995b5c07418SJames Feist nlohmann::json resourceExhaustion(const std::string& arg1)
19961abe55efSEd Tanous {
1997b5c07418SJames Feist     return nlohmann::json{
1998b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1999684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceExhaustion"},
2000d425c6f6SEd Tanous         {"Message", "The resource " + arg1 +
200166ac2b8cSJason M. Bills                         " was unable to satisfy the request due to "
200266ac2b8cSJason M. Bills                         "unavailability of resources."},
200385659adfSJason M. Bills         {"MessageArgs", {arg1}},
2004684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
2005f12894f8SJason M. Bills         {"Resolution", "Ensure that the resources are available and "
2006b5c07418SJames Feist                        "resubmit the request."}};
2007b5c07418SJames Feist }
2008b5c07418SJames Feist 
2009b5c07418SJames Feist void resourceExhaustion(crow::Response& res, const std::string& arg1)
2010b5c07418SJames Feist {
2011b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
2012b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
2013f4c4dcf4SKowalski, Kamil }
2014f4c4dcf4SKowalski, Kamil 
2015f4c4dcf4SKowalski, Kamil /**
2016f4c4dcf4SKowalski, Kamil  * @internal
2017f4c4dcf4SKowalski, Kamil  * @brief Formats AccountModified message into JSON
2018f4c4dcf4SKowalski, Kamil  *
2019f4c4dcf4SKowalski, Kamil  * See header file for more information
2020f4c4dcf4SKowalski, Kamil  * @endinternal
2021f4c4dcf4SKowalski, Kamil  */
2022b5c07418SJames Feist nlohmann::json accountModified(void)
20231abe55efSEd Tanous {
2024b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
2025684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.AccountModified"},
2026f4c4dcf4SKowalski, Kamil                           {"Message", "The account was successfully modified."},
202785659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
2028684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
2029b5c07418SJames Feist                           {"Resolution", "No resolution is required."}};
2030b5c07418SJames Feist }
2031b5c07418SJames Feist 
2032b5c07418SJames Feist void accountModified(crow::Response& res)
2033b5c07418SJames Feist {
2034b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
2035b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountModified());
2036f4c4dcf4SKowalski, Kamil }
2037f4c4dcf4SKowalski, Kamil 
2038f4c4dcf4SKowalski, Kamil /**
2039f4c4dcf4SKowalski, Kamil  * @internal
2040f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterOutOfRange message into JSON
2041f4c4dcf4SKowalski, Kamil  *
2042f4c4dcf4SKowalski, Kamil  * See header file for more information
2043f4c4dcf4SKowalski, Kamil  * @endinternal
2044f4c4dcf4SKowalski, Kamil  */
2045b5c07418SJames Feist nlohmann::json queryParameterOutOfRange(const std::string& arg1,
2046b5c07418SJames Feist                                         const std::string& arg2,
2047b5c07418SJames Feist                                         const std::string& arg3)
20481abe55efSEd Tanous {
2049b5c07418SJames Feist     return nlohmann::json{
2050b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
2051684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterOutOfRange"},
2052b5c07418SJames Feist         {"Message", "The value " + arg1 + " for the query parameter " + arg2 +
2053b5c07418SJames Feist                         " is out of range " + arg3 + "."},
205485659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
2055684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
2056f4c4dcf4SKowalski, Kamil         {"Resolution",
2057f12894f8SJason M. Bills          "Reduce the value for the query parameter to a value that is "
205866ac2b8cSJason M. Bills          "within range, such as a start or count value that is within "
205966ac2b8cSJason M. Bills          "bounds of the number of resources in a collection or a page that "
2060b5c07418SJames Feist          "is within the range of valid pages."}};
2061b5c07418SJames Feist }
2062b5c07418SJames Feist 
2063b5c07418SJames Feist void queryParameterOutOfRange(crow::Response& res, const std::string& arg1,
2064b5c07418SJames Feist                               const std::string& arg2, const std::string& arg3)
2065b5c07418SJames Feist {
2066b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
2067b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
2068b5c07418SJames Feist                           queryParameterOutOfRange(arg1, arg2, arg3));
2069f4c4dcf4SKowalski, Kamil }
2070f4c4dcf4SKowalski, Kamil 
20713bf4e632SJoseph Reynolds /**
20723bf4e632SJoseph Reynolds  * @internal
20733bf4e632SJoseph Reynolds  * @brief Formats PasswordChangeRequired message into JSON
20743bf4e632SJoseph Reynolds  *
20753bf4e632SJoseph Reynolds  * See header file for more information
20763bf4e632SJoseph Reynolds  * @endinternal
20773bf4e632SJoseph Reynolds  */
20783bf4e632SJoseph Reynolds void passwordChangeRequired(crow::Response& res, const std::string& arg1)
20793bf4e632SJoseph Reynolds {
20803bf4e632SJoseph Reynolds     messages::addMessageToJsonRoot(
20813bf4e632SJoseph Reynolds         res.jsonValue,
20823bf4e632SJoseph Reynolds         nlohmann::json{
20833bf4e632SJoseph Reynolds             {"@odata.type", "/redfish/v1/$metadata#Message.v1_5_0.Message"},
2084684bb4b8SJason M. Bills             {"MessageId", "Base.1.8.1.PasswordChangeRequired"},
20853bf4e632SJoseph Reynolds             {"Message", "The password provided for this account must be "
20863bf4e632SJoseph Reynolds                         "changed before access is granted.  PATCH the "
20873bf4e632SJoseph Reynolds                         "'Password' property for this account located at "
20883bf4e632SJoseph Reynolds                         "the target URI '" +
20893bf4e632SJoseph Reynolds                             arg1 + "' to complete this process."},
20903bf4e632SJoseph Reynolds             {"MessageArgs", {arg1}},
2091684bb4b8SJason M. Bills             {"MessageSeverity", "Critical"},
20923bf4e632SJoseph Reynolds             {"Resolution", "Change the password for this account using "
20933bf4e632SJoseph Reynolds                            "a PATCH to the 'Password' property at the URI "
20943bf4e632SJoseph Reynolds                            "provided."}});
20953bf4e632SJoseph Reynolds }
20963bf4e632SJoseph Reynolds 
20974cde5d90SJames Feist void invalidUpload(crow::Response& res, const std::string& arg1,
20984cde5d90SJames Feist                    const std::string& arg2)
20994cde5d90SJames Feist {
21004cde5d90SJames Feist     res.result(boost::beast::http::status::bad_request);
21014cde5d90SJames Feist     addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2));
21024cde5d90SJames Feist }
21034cde5d90SJames Feist 
21044cde5d90SJames Feist /**
21054cde5d90SJames Feist  * @internal
21064cde5d90SJames Feist  * @brief Formats Invalid File message into JSON
21074cde5d90SJames Feist  *
21084cde5d90SJames Feist  * See header file for more information
21094cde5d90SJames Feist  * @endinternal
21104cde5d90SJames Feist  */
21114cde5d90SJames Feist nlohmann::json invalidUpload(const std::string& arg1, const std::string& arg2)
21124cde5d90SJames Feist {
21134cde5d90SJames Feist     return nlohmann::json{
21144cde5d90SJames Feist         {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
21154cde5d90SJames Feist         {"MessageId", "OpenBMC.0.1.0.InvalidUpload"},
21164cde5d90SJames Feist         {"Message", "Invalid file uploaded to " + arg1 + ": " + arg2 + "."},
21174cde5d90SJames Feist         {"MessageArgs", {arg1, arg2}},
2118684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
21194cde5d90SJames Feist         {"Resolution", "None."}};
21204cde5d90SJames Feist }
21214cde5d90SJames Feist 
2122dd28ba82SAppaRao Puli /**
2123dd28ba82SAppaRao Puli  * @internal
2124dd28ba82SAppaRao Puli  * @brief Formats MutualExclusiveProperties into JSON
2125dd28ba82SAppaRao Puli  *
2126dd28ba82SAppaRao Puli  * See header file for more information
2127dd28ba82SAppaRao Puli  * @endinternal
2128dd28ba82SAppaRao Puli  */
2129dd28ba82SAppaRao Puli nlohmann::json mutualExclusiveProperties(const std::string& arg1,
2130dd28ba82SAppaRao Puli                                          const std::string& arg2)
2131dd28ba82SAppaRao Puli {
2132dd28ba82SAppaRao Puli     return nlohmann::json{
2133dd28ba82SAppaRao Puli         {"@odata.type", "#Message.v1_0_0.Message"},
2134dd28ba82SAppaRao Puli         {"MessageId", "Base.1.5.0.MutualExclusiveProperties"},
2135dd28ba82SAppaRao Puli         {"Message", "The properties " + arg1 + " and " + arg2 +
2136dd28ba82SAppaRao Puli                         " are mutually exclusive."},
2137dd28ba82SAppaRao Puli         {"MessageArgs", {arg1, arg2}},
2138684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
2139dd28ba82SAppaRao Puli         {"Resolution",
2140dd28ba82SAppaRao Puli          "Ensure that the request body doesn't contain mutually exclusive "
2141dd28ba82SAppaRao Puli          "properties and resubmit the request."}};
2142dd28ba82SAppaRao Puli }
2143dd28ba82SAppaRao Puli 
2144dd28ba82SAppaRao Puli void mutualExclusiveProperties(crow::Response& res, const std::string& arg1,
2145dd28ba82SAppaRao Puli                                const std::string& arg2)
2146dd28ba82SAppaRao Puli {
2147dd28ba82SAppaRao Puli     res.result(boost::beast::http::status::bad_request);
2148dd28ba82SAppaRao Puli     addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2));
2149dd28ba82SAppaRao Puli }
2150dd28ba82SAppaRao Puli 
2151f4c4dcf4SKowalski, Kamil } // namespace messages
2152f4c4dcf4SKowalski, Kamil 
2153d425c6f6SEd Tanous } // namespace redfish
2154