xref: /openbmc/bmcweb/features/redfish/src/error_messages.cpp (revision 04e438cbad66838724d78ce12f28aff1fb892a63)
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 */
161abe55efSEd Tanous #include <error_messages.hpp>
17*04e438cbSEd Tanous #include <logging.hpp>
18f4c4dcf4SKowalski, Kamil 
191abe55efSEd Tanous namespace redfish
201abe55efSEd Tanous {
211abe55efSEd Tanous 
221abe55efSEd Tanous namespace messages
231abe55efSEd Tanous {
24f4c4dcf4SKowalski, Kamil 
25f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target,
261abe55efSEd Tanous                                   const nlohmann::json& message)
271abe55efSEd Tanous {
28f4c4dcf4SKowalski, Kamil     auto& error = target["error"];
29f4c4dcf4SKowalski, Kamil 
301abe55efSEd Tanous     // If this is the first error message, fill in the information from the
311abe55efSEd Tanous     // first error message to the top level struct
321abe55efSEd Tanous     if (!error.is_object())
331abe55efSEd Tanous     {
34c074230bSJason M. Bills         auto messageIdIterator = message.find("MessageId");
35c074230bSJason M. Bills         if (messageIdIterator == message.end())
361abe55efSEd Tanous         {
371abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
381abe55efSEd Tanous                 << "Attempt to add error message without MessageId";
39f4c4dcf4SKowalski, Kamil             return;
40f4c4dcf4SKowalski, Kamil         }
41f4c4dcf4SKowalski, Kamil 
42c074230bSJason M. Bills         auto messageFieldIterator = message.find("Message");
43c074230bSJason M. Bills         if (messageFieldIterator == message.end())
441abe55efSEd Tanous         {
451abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
461abe55efSEd Tanous                 << "Attempt to add error message without Message";
47f4c4dcf4SKowalski, Kamil             return;
48f4c4dcf4SKowalski, Kamil         }
49c21055aaSEd Tanous         error = {{"code", *messageIdIterator},
50c21055aaSEd Tanous                  {"message", *messageFieldIterator}};
511abe55efSEd Tanous     }
521abe55efSEd Tanous     else
531abe55efSEd Tanous     {
54f4c4dcf4SKowalski, Kamil         // More than 1 error occurred, so the message has to be generic
5555c7b7a2SEd Tanous         error["code"] = std::string(messageVersionPrefix) + "GeneralError";
56cc9139ecSJason M. Bills         error["message"] = "A general error has occurred. See Resolution for "
57cc9139ecSJason M. Bills                            "information on how to resolve the error.";
58f4c4dcf4SKowalski, Kamil     }
59f4c4dcf4SKowalski, Kamil 
60f4c4dcf4SKowalski, Kamil     // This check could technically be done in in the default construction
61f4c4dcf4SKowalski, Kamil     // branch above, but because we need the pointer to the extended info field
62f4c4dcf4SKowalski, Kamil     // anyway, it's more efficient to do it here.
63c074230bSJason M. Bills     auto& extendedInfo = error[messages::messageAnnotation];
64c074230bSJason M. Bills     if (!extendedInfo.is_array())
651abe55efSEd Tanous     {
66c074230bSJason M. Bills         extendedInfo = nlohmann::json::array();
67f4c4dcf4SKowalski, Kamil     }
68f4c4dcf4SKowalski, Kamil 
69c074230bSJason M. Bills     extendedInfo.push_back(message);
70f4c4dcf4SKowalski, Kamil }
71f4c4dcf4SKowalski, Kamil 
72f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target,
73f12894f8SJason M. Bills                                  const nlohmann::json& message)
741abe55efSEd Tanous {
751abe55efSEd Tanous     if (!target[messages::messageAnnotation].is_array())
761abe55efSEd Tanous     {
77f4c4dcf4SKowalski, Kamil         // Force object to be an array
7855c7b7a2SEd Tanous         target[messages::messageAnnotation] = nlohmann::json::array();
79f4c4dcf4SKowalski, Kamil     }
80f4c4dcf4SKowalski, Kamil 
8155c7b7a2SEd Tanous     target[messages::messageAnnotation].push_back(message);
82f4c4dcf4SKowalski, Kamil }
83f4c4dcf4SKowalski, Kamil 
84f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target,
85f12894f8SJason M. Bills                              const nlohmann::json& message,
861abe55efSEd Tanous                              const std::string& fieldPath)
871abe55efSEd Tanous {
88a08b46ccSJason M. Bills     std::string extendedInfo(fieldPath + messages::messageAnnotation);
89f4c4dcf4SKowalski, Kamil 
901abe55efSEd Tanous     if (!target[extendedInfo].is_array())
911abe55efSEd Tanous     {
92f4c4dcf4SKowalski, Kamil         // Force object to be an array
93f4c4dcf4SKowalski, Kamil         target[extendedInfo] = nlohmann::json::array();
94f4c4dcf4SKowalski, Kamil     }
95f4c4dcf4SKowalski, Kamil 
96f4c4dcf4SKowalski, Kamil     // Object exists and it is an array so we can just push in the message
97f4c4dcf4SKowalski, Kamil     target[extendedInfo].push_back(message);
98f4c4dcf4SKowalski, Kamil }
99f4c4dcf4SKowalski, Kamil 
100f4c4dcf4SKowalski, Kamil /**
101f4c4dcf4SKowalski, Kamil  * @internal
102f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInUse message into JSON
103f4c4dcf4SKowalski, Kamil  *
104f4c4dcf4SKowalski, Kamil  * See header file for more information
105f4c4dcf4SKowalski, Kamil  * @endinternal
106f4c4dcf4SKowalski, Kamil  */
107b5c07418SJames Feist nlohmann::json resourceInUse(void)
1081abe55efSEd Tanous {
109b5c07418SJames Feist     return nlohmann::json{
110b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
111684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceInUse"},
11266ac2b8cSJason M. Bills         {"Message", "The change to the requested resource failed because "
11366ac2b8cSJason M. Bills                     "the resource is in use or in transition."},
11485659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
115684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
11666ac2b8cSJason M. Bills         {"Resolution", "Remove the condition and resubmit the request if "
117b5c07418SJames Feist                        "the operation failed."}};
118b5c07418SJames Feist }
119b5c07418SJames Feist 
120b5c07418SJames Feist void resourceInUse(crow::Response& res)
121b5c07418SJames Feist {
122b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
123b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInUse());
124f4c4dcf4SKowalski, Kamil }
125f4c4dcf4SKowalski, Kamil 
126f4c4dcf4SKowalski, Kamil /**
127f4c4dcf4SKowalski, Kamil  * @internal
128f4c4dcf4SKowalski, Kamil  * @brief Formats MalformedJSON message into JSON
129f4c4dcf4SKowalski, Kamil  *
130f4c4dcf4SKowalski, Kamil  * See header file for more information
131f4c4dcf4SKowalski, Kamil  * @endinternal
132f4c4dcf4SKowalski, Kamil  */
133b5c07418SJames Feist nlohmann::json malformedJSON(void)
1341abe55efSEd Tanous {
135b5c07418SJames Feist     return nlohmann::json{
136b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
137684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.MalformedJSON"},
13866ac2b8cSJason M. Bills         {"Message", "The request body submitted was malformed JSON and "
13966ac2b8cSJason M. Bills                     "could not be parsed by the receiving service."},
14085659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
141684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1421abe55efSEd Tanous         {"Resolution", "Ensure that the request body is valid JSON and "
143b5c07418SJames Feist                        "resubmit the request."}};
144b5c07418SJames Feist }
145b5c07418SJames Feist 
146b5c07418SJames Feist void malformedJSON(crow::Response& res)
147b5c07418SJames Feist {
148b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
149b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, malformedJSON());
150f4c4dcf4SKowalski, Kamil }
151f4c4dcf4SKowalski, Kamil 
152f4c4dcf4SKowalski, Kamil /**
153f4c4dcf4SKowalski, Kamil  * @internal
154f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceMissingAtURI message into JSON
155f4c4dcf4SKowalski, Kamil  *
156f4c4dcf4SKowalski, Kamil  * See header file for more information
157f4c4dcf4SKowalski, Kamil  * @endinternal
158f4c4dcf4SKowalski, Kamil  */
159b5c07418SJames Feist nlohmann::json resourceMissingAtURI(const std::string& arg1)
1601abe55efSEd Tanous {
161b5c07418SJames Feist     return nlohmann::json{
162b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
163684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceMissingAtURI"},
164f4c4dcf4SKowalski, Kamil         {"Message", "The resource at the URI " + arg1 + " was not found."},
16585659adfSJason M. Bills         {"MessageArgs", {arg1}},
166684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
16766ac2b8cSJason M. Bills         {"Resolution", "Place a valid resource at the URI or correct the "
168b5c07418SJames Feist                        "URI and resubmit the request."}};
169b5c07418SJames Feist }
170b5c07418SJames Feist 
171b5c07418SJames Feist void resourceMissingAtURI(crow::Response& res, const std::string& arg1)
172b5c07418SJames Feist {
173b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
174b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
175f4c4dcf4SKowalski, Kamil }
176f4c4dcf4SKowalski, Kamil 
177f4c4dcf4SKowalski, Kamil /**
178f4c4dcf4SKowalski, Kamil  * @internal
179f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueFormatError message into JSON
180f4c4dcf4SKowalski, Kamil  *
181f4c4dcf4SKowalski, Kamil  * See header file for more information
182f4c4dcf4SKowalski, Kamil  * @endinternal
183f4c4dcf4SKowalski, Kamil  */
184b5c07418SJames Feist nlohmann::json actionParameterValueFormatError(const std::string& arg1,
185f4c4dcf4SKowalski, Kamil                                                const std::string& arg2,
1861abe55efSEd Tanous                                                const std::string& arg3)
1871abe55efSEd Tanous {
188b5c07418SJames Feist     return nlohmann::json{
189b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
190684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterValueFormatError"},
191f4c4dcf4SKowalski, Kamil         {"Message",
1921abe55efSEd Tanous          "The value " + arg1 + " for the parameter " + arg2 +
1931abe55efSEd Tanous              " in the action " + arg3 +
1941abe55efSEd Tanous              " is of a different format than the parameter can accept."},
19585659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
196684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
19766ac2b8cSJason M. Bills         {"Resolution",
19866ac2b8cSJason M. Bills          "Correct the value for the parameter in the request body and "
199b5c07418SJames Feist          "resubmit the request if the operation failed."}};
200b5c07418SJames Feist }
201b5c07418SJames Feist 
202b5c07418SJames Feist void actionParameterValueFormatError(crow::Response& res,
203b5c07418SJames Feist                                      const std::string& arg1,
204b5c07418SJames Feist                                      const std::string& arg2,
205b5c07418SJames Feist                                      const std::string& arg3)
206b5c07418SJames Feist {
207b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
208b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
209b5c07418SJames Feist                           actionParameterValueFormatError(arg1, arg2, arg3));
210f4c4dcf4SKowalski, Kamil }
211f4c4dcf4SKowalski, Kamil 
212f4c4dcf4SKowalski, Kamil /**
213f4c4dcf4SKowalski, Kamil  * @internal
214f4c4dcf4SKowalski, Kamil  * @brief Formats InternalError message into JSON
215f4c4dcf4SKowalski, Kamil  *
216f4c4dcf4SKowalski, Kamil  * See header file for more information
217f4c4dcf4SKowalski, Kamil  * @endinternal
218f4c4dcf4SKowalski, Kamil  */
219b5c07418SJames Feist nlohmann::json internalError(void)
2201abe55efSEd Tanous {
221b5c07418SJames Feist     return nlohmann::json{
222b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
223684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InternalError"},
224f12894f8SJason M. Bills         {"Message", "The request failed due to an internal service error.  "
22566ac2b8cSJason M. Bills                     "The service is still operational."},
22685659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
227684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
2281abe55efSEd Tanous         {"Resolution", "Resubmit the request.  If the problem persists, "
229b5c07418SJames Feist                        "consider resetting the service."}};
230b5c07418SJames Feist }
231b5c07418SJames Feist 
232b5c07418SJames Feist void internalError(crow::Response& res)
233b5c07418SJames Feist {
234b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
235b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, internalError());
236f12894f8SJason M. Bills }
237f12894f8SJason M. Bills 
238f12894f8SJason M. Bills /**
239f12894f8SJason M. Bills  * @internal
240f4c4dcf4SKowalski, Kamil  * @brief Formats UnrecognizedRequestBody message into JSON
241f4c4dcf4SKowalski, Kamil  *
242f4c4dcf4SKowalski, Kamil  * See header file for more information
243f4c4dcf4SKowalski, Kamil  * @endinternal
244f4c4dcf4SKowalski, Kamil  */
245b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void)
2461abe55efSEd Tanous {
247b5c07418SJames Feist     return nlohmann::json{
248b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
249684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.UnrecognizedRequestBody"},
250f12894f8SJason M. Bills         {"Message", "The service detected a malformed request body that it "
25166ac2b8cSJason M. Bills                     "was unable to interpret."},
25285659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
253684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
254f12894f8SJason M. Bills         {"Resolution", "Correct the request body and resubmit the request "
255b5c07418SJames Feist                        "if it failed."}};
256b5c07418SJames Feist }
257b5c07418SJames Feist 
258b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res)
259b5c07418SJames Feist {
260b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
261b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
262f4c4dcf4SKowalski, Kamil }
263f4c4dcf4SKowalski, Kamil 
264f4c4dcf4SKowalski, Kamil /**
265f4c4dcf4SKowalski, Kamil  * @internal
266f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriUnauthorized message into JSON
267f4c4dcf4SKowalski, Kamil  *
268f4c4dcf4SKowalski, Kamil  * See header file for more information
269f4c4dcf4SKowalski, Kamil  * @endinternal
270f4c4dcf4SKowalski, Kamil  */
271b5c07418SJames Feist nlohmann::json resourceAtUriUnauthorized(const std::string& arg1,
2721abe55efSEd Tanous                                          const std::string& arg2)
2731abe55efSEd Tanous {
274b5c07418SJames Feist     return nlohmann::json{
275b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
276684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAtUriUnauthorized"},
277f4c4dcf4SKowalski, Kamil         {"Message", "While accessing the resource at " + arg1 +
2781abe55efSEd Tanous                         ", the service received an authorization error " +
2791abe55efSEd Tanous                         arg2 + "."},
28085659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
281684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
282f12894f8SJason M. Bills         {"Resolution", "Ensure that the appropriate access is provided for "
283b5c07418SJames Feist                        "the service in order for it to access the URI."}};
284b5c07418SJames Feist }
285b5c07418SJames Feist 
286b5c07418SJames Feist void resourceAtUriUnauthorized(crow::Response& res, const std::string& arg1,
287b5c07418SJames Feist                                const std::string& arg2)
288b5c07418SJames Feist {
289b5c07418SJames Feist     res.result(boost::beast::http::status::unauthorized);
290b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
291f4c4dcf4SKowalski, Kamil }
292f4c4dcf4SKowalski, Kamil 
293f4c4dcf4SKowalski, Kamil /**
294f4c4dcf4SKowalski, Kamil  * @internal
295f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterUnknown message into JSON
296f4c4dcf4SKowalski, Kamil  *
297f4c4dcf4SKowalski, Kamil  * See header file for more information
298f4c4dcf4SKowalski, Kamil  * @endinternal
299f4c4dcf4SKowalski, Kamil  */
300b5c07418SJames Feist nlohmann::json actionParameterUnknown(const std::string& arg1,
301b5c07418SJames Feist                                       const std::string& arg2)
302b5c07418SJames Feist {
303b5c07418SJames Feist     return nlohmann::json{
304b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
305684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterUnknown"},
306b5c07418SJames Feist         {"Message", "The action " + arg1 +
307b5c07418SJames Feist                         " was submitted with the invalid parameter " + arg2 +
308b5c07418SJames Feist                         "."},
309b5c07418SJames Feist         {"MessageArgs", {arg1, arg2}},
310684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
311b5c07418SJames Feist         {"Resolution", "Correct the invalid parameter and resubmit the "
312b5c07418SJames Feist                        "request if the operation failed."}};
313b5c07418SJames Feist }
314b5c07418SJames Feist 
315f12894f8SJason M. Bills void actionParameterUnknown(crow::Response& res, const std::string& arg1,
3161abe55efSEd Tanous                             const std::string& arg2)
3171abe55efSEd Tanous {
318f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
319b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
320f4c4dcf4SKowalski, Kamil }
321f4c4dcf4SKowalski, Kamil 
322f4c4dcf4SKowalski, Kamil /**
323f4c4dcf4SKowalski, Kamil  * @internal
324f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceCannotBeDeleted message into JSON
325f4c4dcf4SKowalski, Kamil  *
326f4c4dcf4SKowalski, Kamil  * See header file for more information
327f4c4dcf4SKowalski, Kamil  * @endinternal
328f4c4dcf4SKowalski, Kamil  */
329b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void)
3301abe55efSEd Tanous {
331b5c07418SJames Feist     return nlohmann::json{
332b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
333684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceCannotBeDeleted"},
334f12894f8SJason M. Bills         {"Message", "The delete request failed because the resource "
33566ac2b8cSJason M. Bills                     "requested cannot be deleted."},
33685659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
337684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
338b5c07418SJames Feist         {"Resolution", "Do not attempt to delete a non-deletable resource."}};
339b5c07418SJames Feist }
340b5c07418SJames Feist 
341b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res)
342b5c07418SJames Feist {
343b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
344b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
345f4c4dcf4SKowalski, Kamil }
346f4c4dcf4SKowalski, Kamil 
347f4c4dcf4SKowalski, Kamil /**
348f4c4dcf4SKowalski, Kamil  * @internal
349f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyDuplicate message into JSON
350f4c4dcf4SKowalski, Kamil  *
351f4c4dcf4SKowalski, Kamil  * See header file for more information
352f4c4dcf4SKowalski, Kamil  * @endinternal
353f4c4dcf4SKowalski, Kamil  */
354b5c07418SJames Feist nlohmann::json propertyDuplicate(const std::string& arg1)
3551abe55efSEd Tanous {
356b5c07418SJames Feist     return nlohmann::json{
357b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
358684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyDuplicate"},
359b5c07418SJames Feist         {"Message", "The property " + arg1 + " was duplicated in the request."},
36085659adfSJason M. Bills         {"MessageArgs", {arg1}},
361684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
36266ac2b8cSJason M. Bills         {"Resolution",
36366ac2b8cSJason M. Bills          "Remove the duplicate property from the request body and resubmit "
364b5c07418SJames Feist          "the request if the operation failed."}};
365b5c07418SJames Feist }
366b5c07418SJames Feist 
367b5c07418SJames Feist void propertyDuplicate(crow::Response& res, const std::string& arg1)
368b5c07418SJames Feist {
369b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
370b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1);
371f4c4dcf4SKowalski, Kamil }
372f4c4dcf4SKowalski, Kamil 
373f4c4dcf4SKowalski, Kamil /**
374f4c4dcf4SKowalski, Kamil  * @internal
375f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceTemporarilyUnavailable message into JSON
376f4c4dcf4SKowalski, Kamil  *
377f4c4dcf4SKowalski, Kamil  * See header file for more information
378f4c4dcf4SKowalski, Kamil  * @endinternal
379f4c4dcf4SKowalski, Kamil  */
380b5c07418SJames Feist nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1)
3811abe55efSEd Tanous {
382b5c07418SJames Feist     return nlohmann::json{
383b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
384684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceTemporarilyUnavailable"},
3851abe55efSEd Tanous         {"Message", "The service is temporarily unavailable.  Retry in " +
3861abe55efSEd Tanous                         arg1 + " seconds."},
38785659adfSJason M. Bills         {"MessageArgs", {arg1}},
388684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
389f12894f8SJason M. Bills         {"Resolution", "Wait for the indicated retry duration and retry "
390b5c07418SJames Feist                        "the operation."}};
391b5c07418SJames Feist }
392b5c07418SJames Feist 
393b5c07418SJames Feist void serviceTemporarilyUnavailable(crow::Response& res, const std::string& arg1)
394b5c07418SJames Feist {
395b5c07418SJames Feist     res.addHeader("Retry-After", arg1);
396b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
397b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
398f4c4dcf4SKowalski, Kamil }
399f4c4dcf4SKowalski, Kamil 
400f4c4dcf4SKowalski, Kamil /**
401f4c4dcf4SKowalski, Kamil  * @internal
402f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAlreadyExists message into JSON
403f4c4dcf4SKowalski, Kamil  *
404f4c4dcf4SKowalski, Kamil  * See header file for more information
405f4c4dcf4SKowalski, Kamil  * @endinternal
406f4c4dcf4SKowalski, Kamil  */
407b5c07418SJames Feist nlohmann::json resourceAlreadyExists(const std::string& arg1,
408b5c07418SJames Feist                                      const std::string& arg2,
409b5c07418SJames Feist                                      const std::string& arg3)
4101abe55efSEd Tanous {
411b5c07418SJames Feist     return nlohmann::json{
412b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
413684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAlreadyExists"},
414f4c4dcf4SKowalski, Kamil         {"Message", "The requested resource of type " + arg1 +
4151abe55efSEd Tanous                         " with the property " + arg2 + " with the value " +
4161abe55efSEd Tanous                         arg3 + " already exists."},
41785659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
418684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
419f12894f8SJason M. Bills         {"Resolution", "Do not repeat the create operation as the resource "
420b5c07418SJames Feist                        "has already been created."}};
421b5c07418SJames Feist }
422b5c07418SJames Feist 
423b5c07418SJames Feist void resourceAlreadyExists(crow::Response& res, const std::string& arg1,
424b5c07418SJames Feist                            const std::string& arg2, const std::string& arg3)
425b5c07418SJames Feist {
426b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
427b5c07418SJames Feist     addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
428a08b46ccSJason M. Bills                      arg2);
429f4c4dcf4SKowalski, Kamil }
430f4c4dcf4SKowalski, Kamil 
431f4c4dcf4SKowalski, Kamil /**
432f4c4dcf4SKowalski, Kamil  * @internal
433f4c4dcf4SKowalski, Kamil  * @brief Formats AccountForSessionNoLongerExists message into JSON
434f4c4dcf4SKowalski, Kamil  *
435f4c4dcf4SKowalski, Kamil  * See header file for more information
436f4c4dcf4SKowalski, Kamil  * @endinternal
437f4c4dcf4SKowalski, Kamil  */
438b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void)
4391abe55efSEd Tanous {
440b5c07418SJames Feist     return nlohmann::json{
441b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
442684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccountForSessionNoLongerExists"},
4431abe55efSEd Tanous         {"Message", "The account for the current session has been removed, "
44466ac2b8cSJason M. Bills                     "thus the current session has been removed as well."},
44585659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
446684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
447b5c07418SJames Feist         {"Resolution", "Attempt to connect with a valid account."}};
448b5c07418SJames Feist }
449b5c07418SJames Feist 
450b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res)
451b5c07418SJames Feist {
452b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
453b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
454f4c4dcf4SKowalski, Kamil }
455f4c4dcf4SKowalski, Kamil 
456f4c4dcf4SKowalski, Kamil /**
457f4c4dcf4SKowalski, Kamil  * @internal
458f4c4dcf4SKowalski, Kamil  * @brief Formats CreateFailedMissingReqProperties message into JSON
459f4c4dcf4SKowalski, Kamil  *
460f4c4dcf4SKowalski, Kamil  * See header file for more information
461f4c4dcf4SKowalski, Kamil  * @endinternal
462f4c4dcf4SKowalski, Kamil  */
463b5c07418SJames Feist nlohmann::json createFailedMissingReqProperties(const std::string& arg1)
4641abe55efSEd Tanous {
465b5c07418SJames Feist     return nlohmann::json{
466b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
467684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CreateFailedMissingReqProperties"},
4681abe55efSEd Tanous         {"Message",
469b5c07418SJames Feist          "The create operation failed because the required property " + arg1 +
470b5c07418SJames Feist              " was missing from the request."},
47185659adfSJason M. Bills         {"MessageArgs", {arg1}},
472684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
473f4c4dcf4SKowalski, Kamil         {"Resolution",
474f12894f8SJason M. Bills          "Correct the body to include the required property with a valid "
475b5c07418SJames Feist          "value and resubmit the request if the operation failed."}};
476b5c07418SJames Feist }
477b5c07418SJames Feist 
478b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res,
479b5c07418SJames Feist                                       const std::string& arg1)
480b5c07418SJames Feist {
481b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
482b5c07418SJames Feist     addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
483a08b46ccSJason M. Bills                      arg1);
484f12894f8SJason M. Bills }
485f12894f8SJason M. Bills 
486f12894f8SJason M. Bills /**
487f12894f8SJason M. Bills  * @internal
488f12894f8SJason M. Bills  * @brief Formats PropertyValueFormatError message into JSON for the specified
489f12894f8SJason M. Bills  * property
490f12894f8SJason M. Bills  *
491f12894f8SJason M. Bills  * See header file for more information
492f12894f8SJason M. Bills  * @endinternal
493f12894f8SJason M. Bills  */
494b5c07418SJames Feist nlohmann::json propertyValueFormatError(const std::string& arg1,
495a08b46ccSJason M. Bills                                         const std::string& arg2)
496f12894f8SJason M. Bills {
497b5c07418SJames Feist     return nlohmann::json{
498b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
499684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueFormatError"},
500f12894f8SJason M. Bills         {"Message",
501f12894f8SJason M. Bills          "The value " + arg1 + " for the property " + arg2 +
502f12894f8SJason M. Bills              " is of a different format than the property can accept."},
50385659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
504684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
50566ac2b8cSJason M. Bills         {"Resolution",
50666ac2b8cSJason M. Bills          "Correct the value for the property in the request body and "
507b5c07418SJames Feist          "resubmit the request if the operation failed."}};
508b5c07418SJames Feist }
509b5c07418SJames Feist 
510b5c07418SJames Feist void propertyValueFormatError(crow::Response& res, const std::string& arg1,
511b5c07418SJames Feist                               const std::string& arg2)
512b5c07418SJames Feist {
513b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
514b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2);
515f12894f8SJason M. Bills }
516f12894f8SJason M. Bills 
517f12894f8SJason M. Bills /**
518f12894f8SJason M. Bills  * @internal
519f12894f8SJason M. Bills  * @brief Formats PropertyValueNotInList message into JSON for the specified
520f12894f8SJason M. Bills  * property
521f12894f8SJason M. Bills  *
522f12894f8SJason M. Bills  * See header file for more information
523f12894f8SJason M. Bills  * @endinternal
524f12894f8SJason M. Bills  */
525b5c07418SJames Feist nlohmann::json propertyValueNotInList(const std::string& arg1,
526a08b46ccSJason M. Bills                                       const std::string& arg2)
527f12894f8SJason M. Bills {
528b5c07418SJames Feist     return nlohmann::json{
529b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
530684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueNotInList"},
531f12894f8SJason M. Bills         {"Message", "The value " + arg1 + " for the property " + arg2 +
532f12894f8SJason M. Bills                         " is not in the list of acceptable values."},
53385659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
534684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
535b5c07418SJames Feist         {"Resolution", "Choose a value from the enumeration list that "
536b5c07418SJames Feist                        "the implementation "
537b5c07418SJames Feist                        "can support and resubmit the request if the "
538b5c07418SJames Feist                        "operation failed."}};
539b5c07418SJames Feist }
540b5c07418SJames Feist 
541b5c07418SJames Feist void propertyValueNotInList(crow::Response& res, const std::string& arg1,
542b5c07418SJames Feist                             const std::string& arg2)
543b5c07418SJames Feist {
544b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
545b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2);
546f4c4dcf4SKowalski, Kamil }
547f4c4dcf4SKowalski, Kamil 
548f4c4dcf4SKowalski, Kamil /**
549f4c4dcf4SKowalski, Kamil  * @internal
550f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
551f4c4dcf4SKowalski, Kamil  *
552f4c4dcf4SKowalski, Kamil  * See header file for more information
553f4c4dcf4SKowalski, Kamil  * @endinternal
554f4c4dcf4SKowalski, Kamil  */
555b5c07418SJames Feist nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1)
5561abe55efSEd Tanous {
557b5c07418SJames Feist     return nlohmann::json{
558b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
559684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceAtUriInUnknownFormat"},
560f4c4dcf4SKowalski, Kamil         {"Message", "The resource at " + arg1 +
561f4c4dcf4SKowalski, Kamil                         " is in a format not recognized by the service."},
56285659adfSJason M. Bills         {"MessageArgs", {arg1}},
563684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
564f12894f8SJason M. Bills         {"Resolution", "Place an image or resource or file that is "
565b5c07418SJames Feist                        "recognized by the service at the URI."}};
566b5c07418SJames Feist }
567b5c07418SJames Feist 
568b5c07418SJames Feist void resourceAtUriInUnknownFormat(crow::Response& res, const std::string& arg1)
569b5c07418SJames Feist {
570b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
571b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
572f4c4dcf4SKowalski, Kamil }
573f4c4dcf4SKowalski, Kamil 
574f4c4dcf4SKowalski, Kamil /**
575f4c4dcf4SKowalski, Kamil  * @internal
576f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceInUnknownState message into JSON
577f4c4dcf4SKowalski, Kamil  *
578f4c4dcf4SKowalski, Kamil  * See header file for more information
579f4c4dcf4SKowalski, Kamil  * @endinternal
580f4c4dcf4SKowalski, Kamil  */
581b5c07418SJames Feist nlohmann::json serviceInUnknownState(void)
5821abe55efSEd Tanous {
583b5c07418SJames Feist     return nlohmann::json{
584b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
585684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceInUnknownState"},
58666ac2b8cSJason M. Bills         {"Message",
58766ac2b8cSJason M. Bills          "The operation failed because the service is in an unknown state "
58866ac2b8cSJason M. Bills          "and can no longer take incoming requests."},
58985659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
590684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
59166ac2b8cSJason M. Bills         {"Resolution", "Restart the service and resubmit the request if "
592b5c07418SJames Feist                        "the operation failed."}};
593b5c07418SJames Feist }
594b5c07418SJames Feist 
595b5c07418SJames Feist void serviceInUnknownState(crow::Response& res)
596b5c07418SJames Feist {
597b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
598b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
599f4c4dcf4SKowalski, Kamil }
600f4c4dcf4SKowalski, Kamil 
601f4c4dcf4SKowalski, Kamil /**
602f4c4dcf4SKowalski, Kamil  * @internal
603f4c4dcf4SKowalski, Kamil  * @brief Formats EventSubscriptionLimitExceeded message into JSON
604f4c4dcf4SKowalski, Kamil  *
605f4c4dcf4SKowalski, Kamil  * See header file for more information
606f4c4dcf4SKowalski, Kamil  * @endinternal
607f4c4dcf4SKowalski, Kamil  */
608b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void)
6091abe55efSEd Tanous {
610b5c07418SJames Feist     return nlohmann::json{
611b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
612684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.EventSubscriptionLimitExceeded"},
613f4c4dcf4SKowalski, Kamil         {"Message",
614f4c4dcf4SKowalski, Kamil          "The event subscription failed due to the number of simultaneous "
615f4c4dcf4SKowalski, Kamil          "subscriptions exceeding the limit of the implementation."},
61685659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
617684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
618f4c4dcf4SKowalski, Kamil         {"Resolution",
619f12894f8SJason M. Bills          "Reduce the number of other subscriptions before trying to "
62066ac2b8cSJason M. Bills          "establish the event subscription or increase the limit of "
621b5c07418SJames Feist          "simultaneous subscriptions (if supported)."}};
622b5c07418SJames Feist }
623b5c07418SJames Feist 
624b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res)
625b5c07418SJames Feist {
626789fdab3SEd Tanous     res.result(boost::beast::http::status::service_unavailable);
627b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
628f4c4dcf4SKowalski, Kamil }
629f4c4dcf4SKowalski, Kamil 
630f4c4dcf4SKowalski, Kamil /**
631f4c4dcf4SKowalski, Kamil  * @internal
632f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterMissing message into JSON
633f4c4dcf4SKowalski, Kamil  *
634f4c4dcf4SKowalski, Kamil  * See header file for more information
635f4c4dcf4SKowalski, Kamil  * @endinternal
636f4c4dcf4SKowalski, Kamil  */
637b5c07418SJames Feist nlohmann::json actionParameterMissing(const std::string& arg1,
6381abe55efSEd Tanous                                       const std::string& arg2)
6391abe55efSEd Tanous {
640b5c07418SJames Feist     return nlohmann::json{
641b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
642684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterMissing"},
643b5c07418SJames Feist         {"Message", "The action " + arg1 + " requires the parameter " + arg2 +
644b5c07418SJames Feist                         " to be present in the request body."},
64585659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
646684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
647f12894f8SJason M. Bills         {"Resolution",
64866ac2b8cSJason M. Bills          "Supply the action with the required parameter in the request "
649b5c07418SJames Feist          "body when the request is resubmitted."}};
650b5c07418SJames Feist }
651b5c07418SJames Feist 
652b5c07418SJames Feist void actionParameterMissing(crow::Response& res, const std::string& arg1,
653b5c07418SJames Feist                             const std::string& arg2)
654b5c07418SJames Feist {
655b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
656b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2));
657f4c4dcf4SKowalski, Kamil }
658f4c4dcf4SKowalski, Kamil 
659f4c4dcf4SKowalski, Kamil /**
660f4c4dcf4SKowalski, Kamil  * @internal
661f4c4dcf4SKowalski, Kamil  * @brief Formats StringValueTooLong message into JSON
662f4c4dcf4SKowalski, Kamil  *
663f4c4dcf4SKowalski, Kamil  * See header file for more information
664f4c4dcf4SKowalski, Kamil  * @endinternal
665f4c4dcf4SKowalski, Kamil  */
666b5c07418SJames Feist nlohmann::json stringValueTooLong(const std::string& arg1, const int& arg2)
6671abe55efSEd Tanous {
668b5c07418SJames Feist     return nlohmann::json{
669b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
670684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.StringValueTooLong"},
671f4c4dcf4SKowalski, Kamil         {"Message", "The string " + arg1 + " exceeds the length limit " +
672f4c4dcf4SKowalski, Kamil                         std::to_string(arg2) + "."},
67385659adfSJason M. Bills         {"MessageArgs", {arg1, std::to_string(arg2)}},
674684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
675f4c4dcf4SKowalski, Kamil         {"Resolution",
676b5c07418SJames Feist          "Resubmit the request with an appropriate string length."}};
677b5c07418SJames Feist }
678b5c07418SJames Feist 
679b5c07418SJames Feist void stringValueTooLong(crow::Response& res, const std::string& arg1,
680b5c07418SJames Feist                         const int& arg2)
681b5c07418SJames Feist {
682b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
683b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2));
684f4c4dcf4SKowalski, Kamil }
685f4c4dcf4SKowalski, Kamil 
686f4c4dcf4SKowalski, Kamil /**
687f4c4dcf4SKowalski, Kamil  * @internal
688cc9139ecSJason M. Bills  * @brief Formats SessionTerminated message into JSON
689cc9139ecSJason M. Bills  *
690cc9139ecSJason M. Bills  * See header file for more information
691cc9139ecSJason M. Bills  * @endinternal
692cc9139ecSJason M. Bills  */
693b5c07418SJames Feist nlohmann::json sessionTerminated(void)
694cc9139ecSJason M. Bills {
695b5c07418SJames Feist     return nlohmann::json{
696b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
697684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SessionTerminated"},
698cc9139ecSJason M. Bills         {"Message", "The session was successfully terminated."},
69985659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
700684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
701b5c07418SJames Feist         {"Resolution", "No resolution is required."}};
702b5c07418SJames Feist }
703b5c07418SJames Feist 
704b5c07418SJames Feist void sessionTerminated(crow::Response& res)
705b5c07418SJames Feist {
706b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
707b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, sessionTerminated());
708cc9139ecSJason M. Bills }
709cc9139ecSJason M. Bills 
710cc9139ecSJason M. Bills /**
711cc9139ecSJason M. Bills  * @internal
712684bb4b8SJason M. Bills  * @brief Formats SubscriptionTerminated message into JSON
713684bb4b8SJason M. Bills  *
714684bb4b8SJason M. Bills  * See header file for more information
715684bb4b8SJason M. Bills  * @endinternal
716684bb4b8SJason M. Bills  */
717684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void)
718684bb4b8SJason M. Bills {
719684bb4b8SJason M. Bills     return nlohmann::json{
720684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
721684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SubscriptionTerminated"},
722684bb4b8SJason M. Bills         {"Message", "The event subscription has been terminated."},
723684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
724684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
725684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
726684bb4b8SJason M. Bills }
727684bb4b8SJason M. Bills 
728684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res)
729684bb4b8SJason M. Bills {
730684bb4b8SJason M. Bills     res.result(boost::beast::http::status::ok);
731684bb4b8SJason M. Bills     addMessageToJsonRoot(res.jsonValue, subscriptionTerminated());
732684bb4b8SJason M. Bills }
733684bb4b8SJason M. Bills 
734684bb4b8SJason M. Bills /**
735684bb4b8SJason M. Bills  * @internal
736cc9139ecSJason M. Bills  * @brief Formats ResourceTypeIncompatible message into JSON
737cc9139ecSJason M. Bills  *
738cc9139ecSJason M. Bills  * See header file for more information
739cc9139ecSJason M. Bills  * @endinternal
740cc9139ecSJason M. Bills  */
741b5c07418SJames Feist nlohmann::json resourceTypeIncompatible(const std::string& arg1,
742cc9139ecSJason M. Bills                                         const std::string& arg2)
743cc9139ecSJason M. Bills {
744b5c07418SJames Feist     return nlohmann::json{
745b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
746684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceTypeIncompatible"},
747cc9139ecSJason M. Bills         {"Message", "The @odata.type of the request body " + arg1 +
748cc9139ecSJason M. Bills                         " is incompatible with the @odata.type of the "
749cc9139ecSJason M. Bills                         "resource which is " +
750cc9139ecSJason M. Bills                         arg2 + "."},
75185659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
752684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
753cc9139ecSJason M. Bills         {"Resolution", "Resubmit the request with a payload compatible "
754b5c07418SJames Feist                        "with the resource's schema."}};
755b5c07418SJames Feist }
756b5c07418SJames Feist 
757b5c07418SJames Feist void resourceTypeIncompatible(crow::Response& res, const std::string& arg1,
758b5c07418SJames Feist                               const std::string& arg2)
759b5c07418SJames Feist {
760b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
761b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2));
762cc9139ecSJason M. Bills }
763cc9139ecSJason M. Bills 
764cc9139ecSJason M. Bills /**
765cc9139ecSJason M. Bills  * @internal
766684bb4b8SJason M. Bills  * @brief Formats ResetRequired message into JSON
767684bb4b8SJason M. Bills  *
768684bb4b8SJason M. Bills  * See header file for more information
769684bb4b8SJason M. Bills  * @endinternal
770684bb4b8SJason M. Bills  */
771684bb4b8SJason M. Bills nlohmann::json resetRequired(const std::string& arg1, const std::string& arg2)
772684bb4b8SJason M. Bills {
773684bb4b8SJason M. Bills     return nlohmann::json{
774684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
775684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResetRequired"},
776684bb4b8SJason M. Bills         {"Message", "In order to complete the operation, a component reset is "
777684bb4b8SJason M. Bills                     "required with the Reset action URI '" +
778684bb4b8SJason M. Bills                         arg1 + "' and ResetType '" + arg2 + "'."},
779684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
780684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
781684bb4b8SJason M. Bills         {"Resolution",
782684bb4b8SJason M. Bills          "Perform the required Reset action on the specified component."}};
783684bb4b8SJason M. Bills }
784684bb4b8SJason M. Bills 
785684bb4b8SJason M. Bills void resetRequired(crow::Response& res, const std::string& arg1,
786684bb4b8SJason M. Bills                    const std::string& arg2)
787684bb4b8SJason M. Bills {
788684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
789684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2));
790684bb4b8SJason M. Bills }
791684bb4b8SJason M. Bills 
792684bb4b8SJason M. Bills /**
793684bb4b8SJason M. Bills  * @internal
794684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOnRequired message into JSON
795684bb4b8SJason M. Bills  *
796684bb4b8SJason M. Bills  * See header file for more information
797684bb4b8SJason M. Bills  * @endinternal
798684bb4b8SJason M. Bills  */
799684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOnRequired(const std::string& arg1)
800684bb4b8SJason M. Bills {
801684bb4b8SJason M. Bills     return nlohmann::json{
802684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
803684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ChassisPowerStateOnRequired"},
804684bb4b8SJason M. Bills         {"Message", "The Chassis with Id '" + arg1 +
805684bb4b8SJason M. Bills                         "' requires to be powered on to perform this request."},
806684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
807684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
808684bb4b8SJason M. Bills         {"Resolution",
809684bb4b8SJason M. Bills          "Power on the specified Chassis and resubmit the request."}};
810684bb4b8SJason M. Bills }
811684bb4b8SJason M. Bills 
812684bb4b8SJason M. Bills void chassisPowerStateOnRequired(crow::Response& res, const std::string& arg1)
813684bb4b8SJason M. Bills {
814684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
815684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1));
816684bb4b8SJason M. Bills }
817684bb4b8SJason M. Bills 
818684bb4b8SJason M. Bills /**
819684bb4b8SJason M. Bills  * @internal
820684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOffRequired message into JSON
821684bb4b8SJason M. Bills  *
822684bb4b8SJason M. Bills  * See header file for more information
823684bb4b8SJason M. Bills  * @endinternal
824684bb4b8SJason M. Bills  */
825684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOffRequired(const std::string& arg1)
826684bb4b8SJason M. Bills {
827684bb4b8SJason M. Bills     return nlohmann::json{
828684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
829684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ChassisPowerStateOffRequired"},
830684bb4b8SJason M. Bills         {"Message",
831684bb4b8SJason M. Bills          "The Chassis with Id '" + arg1 +
832684bb4b8SJason M. Bills              "' requires to be powered off to perform this request."},
833684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
834684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
835684bb4b8SJason M. Bills         {"Resolution",
836684bb4b8SJason M. Bills          "Power off the specified Chassis and resubmit the request."}};
837684bb4b8SJason M. Bills }
838684bb4b8SJason M. Bills 
839684bb4b8SJason M. Bills void chassisPowerStateOffRequired(crow::Response& res, const std::string& arg1)
840684bb4b8SJason M. Bills {
841684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
842684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1));
843684bb4b8SJason M. Bills }
844684bb4b8SJason M. Bills 
845684bb4b8SJason M. Bills /**
846684bb4b8SJason M. Bills  * @internal
847684bb4b8SJason M. Bills  * @brief Formats PropertyValueConflict message into JSON
848684bb4b8SJason M. Bills  *
849684bb4b8SJason M. Bills  * See header file for more information
850684bb4b8SJason M. Bills  * @endinternal
851684bb4b8SJason M. Bills  */
852684bb4b8SJason M. Bills nlohmann::json propertyValueConflict(const std::string& arg1,
853684bb4b8SJason M. Bills                                      const std::string& arg2)
854684bb4b8SJason M. Bills {
855684bb4b8SJason M. Bills     return nlohmann::json{
856684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
857684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueConflict"},
858684bb4b8SJason M. Bills         {"Message", "The property '" + arg1 +
859684bb4b8SJason M. Bills                         "' could not be written because its value would "
860684bb4b8SJason M. Bills                         "conflict with the value of the '" +
861684bb4b8SJason M. Bills                         arg2 + "' property."},
862684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
863684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
864684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
865684bb4b8SJason M. Bills }
866684bb4b8SJason M. Bills 
867684bb4b8SJason M. Bills void propertyValueConflict(crow::Response& res, const std::string& arg1,
868684bb4b8SJason M. Bills                            const std::string& arg2)
869684bb4b8SJason M. Bills {
870684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
871684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2));
872684bb4b8SJason M. Bills }
873684bb4b8SJason M. Bills 
874684bb4b8SJason M. Bills /**
875684bb4b8SJason M. Bills  * @internal
876684bb4b8SJason M. Bills  * @brief Formats PropertyValueIncorrect message into JSON
877684bb4b8SJason M. Bills  *
878684bb4b8SJason M. Bills  * See header file for more information
879684bb4b8SJason M. Bills  * @endinternal
880684bb4b8SJason M. Bills  */
881684bb4b8SJason M. Bills nlohmann::json propertyValueIncorrect(const std::string& arg1,
882684bb4b8SJason M. Bills                                       const std::string& arg2)
883684bb4b8SJason M. Bills {
884684bb4b8SJason M. Bills     return nlohmann::json{
885684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
886684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueIncorrect"},
887684bb4b8SJason M. Bills         {"Message", "The property '" + arg1 +
888684bb4b8SJason M. Bills                         "' with the requested value of '" + arg2 +
889684bb4b8SJason M. Bills                         "' could not be written because the value does not "
890684bb4b8SJason M. Bills                         "meet the constraints of the implementation."},
891684bb4b8SJason M. Bills         {"MessageArgs", {arg1, arg2}},
892684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
893684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
894684bb4b8SJason M. Bills }
895684bb4b8SJason M. Bills 
896684bb4b8SJason M. Bills void propertyValueIncorrect(crow::Response& res, const std::string& arg1,
897684bb4b8SJason M. Bills                             const std::string& arg2)
898684bb4b8SJason M. Bills {
899684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
900684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));
901684bb4b8SJason M. Bills }
902684bb4b8SJason M. Bills 
903684bb4b8SJason M. Bills /**
904684bb4b8SJason M. Bills  * @internal
905684bb4b8SJason M. Bills  * @brief Formats ResourceCreationConflict message into JSON
906684bb4b8SJason M. Bills  *
907684bb4b8SJason M. Bills  * See header file for more information
908684bb4b8SJason M. Bills  * @endinternal
909684bb4b8SJason M. Bills  */
910684bb4b8SJason M. Bills nlohmann::json resourceCreationConflict(const std::string& arg1)
911684bb4b8SJason M. Bills {
912684bb4b8SJason M. Bills     return nlohmann::json{
913684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
914684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceCreationConflict"},
915684bb4b8SJason M. Bills         {"Message", "The resource could not be created.  The service has a "
916684bb4b8SJason M. Bills                     "resource at URI '" +
917684bb4b8SJason M. Bills                         arg1 + "' that conflicts with the creation request."},
918684bb4b8SJason M. Bills         {"MessageArgs", {arg1}},
919684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
920684bb4b8SJason M. Bills         {"Resolution", "No resolution is required."}};
921684bb4b8SJason M. Bills }
922684bb4b8SJason M. Bills 
923684bb4b8SJason M. Bills void resourceCreationConflict(crow::Response& res, const std::string& arg1)
924684bb4b8SJason M. Bills {
925684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
926684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1));
927684bb4b8SJason M. Bills }
928684bb4b8SJason M. Bills 
929684bb4b8SJason M. Bills /**
930684bb4b8SJason M. Bills  * @internal
931684bb4b8SJason M. Bills  * @brief Formats MaximumErrorsExceeded message into JSON
932684bb4b8SJason M. Bills  *
933684bb4b8SJason M. Bills  * See header file for more information
934684bb4b8SJason M. Bills  * @endinternal
935684bb4b8SJason M. Bills  */
936684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void)
937684bb4b8SJason M. Bills {
938684bb4b8SJason M. Bills     return nlohmann::json{
939684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
940684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.MaximumErrorsExceeded"},
941684bb4b8SJason M. Bills         {"Message", "Too many errors have occurred to report them all."},
942684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
943684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
944684bb4b8SJason M. Bills         {"Resolution",
945684bb4b8SJason M. Bills          "Resolve other reported errors and retry the current operation."}};
946684bb4b8SJason M. Bills }
947684bb4b8SJason M. Bills 
948684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res)
949684bb4b8SJason M. Bills {
950684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
951684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded());
952684bb4b8SJason M. Bills }
953684bb4b8SJason M. Bills 
954684bb4b8SJason M. Bills /**
955684bb4b8SJason M. Bills  * @internal
956684bb4b8SJason M. Bills  * @brief Formats PreconditionFailed message into JSON
957684bb4b8SJason M. Bills  *
958684bb4b8SJason M. Bills  * See header file for more information
959684bb4b8SJason M. Bills  * @endinternal
960684bb4b8SJason M. Bills  */
961684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void)
962684bb4b8SJason M. Bills {
963684bb4b8SJason M. Bills     return nlohmann::json{
964684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
965684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PreconditionFailed"},
966684bb4b8SJason M. Bills         {"Message", "The ETag supplied did not match the ETag required to "
967684bb4b8SJason M. Bills                     "change this resource."},
968684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
969684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
970684bb4b8SJason M. Bills         {"Resolution", "Try the operation again using the appropriate ETag."}};
971684bb4b8SJason M. Bills }
972684bb4b8SJason M. Bills 
973684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res)
974684bb4b8SJason M. Bills {
975684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
976684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionFailed());
977684bb4b8SJason M. Bills }
978684bb4b8SJason M. Bills 
979684bb4b8SJason M. Bills /**
980684bb4b8SJason M. Bills  * @internal
981684bb4b8SJason M. Bills  * @brief Formats PreconditionRequired message into JSON
982684bb4b8SJason M. Bills  *
983684bb4b8SJason M. Bills  * See header file for more information
984684bb4b8SJason M. Bills  * @endinternal
985684bb4b8SJason M. Bills  */
986684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void)
987684bb4b8SJason M. Bills {
988684bb4b8SJason M. Bills     return nlohmann::json{
989684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
990684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PreconditionRequired"},
991684bb4b8SJason M. Bills         {"Message", "A precondition header or annotation is required to change "
992684bb4b8SJason M. Bills                     "this resource."},
993684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
994684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
995684bb4b8SJason M. Bills         {"Resolution", "Try the operation again using an If-Match or "
996684bb4b8SJason M. Bills                        "If-None-Match header and appropriate ETag."}};
997684bb4b8SJason M. Bills }
998684bb4b8SJason M. Bills 
999684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res)
1000684bb4b8SJason M. Bills {
1001684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1002684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionRequired());
1003684bb4b8SJason M. Bills }
1004684bb4b8SJason M. Bills 
1005684bb4b8SJason M. Bills /**
1006684bb4b8SJason M. Bills  * @internal
1007684bb4b8SJason M. Bills  * @brief Formats OperationFailed message into JSON
1008684bb4b8SJason M. Bills  *
1009684bb4b8SJason M. Bills  * See header file for more information
1010684bb4b8SJason M. Bills  * @endinternal
1011684bb4b8SJason M. Bills  */
1012684bb4b8SJason M. Bills nlohmann::json operationFailed(void)
1013684bb4b8SJason M. Bills {
1014684bb4b8SJason M. Bills     return nlohmann::json{
1015684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1016684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.OperationFailed"},
1017684bb4b8SJason M. Bills         {"Message",
1018684bb4b8SJason M. Bills          "An error occurred internal to the service as part of the overall "
1019684bb4b8SJason M. Bills          "request.  Partial results may have been returned."},
1020684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1021684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1022684bb4b8SJason M. Bills         {"Resolution", "Resubmit the request.  If the problem persists, "
1023684bb4b8SJason M. Bills                        "consider resetting the service or provider."}};
1024684bb4b8SJason M. Bills }
1025684bb4b8SJason M. Bills 
1026684bb4b8SJason M. Bills void operationFailed(crow::Response& res)
1027684bb4b8SJason M. Bills {
1028684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
1029684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationFailed());
1030684bb4b8SJason M. Bills }
1031684bb4b8SJason M. Bills 
1032684bb4b8SJason M. Bills /**
1033684bb4b8SJason M. Bills  * @internal
1034684bb4b8SJason M. Bills  * @brief Formats OperationTimeout message into JSON
1035684bb4b8SJason M. Bills  *
1036684bb4b8SJason M. Bills  * See header file for more information
1037684bb4b8SJason M. Bills  * @endinternal
1038684bb4b8SJason M. Bills  */
1039684bb4b8SJason M. Bills nlohmann::json operationTimeout(void)
1040684bb4b8SJason M. Bills {
1041684bb4b8SJason M. Bills     return nlohmann::json{
1042684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1043684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.OperationTimeout"},
1044684bb4b8SJason M. Bills         {"Message", "A timeout internal to the service occured as part of the "
1045684bb4b8SJason M. Bills                     "request.  Partial results may have been returned."},
1046684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1047684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1048684bb4b8SJason M. Bills         {"Resolution", "Resubmit the request.  If the problem persists, "
1049684bb4b8SJason M. Bills                        "consider resetting the service or provider."}};
1050684bb4b8SJason M. Bills }
1051684bb4b8SJason M. Bills 
1052684bb4b8SJason M. Bills void operationTimeout(crow::Response& res)
1053684bb4b8SJason M. Bills {
1054684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
1055684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationTimeout());
1056684bb4b8SJason M. Bills }
1057684bb4b8SJason M. Bills 
1058684bb4b8SJason M. Bills /**
1059684bb4b8SJason M. Bills  * @internal
1060f12894f8SJason M. Bills  * @brief Formats PropertyValueTypeError message into JSON for the specified
1061f12894f8SJason M. Bills  * property
1062f12894f8SJason M. Bills  *
1063f12894f8SJason M. Bills  * See header file for more information
1064f12894f8SJason M. Bills  * @endinternal
1065f12894f8SJason M. Bills  */
1066b5c07418SJames Feist nlohmann::json propertyValueTypeError(const std::string& arg1,
1067a08b46ccSJason M. Bills                                       const std::string& arg2)
1068f12894f8SJason M. Bills {
1069b5c07418SJames Feist     return nlohmann::json{
1070b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1071684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueTypeError"},
1072f12894f8SJason M. Bills         {"Message",
1073f12894f8SJason M. Bills          "The value " + arg1 + " for the property " + arg2 +
1074f12894f8SJason M. Bills              " is of a different type than the property can accept."},
107585659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1076684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
107766ac2b8cSJason M. Bills         {"Resolution",
107866ac2b8cSJason M. Bills          "Correct the value for the property in the request body and "
1079b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1080b5c07418SJames Feist }
1081b5c07418SJames Feist 
1082b5c07418SJames Feist void propertyValueTypeError(crow::Response& res, const std::string& arg1,
1083b5c07418SJames Feist                             const std::string& arg2)
1084b5c07418SJames Feist {
1085b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1086b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
1087f4c4dcf4SKowalski, Kamil }
1088f4c4dcf4SKowalski, Kamil 
1089f4c4dcf4SKowalski, Kamil /**
1090f4c4dcf4SKowalski, Kamil  * @internal
1091f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceNotFound message into JSON
1092f4c4dcf4SKowalski, Kamil  *
1093f4c4dcf4SKowalski, Kamil  * See header file for more information
1094f4c4dcf4SKowalski, Kamil  * @endinternal
1095f4c4dcf4SKowalski, Kamil  */
1096b5c07418SJames Feist nlohmann::json resourceNotFound(const std::string& arg1,
10971abe55efSEd Tanous                                 const std::string& arg2)
10981abe55efSEd Tanous {
1099b5c07418SJames Feist     return nlohmann::json{
1100b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1101684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceNotFound"},
11021abe55efSEd Tanous         {"Message", "The requested resource of type " + arg1 + " named " +
11031abe55efSEd Tanous                         arg2 + " was not found."},
110485659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1105684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1106f4c4dcf4SKowalski, Kamil         {"Resolution",
1107b5c07418SJames Feist          "Provide a valid resource identifier and resubmit the request."}};
1108b5c07418SJames Feist }
1109b5c07418SJames Feist 
1110b5c07418SJames Feist void resourceNotFound(crow::Response& res, const std::string& arg1,
1111b5c07418SJames Feist                       const std::string& arg2)
1112b5c07418SJames Feist {
1113b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1114b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
1115f4c4dcf4SKowalski, Kamil }
1116f4c4dcf4SKowalski, Kamil 
1117f4c4dcf4SKowalski, Kamil /**
1118f4c4dcf4SKowalski, Kamil  * @internal
1119f4c4dcf4SKowalski, Kamil  * @brief Formats CouldNotEstablishConnection message into JSON
1120f4c4dcf4SKowalski, Kamil  *
1121f4c4dcf4SKowalski, Kamil  * See header file for more information
1122f4c4dcf4SKowalski, Kamil  * @endinternal
1123f4c4dcf4SKowalski, Kamil  */
1124b5c07418SJames Feist nlohmann::json couldNotEstablishConnection(const std::string& arg1)
11251abe55efSEd Tanous {
1126b5c07418SJames Feist     return nlohmann::json{
1127b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1128684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CouldNotEstablishConnection"},
11291abe55efSEd Tanous         {"Message",
1130684bb4b8SJason M. Bills          "The service failed to establish a connection with the URI " + arg1 +
1131b5c07418SJames Feist              "."},
113285659adfSJason M. Bills         {"MessageArgs", {arg1}},
1133684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
113466ac2b8cSJason M. Bills         {"Resolution",
113566ac2b8cSJason M. Bills          "Ensure that the URI contains a valid and reachable node name, "
1136b5c07418SJames Feist          "protocol information and other URI components."}};
1137b5c07418SJames Feist }
1138b5c07418SJames Feist 
1139b5c07418SJames Feist void couldNotEstablishConnection(crow::Response& res, const std::string& arg1)
1140b5c07418SJames Feist {
1141b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1142b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
1143f4c4dcf4SKowalski, Kamil }
1144f4c4dcf4SKowalski, Kamil 
1145f4c4dcf4SKowalski, Kamil /**
1146f4c4dcf4SKowalski, Kamil  * @internal
1147f12894f8SJason M. Bills  * @brief Formats PropertyNotWritable message into JSON for the specified
1148f12894f8SJason M. Bills  * property
1149f12894f8SJason M. Bills  *
1150f12894f8SJason M. Bills  * See header file for more information
1151f12894f8SJason M. Bills  * @endinternal
1152f12894f8SJason M. Bills  */
1153b5c07418SJames Feist nlohmann::json propertyNotWritable(const std::string& arg1)
1154f12894f8SJason M. Bills {
1155b5c07418SJames Feist     return nlohmann::json{
1156b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1157684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyNotWritable"},
1158b5c07418SJames Feist         {"Message", "The property " + arg1 +
1159b5c07418SJames Feist                         " is a read only property and cannot be "
1160b5c07418SJames Feist                         "assigned a value."},
116185659adfSJason M. Bills         {"MessageArgs", {arg1}},
1162684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
116366ac2b8cSJason M. Bills         {"Resolution", "Remove the property from the request body and "
1164b5c07418SJames Feist                        "resubmit the request if the operation failed."}};
1165b5c07418SJames Feist }
1166b5c07418SJames Feist 
1167b5c07418SJames Feist void propertyNotWritable(crow::Response& res, const std::string& arg1)
1168b5c07418SJames Feist {
1169b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1170b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
1171f4c4dcf4SKowalski, Kamil }
1172f4c4dcf4SKowalski, Kamil 
1173f4c4dcf4SKowalski, Kamil /**
1174f4c4dcf4SKowalski, Kamil  * @internal
1175f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueTypeError message into JSON
1176f4c4dcf4SKowalski, Kamil  *
1177f4c4dcf4SKowalski, Kamil  * See header file for more information
1178f4c4dcf4SKowalski, Kamil  * @endinternal
1179f4c4dcf4SKowalski, Kamil  */
1180b5c07418SJames Feist nlohmann::json queryParameterValueTypeError(const std::string& arg1,
11811abe55efSEd Tanous                                             const std::string& arg2)
11821abe55efSEd Tanous {
1183b5c07418SJames Feist     return nlohmann::json{
1184b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1185684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterValueTypeError"},
11861abe55efSEd Tanous         {"Message",
11871abe55efSEd Tanous          "The value " + arg1 + " for the query parameter " + arg2 +
1188f4c4dcf4SKowalski, Kamil              " is of a different type than the parameter can accept."},
118985659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1190684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
119166ac2b8cSJason M. Bills         {"Resolution",
119266ac2b8cSJason M. Bills          "Correct the value for the query parameter in the request and "
1193b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1194b5c07418SJames Feist }
1195b5c07418SJames Feist 
1196b5c07418SJames Feist void queryParameterValueTypeError(crow::Response& res, const std::string& arg1,
1197b5c07418SJames Feist                                   const std::string& arg2)
1198b5c07418SJames Feist {
1199b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1200b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1201b5c07418SJames Feist                           queryParameterValueTypeError(arg1, arg2));
1202f4c4dcf4SKowalski, Kamil }
1203f4c4dcf4SKowalski, Kamil 
1204f4c4dcf4SKowalski, Kamil /**
1205f4c4dcf4SKowalski, Kamil  * @internal
1206f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceShuttingDown message into JSON
1207f4c4dcf4SKowalski, Kamil  *
1208f4c4dcf4SKowalski, Kamil  * See header file for more information
1209f4c4dcf4SKowalski, Kamil  * @endinternal
1210f4c4dcf4SKowalski, Kamil  */
1211b5c07418SJames Feist nlohmann::json serviceShuttingDown(void)
12121abe55efSEd Tanous {
1213b5c07418SJames Feist     return nlohmann::json{
1214b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1215684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ServiceShuttingDown"},
1216f12894f8SJason M. Bills         {"Message", "The operation failed because the service is shutting "
121766ac2b8cSJason M. Bills                     "down and can no longer take incoming requests."},
121885659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1219684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
122066ac2b8cSJason M. Bills         {"Resolution", "When the service becomes available, resubmit the "
1221b5c07418SJames Feist                        "request if the operation failed."}};
1222b5c07418SJames Feist }
1223b5c07418SJames Feist 
1224b5c07418SJames Feist void serviceShuttingDown(crow::Response& res)
1225b5c07418SJames Feist {
1226b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1227b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
1228f4c4dcf4SKowalski, Kamil }
1229f4c4dcf4SKowalski, Kamil 
1230f4c4dcf4SKowalski, Kamil /**
1231f4c4dcf4SKowalski, Kamil  * @internal
1232f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterDuplicate message into JSON
1233f4c4dcf4SKowalski, Kamil  *
1234f4c4dcf4SKowalski, Kamil  * See header file for more information
1235f4c4dcf4SKowalski, Kamil  * @endinternal
1236f4c4dcf4SKowalski, Kamil  */
1237b5c07418SJames Feist nlohmann::json actionParameterDuplicate(const std::string& arg1,
12381abe55efSEd Tanous                                         const std::string& arg2)
12391abe55efSEd Tanous {
1240b5c07418SJames Feist     return nlohmann::json{
1241b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1242684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterDuplicate"},
1243f4c4dcf4SKowalski, Kamil         {"Message",
1244f4c4dcf4SKowalski, Kamil          "The action " + arg1 +
12451abe55efSEd Tanous              " was submitted with more than one value for the parameter " +
12461abe55efSEd Tanous              arg2 + "."},
124785659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1248684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
124966ac2b8cSJason M. Bills         {"Resolution",
125066ac2b8cSJason M. Bills          "Resubmit the action with only one instance of the parameter in "
1251b5c07418SJames Feist          "the request body if the operation failed."}};
1252b5c07418SJames Feist }
1253b5c07418SJames Feist 
1254b5c07418SJames Feist void actionParameterDuplicate(crow::Response& res, const std::string& arg1,
1255b5c07418SJames Feist                               const std::string& arg2)
1256b5c07418SJames Feist {
1257b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1258b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
1259f4c4dcf4SKowalski, Kamil }
1260f4c4dcf4SKowalski, Kamil 
1261f4c4dcf4SKowalski, Kamil /**
1262f4c4dcf4SKowalski, Kamil  * @internal
1263f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterNotSupported message into JSON
1264f4c4dcf4SKowalski, Kamil  *
1265f4c4dcf4SKowalski, Kamil  * See header file for more information
1266f4c4dcf4SKowalski, Kamil  * @endinternal
1267f4c4dcf4SKowalski, Kamil  */
1268b5c07418SJames Feist nlohmann::json actionParameterNotSupported(const std::string& arg1,
12691abe55efSEd Tanous                                            const std::string& arg2)
12701abe55efSEd Tanous {
1271b5c07418SJames Feist     return nlohmann::json{
1272b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1273684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterNotSupported"},
1274f4c4dcf4SKowalski, Kamil         {"Message", "The parameter " + arg1 + " for the action " + arg2 +
1275f4c4dcf4SKowalski, Kamil                         " is not supported on the target resource."},
127685659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1277684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
127866ac2b8cSJason M. Bills         {"Resolution", "Remove the parameter supplied and resubmit the "
1279b5c07418SJames Feist                        "request if the operation failed."}};
1280b5c07418SJames Feist }
1281b5c07418SJames Feist 
1282b5c07418SJames Feist void actionParameterNotSupported(crow::Response& res, const std::string& arg1,
1283b5c07418SJames Feist                                  const std::string& arg2)
1284b5c07418SJames Feist {
1285b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1286b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1287b5c07418SJames Feist                           actionParameterNotSupported(arg1, arg2));
1288f4c4dcf4SKowalski, Kamil }
1289f4c4dcf4SKowalski, Kamil 
1290f4c4dcf4SKowalski, Kamil /**
1291f4c4dcf4SKowalski, Kamil  * @internal
1292f4c4dcf4SKowalski, Kamil  * @brief Formats SourceDoesNotSupportProtocol message into JSON
1293f4c4dcf4SKowalski, Kamil  *
1294f4c4dcf4SKowalski, Kamil  * See header file for more information
1295f4c4dcf4SKowalski, Kamil  * @endinternal
1296f4c4dcf4SKowalski, Kamil  */
1297b5c07418SJames Feist nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1,
12981abe55efSEd Tanous                                             const std::string& arg2)
12991abe55efSEd Tanous {
1300b5c07418SJames Feist     return nlohmann::json{
1301b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1302684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SourceDoesNotSupportProtocol"},
1303684bb4b8SJason M. Bills         {"Message", "The other end of the connection at " + arg1 +
13041abe55efSEd Tanous                         " does not support the specified protocol " + arg2 +
13051abe55efSEd Tanous                         "."},
130685659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1307684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1308b5c07418SJames Feist         {"Resolution", "Change protocols or URIs. "}};
1309b5c07418SJames Feist }
1310b5c07418SJames Feist 
1311b5c07418SJames Feist void sourceDoesNotSupportProtocol(crow::Response& res, const std::string& arg1,
1312b5c07418SJames Feist                                   const std::string& arg2)
1313b5c07418SJames Feist {
1314b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1315b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1316b5c07418SJames Feist                           sourceDoesNotSupportProtocol(arg1, arg2));
1317f4c4dcf4SKowalski, Kamil }
1318f4c4dcf4SKowalski, Kamil 
1319f4c4dcf4SKowalski, Kamil /**
1320f4c4dcf4SKowalski, Kamil  * @internal
1321f4c4dcf4SKowalski, Kamil  * @brief Formats AccountRemoved message into JSON
1322f4c4dcf4SKowalski, Kamil  *
1323f4c4dcf4SKowalski, Kamil  * See header file for more information
1324f4c4dcf4SKowalski, Kamil  * @endinternal
1325f4c4dcf4SKowalski, Kamil  */
1326b5c07418SJames Feist nlohmann::json accountRemoved(void)
13271abe55efSEd Tanous {
1328b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1329684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.AccountRemoved"},
1330f4c4dcf4SKowalski, Kamil                           {"Message", "The account was successfully removed."},
133185659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1332684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
1333b5c07418SJames Feist                           {"Resolution", "No resolution is required."}};
1334b5c07418SJames Feist }
1335b5c07418SJames Feist 
1336b5c07418SJames Feist void accountRemoved(crow::Response& res)
1337b5c07418SJames Feist {
1338b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1339b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, accountRemoved());
1340f4c4dcf4SKowalski, Kamil }
1341f4c4dcf4SKowalski, Kamil 
1342f4c4dcf4SKowalski, Kamil /**
1343f4c4dcf4SKowalski, Kamil  * @internal
1344f4c4dcf4SKowalski, Kamil  * @brief Formats AccessDenied message into JSON
1345f4c4dcf4SKowalski, Kamil  *
1346f4c4dcf4SKowalski, Kamil  * See header file for more information
1347f4c4dcf4SKowalski, Kamil  * @endinternal
1348f4c4dcf4SKowalski, Kamil  */
1349b5c07418SJames Feist nlohmann::json accessDenied(const std::string& arg1)
13501abe55efSEd Tanous {
1351b5c07418SJames Feist     return nlohmann::json{
1352b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1353684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccessDenied"},
1354684bb4b8SJason M. Bills         {"Message", "While attempting to establish a connection to " + arg1 +
1355b5c07418SJames Feist                         ", the service denied access."},
135685659adfSJason M. Bills         {"MessageArgs", {arg1}},
1357684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
135866ac2b8cSJason M. Bills         {"Resolution", "Attempt to ensure that the URI is correct and that "
1359b5c07418SJames Feist                        "the service has the appropriate credentials."}};
1360b5c07418SJames Feist }
1361b5c07418SJames Feist 
1362b5c07418SJames Feist void accessDenied(crow::Response& res, const std::string& arg1)
1363b5c07418SJames Feist {
1364b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1365b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
1366f4c4dcf4SKowalski, Kamil }
1367f4c4dcf4SKowalski, Kamil 
1368f4c4dcf4SKowalski, Kamil /**
1369f4c4dcf4SKowalski, Kamil  * @internal
1370f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupported message into JSON
1371f4c4dcf4SKowalski, Kamil  *
1372f4c4dcf4SKowalski, Kamil  * See header file for more information
1373f4c4dcf4SKowalski, Kamil  * @endinternal
1374f4c4dcf4SKowalski, Kamil  */
1375b5c07418SJames Feist nlohmann::json queryNotSupported(void)
13761abe55efSEd Tanous {
1377b5c07418SJames Feist     return nlohmann::json{
1378b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1379684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupported"},
1380f4c4dcf4SKowalski, Kamil         {"Message", "Querying is not supported by the implementation."},
138185659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1382684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
138366ac2b8cSJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the "
1384b5c07418SJames Feist                        "request if the operation failed."}};
1385b5c07418SJames Feist }
1386b5c07418SJames Feist 
1387b5c07418SJames Feist void queryNotSupported(crow::Response& res)
1388b5c07418SJames Feist {
1389b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1390b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupported());
1391f4c4dcf4SKowalski, Kamil }
1392f4c4dcf4SKowalski, Kamil 
1393f4c4dcf4SKowalski, Kamil /**
1394f4c4dcf4SKowalski, Kamil  * @internal
1395f4c4dcf4SKowalski, Kamil  * @brief Formats CreateLimitReachedForResource message into JSON
1396f4c4dcf4SKowalski, Kamil  *
1397f4c4dcf4SKowalski, Kamil  * See header file for more information
1398f4c4dcf4SKowalski, Kamil  * @endinternal
1399f4c4dcf4SKowalski, Kamil  */
1400b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void)
14011abe55efSEd Tanous {
1402b5c07418SJames Feist     return nlohmann::json{
1403b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1404684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.CreateLimitReachedForResource"},
14051abe55efSEd Tanous         {"Message", "The create operation failed because the resource has "
140666ac2b8cSJason M. Bills                     "reached the limit of possible resources."},
140785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1408684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
140966ac2b8cSJason M. Bills         {"Resolution",
141066ac2b8cSJason M. Bills          "Either delete resources and resubmit the request if the "
1411b5c07418SJames Feist          "operation failed or do not resubmit the request."}};
1412b5c07418SJames Feist }
1413b5c07418SJames Feist 
1414b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res)
1415b5c07418SJames Feist {
1416b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1417b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
1418f4c4dcf4SKowalski, Kamil }
1419f4c4dcf4SKowalski, Kamil 
1420f4c4dcf4SKowalski, Kamil /**
1421f4c4dcf4SKowalski, Kamil  * @internal
1422f4c4dcf4SKowalski, Kamil  * @brief Formats GeneralError message into JSON
1423f4c4dcf4SKowalski, Kamil  *
1424f4c4dcf4SKowalski, Kamil  * See header file for more information
1425f4c4dcf4SKowalski, Kamil  * @endinternal
1426f4c4dcf4SKowalski, Kamil  */
1427b5c07418SJames Feist nlohmann::json generalError(void)
14281abe55efSEd Tanous {
1429b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1430684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.GeneralError"},
1431b7e069efSJames Feist                           {"Message",
1432b7e069efSJames Feist                            "A general error has occurred. See Resolution for "
1433cc9139ecSJason M. Bills                            "information on how to resolve the error."},
143485659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1435684bb4b8SJason M. Bills                           {"MessageSeverity", "Critical"},
1436b5c07418SJames Feist                           {"Resolution", "None."}};
1437b5c07418SJames Feist }
1438b5c07418SJames Feist 
1439b5c07418SJames Feist void generalError(crow::Response& res)
1440b5c07418SJames Feist {
1441b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
1442b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, generalError());
1443f4c4dcf4SKowalski, Kamil }
1444f4c4dcf4SKowalski, Kamil 
1445f4c4dcf4SKowalski, Kamil /**
1446f4c4dcf4SKowalski, Kamil  * @internal
1447f4c4dcf4SKowalski, Kamil  * @brief Formats Success message into JSON
1448f4c4dcf4SKowalski, Kamil  *
1449f4c4dcf4SKowalski, Kamil  * See header file for more information
1450f4c4dcf4SKowalski, Kamil  * @endinternal
1451f4c4dcf4SKowalski, Kamil  */
1452b5c07418SJames Feist nlohmann::json success(void)
14531abe55efSEd Tanous {
1454b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
1455684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.Success"},
1456f4c4dcf4SKowalski, Kamil                           {"Message", "Successfully Completed Request"},
145785659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
1458684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
1459b5c07418SJames Feist                           {"Resolution", "None"}};
1460b5c07418SJames Feist }
1461b5c07418SJames Feist 
1462b5c07418SJames Feist void success(crow::Response& res)
1463b5c07418SJames Feist {
1464b5c07418SJames Feist     // don't set res.result here because success is the default and any
1465b5c07418SJames Feist     // error should overwrite the default
1466b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, success());
1467f12894f8SJason M. Bills }
1468f12894f8SJason M. Bills 
1469f12894f8SJason M. Bills /**
1470f12894f8SJason M. Bills  * @internal
1471f4c4dcf4SKowalski, Kamil  * @brief Formats Created message into JSON
1472f4c4dcf4SKowalski, Kamil  *
1473f4c4dcf4SKowalski, Kamil  * See header file for more information
1474f4c4dcf4SKowalski, Kamil  * @endinternal
1475f4c4dcf4SKowalski, Kamil  */
1476b5c07418SJames Feist nlohmann::json created(void)
14771abe55efSEd Tanous {
1478b5c07418SJames Feist     return nlohmann::json{
1479b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1480684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.Created"},
1481f4c4dcf4SKowalski, Kamil         {"Message", "The resource has been created successfully"},
148285659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1483684bb4b8SJason M. Bills         {"MessageSeverity", "OK"},
1484b5c07418SJames Feist         {"Resolution", "None"}};
1485b5c07418SJames Feist }
1486b5c07418SJames Feist 
1487b5c07418SJames Feist void created(crow::Response& res)
1488b5c07418SJames Feist {
1489b5c07418SJames Feist     res.result(boost::beast::http::status::created);
1490b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, created());
1491f4c4dcf4SKowalski, Kamil }
1492f4c4dcf4SKowalski, Kamil 
1493f4c4dcf4SKowalski, Kamil /**
1494f4c4dcf4SKowalski, Kamil  * @internal
1495cc9139ecSJason M. Bills  * @brief Formats NoOperation message into JSON
1496cc9139ecSJason M. Bills  *
1497cc9139ecSJason M. Bills  * See header file for more information
1498cc9139ecSJason M. Bills  * @endinternal
1499cc9139ecSJason M. Bills  */
1500b5c07418SJames Feist nlohmann::json noOperation(void)
1501cc9139ecSJason M. Bills {
1502b5c07418SJames Feist     return nlohmann::json{
1503b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1504684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.NoOperation"},
1505cc9139ecSJason M. Bills         {"Message", "The request body submitted contain no data to act "
1506cc9139ecSJason M. Bills                     "upon and no changes to the resource took place."},
150785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1508684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1509cc9139ecSJason M. Bills         {"Resolution",
1510b5c07418SJames Feist          "Add properties in the JSON object and resubmit the request."}};
1511b5c07418SJames Feist }
1512b5c07418SJames Feist 
1513b5c07418SJames Feist void noOperation(crow::Response& res)
1514b5c07418SJames Feist {
1515b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1516b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noOperation());
1517cc9139ecSJason M. Bills }
1518cc9139ecSJason M. Bills 
1519cc9139ecSJason M. Bills /**
1520cc9139ecSJason M. Bills  * @internal
1521b5c07418SJames Feist  * @brief Formats PropertyUnknown message into JSON for the specified
1522b5c07418SJames Feist  * property
1523f12894f8SJason M. Bills  *
1524f12894f8SJason M. Bills  * See header file for more information
1525f12894f8SJason M. Bills  * @endinternal
1526f12894f8SJason M. Bills  */
1527b5c07418SJames Feist nlohmann::json propertyUnknown(const std::string& arg1)
1528b5c07418SJames Feist {
1529b5c07418SJames Feist     return nlohmann::json{
1530b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1531684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyUnknown"},
1532b5c07418SJames Feist         {"Message", "The property " + arg1 +
1533b5c07418SJames Feist                         " is not in the list of valid properties for "
1534b5c07418SJames Feist                         "the resource."},
1535b5c07418SJames Feist         {"MessageArgs", {arg1}},
1536684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1537b5c07418SJames Feist         {"Resolution", "Remove the unknown property from the request "
1538b5c07418SJames Feist                        "body and resubmit "
1539b5c07418SJames Feist                        "the request if the operation failed."}};
1540b5c07418SJames Feist }
1541b5c07418SJames Feist 
1542a08b46ccSJason M. Bills void propertyUnknown(crow::Response& res, const std::string& arg1)
1543f12894f8SJason M. Bills {
1544f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1545b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1);
1546f4c4dcf4SKowalski, Kamil }
1547f4c4dcf4SKowalski, Kamil 
1548f4c4dcf4SKowalski, Kamil /**
1549f4c4dcf4SKowalski, Kamil  * @internal
1550f4c4dcf4SKowalski, Kamil  * @brief Formats NoValidSession message into JSON
1551f4c4dcf4SKowalski, Kamil  *
1552f4c4dcf4SKowalski, Kamil  * See header file for more information
1553f4c4dcf4SKowalski, Kamil  * @endinternal
1554f4c4dcf4SKowalski, Kamil  */
1555b5c07418SJames Feist nlohmann::json noValidSession(void)
15561abe55efSEd Tanous {
1557b5c07418SJames Feist     return nlohmann::json{
1558b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1559684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.NoValidSession"},
1560f4c4dcf4SKowalski, Kamil         {"Message",
1561f4c4dcf4SKowalski, Kamil          "There is no valid session established with the implementation."},
156285659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1563684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
15641abe55efSEd Tanous         {"Resolution",
1565684bb4b8SJason M. Bills          "Establish a session before attempting any operations."}};
1566b5c07418SJames Feist }
1567b5c07418SJames Feist 
1568b5c07418SJames Feist void noValidSession(crow::Response& res)
1569b5c07418SJames Feist {
1570b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1571b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noValidSession());
1572f4c4dcf4SKowalski, Kamil }
1573f4c4dcf4SKowalski, Kamil 
1574f4c4dcf4SKowalski, Kamil /**
1575f4c4dcf4SKowalski, Kamil  * @internal
1576f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidObject message into JSON
1577f4c4dcf4SKowalski, Kamil  *
1578f4c4dcf4SKowalski, Kamil  * See header file for more information
1579f4c4dcf4SKowalski, Kamil  * @endinternal
1580f4c4dcf4SKowalski, Kamil  */
1581b5c07418SJames Feist nlohmann::json invalidObject(const std::string& arg1)
15821abe55efSEd Tanous {
1583b5c07418SJames Feist     return nlohmann::json{
1584b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1585684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InvalidObject"},
1586f4c4dcf4SKowalski, Kamil         {"Message", "The object at " + arg1 + " is invalid."},
158785659adfSJason M. Bills         {"MessageArgs", {arg1}},
1588684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1589f12894f8SJason M. Bills         {"Resolution",
159066ac2b8cSJason M. Bills          "Either the object is malformed or the URI is not correct.  "
1591b5c07418SJames Feist          "Correct the condition and resubmit the request if it failed."}};
1592b5c07418SJames Feist }
1593b5c07418SJames Feist 
1594b5c07418SJames Feist void invalidObject(crow::Response& res, const std::string& arg1)
1595b5c07418SJames Feist {
1596b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1597b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
1598f4c4dcf4SKowalski, Kamil }
1599f4c4dcf4SKowalski, Kamil 
1600f4c4dcf4SKowalski, Kamil /**
1601f4c4dcf4SKowalski, Kamil  * @internal
1602f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInStandby message into JSON
1603f4c4dcf4SKowalski, Kamil  *
1604f4c4dcf4SKowalski, Kamil  * See header file for more information
1605f4c4dcf4SKowalski, Kamil  * @endinternal
1606f4c4dcf4SKowalski, Kamil  */
1607b5c07418SJames Feist nlohmann::json resourceInStandby(void)
16081abe55efSEd Tanous {
1609b5c07418SJames Feist     return nlohmann::json{
1610b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1611684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceInStandby"},
161266ac2b8cSJason M. Bills         {"Message", "The request could not be performed because the "
161366ac2b8cSJason M. Bills                     "resource is in standby."},
161485659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1615684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1616f12894f8SJason M. Bills         {"Resolution", "Ensure that the resource is in the correct power "
1617b5c07418SJames Feist                        "state and resubmit the request."}};
1618b5c07418SJames Feist }
1619b5c07418SJames Feist 
1620b5c07418SJames Feist void resourceInStandby(crow::Response& res)
1621b5c07418SJames Feist {
1622b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1623b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInStandby());
1624f4c4dcf4SKowalski, Kamil }
1625f4c4dcf4SKowalski, Kamil 
1626f4c4dcf4SKowalski, Kamil /**
1627f4c4dcf4SKowalski, Kamil  * @internal
1628f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueTypeError message into JSON
1629f4c4dcf4SKowalski, Kamil  *
1630f4c4dcf4SKowalski, Kamil  * See header file for more information
1631f4c4dcf4SKowalski, Kamil  * @endinternal
1632f4c4dcf4SKowalski, Kamil  */
1633b5c07418SJames Feist nlohmann::json actionParameterValueTypeError(const std::string& arg1,
1634f4c4dcf4SKowalski, Kamil                                              const std::string& arg2,
16351abe55efSEd Tanous                                              const std::string& arg3)
16361abe55efSEd Tanous {
1637b5c07418SJames Feist     return nlohmann::json{
1638b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1639684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionParameterValueTypeError"},
16401abe55efSEd Tanous         {"Message",
16411abe55efSEd Tanous          "The value " + arg1 + " for the parameter " + arg2 +
1642f4c4dcf4SKowalski, Kamil              " in the action " + arg3 +
1643f4c4dcf4SKowalski, Kamil              " is of a different type than the parameter can accept."},
164485659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
1645684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
164666ac2b8cSJason M. Bills         {"Resolution",
164766ac2b8cSJason M. Bills          "Correct the value for the parameter in the request body and "
1648b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1649b5c07418SJames Feist }
1650b5c07418SJames Feist 
1651b5c07418SJames Feist void actionParameterValueTypeError(crow::Response& res, const std::string& arg1,
1652b5c07418SJames Feist                                    const std::string& arg2,
1653b5c07418SJames Feist                                    const std::string& arg3)
1654b5c07418SJames Feist {
1655b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1656b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1657b5c07418SJames Feist                           actionParameterValueTypeError(arg1, arg2, arg3));
1658f4c4dcf4SKowalski, Kamil }
1659f4c4dcf4SKowalski, Kamil 
1660f4c4dcf4SKowalski, Kamil /**
1661f4c4dcf4SKowalski, Kamil  * @internal
1662f4c4dcf4SKowalski, Kamil  * @brief Formats SessionLimitExceeded message into JSON
1663f4c4dcf4SKowalski, Kamil  *
1664f4c4dcf4SKowalski, Kamil  * See header file for more information
1665f4c4dcf4SKowalski, Kamil  * @endinternal
1666f4c4dcf4SKowalski, Kamil  */
1667b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void)
16681abe55efSEd Tanous {
1669b5c07418SJames Feist     return nlohmann::json{
1670b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1671684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.SessionLimitExceeded"},
1672f12894f8SJason M. Bills         {"Message", "The session establishment failed due to the number of "
167366ac2b8cSJason M. Bills                     "simultaneous sessions exceeding the limit of the "
167466ac2b8cSJason M. Bills                     "implementation."},
167585659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1676684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
167766ac2b8cSJason M. Bills         {"Resolution", "Reduce the number of other sessions before trying "
167866ac2b8cSJason M. Bills                        "to establish the session or increase the limit of "
1679b5c07418SJames Feist                        "simultaneous sessions (if supported)."}};
1680b5c07418SJames Feist }
1681b5c07418SJames Feist 
1682b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res)
1683b5c07418SJames Feist {
1684b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1685b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
1686f4c4dcf4SKowalski, Kamil }
1687f4c4dcf4SKowalski, Kamil 
1688f4c4dcf4SKowalski, Kamil /**
1689f4c4dcf4SKowalski, Kamil  * @internal
1690f4c4dcf4SKowalski, Kamil  * @brief Formats ActionNotSupported message into JSON
1691f4c4dcf4SKowalski, Kamil  *
1692f4c4dcf4SKowalski, Kamil  * See header file for more information
1693f4c4dcf4SKowalski, Kamil  * @endinternal
1694f4c4dcf4SKowalski, Kamil  */
1695b5c07418SJames Feist nlohmann::json actionNotSupported(const std::string& arg1)
16961abe55efSEd Tanous {
1697b5c07418SJames Feist     return nlohmann::json{
1698b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1699684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ActionNotSupported"},
17001abe55efSEd Tanous         {"Message",
17011abe55efSEd Tanous          "The action " + arg1 + " is not supported by the resource."},
170285659adfSJason M. Bills         {"MessageArgs", {arg1}},
1703684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1704f4c4dcf4SKowalski, Kamil         {"Resolution",
1705f4c4dcf4SKowalski, Kamil          "The action supplied cannot be resubmitted to the implementation. "
1706f12894f8SJason M. Bills          " Perhaps the action was invalid, the wrong resource was the "
170766ac2b8cSJason M. Bills          "target or the implementation documentation may be of "
1708b5c07418SJames Feist          "assistance."}};
1709b5c07418SJames Feist }
1710b5c07418SJames Feist 
1711b5c07418SJames Feist void actionNotSupported(crow::Response& res, const std::string& arg1)
1712b5c07418SJames Feist {
1713b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1714b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
1715f4c4dcf4SKowalski, Kamil }
1716f4c4dcf4SKowalski, Kamil 
1717f4c4dcf4SKowalski, Kamil /**
1718f4c4dcf4SKowalski, Kamil  * @internal
1719f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidIndex message into JSON
1720f4c4dcf4SKowalski, Kamil  *
1721f4c4dcf4SKowalski, Kamil  * See header file for more information
1722f4c4dcf4SKowalski, Kamil  * @endinternal
1723f4c4dcf4SKowalski, Kamil  */
1724b5c07418SJames Feist nlohmann::json invalidIndex(const int& arg1)
17251abe55efSEd Tanous {
1726b5c07418SJames Feist     return nlohmann::json{
1727b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1728684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InvalidIndex"},
1729684bb4b8SJason M. Bills         {"Message", "The Index " + std::to_string(arg1) +
1730f4c4dcf4SKowalski, Kamil                         " is not a valid offset into the array."},
173185659adfSJason M. Bills         {"MessageArgs", {std::to_string(arg1)}},
1732684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1733f12894f8SJason M. Bills         {"Resolution", "Verify the index value provided is within the "
1734b5c07418SJames Feist                        "bounds of the array."}};
1735b5c07418SJames Feist }
1736b5c07418SJames Feist 
1737b5c07418SJames Feist void invalidIndex(crow::Response& res, const int& arg1)
1738b5c07418SJames Feist {
1739b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1740b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
1741f4c4dcf4SKowalski, Kamil }
1742f4c4dcf4SKowalski, Kamil 
1743f4c4dcf4SKowalski, Kamil /**
1744f4c4dcf4SKowalski, Kamil  * @internal
1745f4c4dcf4SKowalski, Kamil  * @brief Formats EmptyJSON message into JSON
1746f4c4dcf4SKowalski, Kamil  *
1747f4c4dcf4SKowalski, Kamil  * See header file for more information
1748f4c4dcf4SKowalski, Kamil  * @endinternal
1749f4c4dcf4SKowalski, Kamil  */
1750b5c07418SJames Feist nlohmann::json emptyJSON(void)
17511abe55efSEd Tanous {
1752b5c07418SJames Feist     return nlohmann::json{
1753b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1754684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.EmptyJSON"},
1755f12894f8SJason M. Bills         {"Message", "The request body submitted contained an empty JSON "
175666ac2b8cSJason M. Bills                     "object and the service is unable to process it."},
175785659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1758684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1759f4c4dcf4SKowalski, Kamil         {"Resolution",
1760b5c07418SJames Feist          "Add properties in the JSON object and resubmit the request."}};
1761b5c07418SJames Feist }
1762b5c07418SJames Feist 
1763b5c07418SJames Feist void emptyJSON(crow::Response& res)
1764b5c07418SJames Feist {
1765b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1766b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, emptyJSON());
1767f4c4dcf4SKowalski, Kamil }
1768f4c4dcf4SKowalski, Kamil 
1769f4c4dcf4SKowalski, Kamil /**
1770f4c4dcf4SKowalski, Kamil  * @internal
1771f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupportedOnResource message into JSON
1772f4c4dcf4SKowalski, Kamil  *
1773f4c4dcf4SKowalski, Kamil  * See header file for more information
1774f4c4dcf4SKowalski, Kamil  * @endinternal
1775f4c4dcf4SKowalski, Kamil  */
1776b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void)
17771abe55efSEd Tanous {
1778b5c07418SJames Feist     return nlohmann::json{
1779b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1780684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupportedOnResource"},
1781f4c4dcf4SKowalski, Kamil         {"Message", "Querying is not supported on the requested resource."},
178285659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1783684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
178466ac2b8cSJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the "
1785b5c07418SJames Feist                        "request if the operation failed."}};
1786b5c07418SJames Feist }
1787b5c07418SJames Feist 
1788b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res)
1789b5c07418SJames Feist {
1790b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1791b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
1792f4c4dcf4SKowalski, Kamil }
1793f4c4dcf4SKowalski, Kamil 
1794f4c4dcf4SKowalski, Kamil /**
1795f4c4dcf4SKowalski, Kamil  * @internal
1796684bb4b8SJason M. Bills  * @brief Formats QueryNotSupportedOnOperation message into JSON
1797684bb4b8SJason M. Bills  *
1798684bb4b8SJason M. Bills  * See header file for more information
1799684bb4b8SJason M. Bills  * @endinternal
1800684bb4b8SJason M. Bills  */
1801684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void)
1802684bb4b8SJason M. Bills {
1803684bb4b8SJason M. Bills     return nlohmann::json{
1804684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1805684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryNotSupportedOnOperation"},
1806684bb4b8SJason M. Bills         {"Message", "Querying is not supported with the requested operation."},
1807684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1808684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1809684bb4b8SJason M. Bills         {"Resolution", "Remove the query parameters and resubmit the request "
1810684bb4b8SJason M. Bills                        "if the operation failed."}};
1811684bb4b8SJason M. Bills }
1812684bb4b8SJason M. Bills 
1813684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res)
1814684bb4b8SJason M. Bills {
1815684bb4b8SJason M. Bills     res.result(boost::beast::http::status::forbidden);
1816684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
1817684bb4b8SJason M. Bills }
1818684bb4b8SJason M. Bills 
1819684bb4b8SJason M. Bills /**
1820684bb4b8SJason M. Bills  * @internal
1821684bb4b8SJason M. Bills  * @brief Formats QueryCombinationInvalid message into JSON
1822684bb4b8SJason M. Bills  *
1823684bb4b8SJason M. Bills  * See header file for more information
1824684bb4b8SJason M. Bills  * @endinternal
1825684bb4b8SJason M. Bills  */
1826684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void)
1827684bb4b8SJason M. Bills {
1828684bb4b8SJason M. Bills     return nlohmann::json{
1829684bb4b8SJason M. Bills         {"@odata.type", "#Message.v1_0_0.Message"},
1830684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryCombinationInvalid"},
1831684bb4b8SJason M. Bills         {"Message", "Two or more query parameters in the request cannot be "
1832684bb4b8SJason M. Bills                     "used together."},
1833684bb4b8SJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1834684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1835684bb4b8SJason M. Bills         {"Resolution", "Remove one or more of the query parameters and "
1836684bb4b8SJason M. Bills                        "resubmit the request if the operation failed."}};
1837684bb4b8SJason M. Bills }
1838684bb4b8SJason M. Bills 
1839684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res)
1840684bb4b8SJason M. Bills {
1841684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1842684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
1843684bb4b8SJason M. Bills }
1844684bb4b8SJason M. Bills 
1845684bb4b8SJason M. Bills /**
1846684bb4b8SJason M. Bills  * @internal
1847f4c4dcf4SKowalski, Kamil  * @brief Formats InsufficientPrivilege message into JSON
1848f4c4dcf4SKowalski, Kamil  *
1849f4c4dcf4SKowalski, Kamil  * See header file for more information
1850f4c4dcf4SKowalski, Kamil  * @endinternal
1851f4c4dcf4SKowalski, Kamil  */
1852b5c07418SJames Feist nlohmann::json insufficientPrivilege(void)
18531abe55efSEd Tanous {
1854b5c07418SJames Feist     return nlohmann::json{
1855b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1856684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.InsufficientPrivilege"},
185766ac2b8cSJason M. Bills         {"Message", "There are insufficient privileges for the account or "
185866ac2b8cSJason M. Bills                     "credentials associated with the current session to "
185966ac2b8cSJason M. Bills                     "perform the requested operation."},
186085659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1861684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
1862f4c4dcf4SKowalski, Kamil         {"Resolution",
1863f12894f8SJason M. Bills          "Either abandon the operation or change the associated access "
1864b5c07418SJames Feist          "rights and resubmit the request if the operation failed."}};
1865b5c07418SJames Feist }
1866b5c07418SJames Feist 
1867b5c07418SJames Feist void insufficientPrivilege(crow::Response& res)
1868b5c07418SJames Feist {
1869b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1870b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
1871f4c4dcf4SKowalski, Kamil }
1872f4c4dcf4SKowalski, Kamil 
1873f4c4dcf4SKowalski, Kamil /**
1874f4c4dcf4SKowalski, Kamil  * @internal
1875f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyValueModified message into JSON
1876f4c4dcf4SKowalski, Kamil  *
1877f4c4dcf4SKowalski, Kamil  * See header file for more information
1878f4c4dcf4SKowalski, Kamil  * @endinternal
1879f4c4dcf4SKowalski, Kamil  */
1880b5c07418SJames Feist nlohmann::json propertyValueModified(const std::string& arg1,
1881b5c07418SJames Feist                                      const std::string& arg2)
1882b5c07418SJames Feist {
1883b5c07418SJames Feist     return nlohmann::json{
1884b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1885684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyValueModified"},
1886b5c07418SJames Feist         {"Message", "The property " + arg1 + " was assigned the value " + arg2 +
1887b5c07418SJames Feist                         " due to modification by the service."},
1888b5c07418SJames Feist         {"MessageArgs", {arg1, arg2}},
1889684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1890b5c07418SJames Feist         {"Resolution", "No resolution is required."}};
1891b5c07418SJames Feist }
1892b5c07418SJames Feist 
1893f12894f8SJason M. Bills void propertyValueModified(crow::Response& res, const std::string& arg1,
1894a08b46ccSJason M. Bills                            const std::string& arg2)
18951abe55efSEd Tanous {
1896f12894f8SJason M. Bills     res.result(boost::beast::http::status::ok);
1897b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
1898f4c4dcf4SKowalski, Kamil }
1899f4c4dcf4SKowalski, Kamil 
1900f4c4dcf4SKowalski, Kamil /**
1901f4c4dcf4SKowalski, Kamil  * @internal
1902f4c4dcf4SKowalski, Kamil  * @brief Formats AccountNotModified message into JSON
1903f4c4dcf4SKowalski, Kamil  *
1904f4c4dcf4SKowalski, Kamil  * See header file for more information
1905f4c4dcf4SKowalski, Kamil  * @endinternal
1906f4c4dcf4SKowalski, Kamil  */
1907b5c07418SJames Feist nlohmann::json accountNotModified(void)
19081abe55efSEd Tanous {
1909b5c07418SJames Feist     return nlohmann::json{
1910b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1911684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.AccountNotModified"},
1912f4c4dcf4SKowalski, Kamil         {"Message", "The account modification request failed."},
191385659adfSJason M. Bills         {"MessageArgs", nlohmann::json::array()},
1914684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1915f12894f8SJason M. Bills         {"Resolution", "The modification may have failed due to permission "
1916b5c07418SJames Feist                        "issues or issues with the request body."}};
1917b5c07418SJames Feist }
1918b5c07418SJames Feist 
1919b5c07418SJames Feist void accountNotModified(crow::Response& res)
1920b5c07418SJames Feist {
1921b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1922b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountNotModified());
1923f4c4dcf4SKowalski, Kamil }
1924f4c4dcf4SKowalski, Kamil 
1925f4c4dcf4SKowalski, Kamil /**
1926f4c4dcf4SKowalski, Kamil  * @internal
1927f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueFormatError message into JSON
1928f4c4dcf4SKowalski, Kamil  *
1929f4c4dcf4SKowalski, Kamil  * See header file for more information
1930f4c4dcf4SKowalski, Kamil  * @endinternal
1931f4c4dcf4SKowalski, Kamil  */
1932b5c07418SJames Feist nlohmann::json queryParameterValueFormatError(const std::string& arg1,
19331abe55efSEd Tanous                                               const std::string& arg2)
19341abe55efSEd Tanous {
1935b5c07418SJames Feist     return nlohmann::json{
1936b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1937684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterValueFormatError"},
1938f4c4dcf4SKowalski, Kamil         {"Message",
1939f4c4dcf4SKowalski, Kamil          "The value " + arg1 + " for the parameter " + arg2 +
1940f4c4dcf4SKowalski, Kamil              " is of a different format than the parameter can accept."},
194185659adfSJason M. Bills         {"MessageArgs", {arg1, arg2}},
1942684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
194366ac2b8cSJason M. Bills         {"Resolution",
194466ac2b8cSJason M. Bills          "Correct the value for the query parameter in the request and "
1945b5c07418SJames Feist          "resubmit the request if the operation failed."}};
1946b5c07418SJames Feist }
1947b5c07418SJames Feist 
1948b5c07418SJames Feist void queryParameterValueFormatError(crow::Response& res,
1949b5c07418SJames Feist                                     const std::string& arg1,
1950b5c07418SJames Feist                                     const std::string& arg2)
1951b5c07418SJames Feist {
1952b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1953b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1954b5c07418SJames Feist                           queryParameterValueFormatError(arg1, arg2));
1955f4c4dcf4SKowalski, Kamil }
1956f4c4dcf4SKowalski, Kamil 
1957f4c4dcf4SKowalski, Kamil /**
1958f4c4dcf4SKowalski, Kamil  * @internal
1959b5c07418SJames Feist  * @brief Formats PropertyMissing message into JSON for the specified
1960b5c07418SJames Feist  * property
1961f12894f8SJason M. Bills  *
1962f12894f8SJason M. Bills  * See header file for more information
1963f12894f8SJason M. Bills  * @endinternal
1964f12894f8SJason M. Bills  */
1965b5c07418SJames Feist nlohmann::json propertyMissing(const std::string& arg1)
1966f12894f8SJason M. Bills {
1967b5c07418SJames Feist     return nlohmann::json{
1968b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1969684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.PropertyMissing"},
1970f12894f8SJason M. Bills         {"Message", "The property " + arg1 +
1971f12894f8SJason M. Bills                         " is a required property and must be included in "
1972f12894f8SJason M. Bills                         "the request."},
197385659adfSJason M. Bills         {"MessageArgs", {arg1}},
1974684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
1975f12894f8SJason M. Bills         {"Resolution",
1976b5c07418SJames Feist          "Ensure that the property is in the request body and has a "
1977b5c07418SJames Feist          "valid "
1978b5c07418SJames Feist          "value and resubmit the request if the operation failed."}};
1979b5c07418SJames Feist }
1980b5c07418SJames Feist 
1981b5c07418SJames Feist void propertyMissing(crow::Response& res, const std::string& arg1)
1982b5c07418SJames Feist {
1983b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1984b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
1985f4c4dcf4SKowalski, Kamil }
1986f4c4dcf4SKowalski, Kamil 
1987f4c4dcf4SKowalski, Kamil /**
1988f4c4dcf4SKowalski, Kamil  * @internal
1989f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceExhaustion message into JSON
1990f4c4dcf4SKowalski, Kamil  *
1991f4c4dcf4SKowalski, Kamil  * See header file for more information
1992f4c4dcf4SKowalski, Kamil  * @endinternal
1993f4c4dcf4SKowalski, Kamil  */
1994b5c07418SJames Feist nlohmann::json resourceExhaustion(const std::string& arg1)
19951abe55efSEd Tanous {
1996b5c07418SJames Feist     return nlohmann::json{
1997b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
1998684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.ResourceExhaustion"},
1999d425c6f6SEd Tanous         {"Message", "The resource " + arg1 +
200066ac2b8cSJason M. Bills                         " was unable to satisfy the request due to "
200166ac2b8cSJason M. Bills                         "unavailability of resources."},
200285659adfSJason M. Bills         {"MessageArgs", {arg1}},
2003684bb4b8SJason M. Bills         {"MessageSeverity", "Critical"},
2004f12894f8SJason M. Bills         {"Resolution", "Ensure that the resources are available and "
2005b5c07418SJames Feist                        "resubmit the request."}};
2006b5c07418SJames Feist }
2007b5c07418SJames Feist 
2008b5c07418SJames Feist void resourceExhaustion(crow::Response& res, const std::string& arg1)
2009b5c07418SJames Feist {
2010b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
2011b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
2012f4c4dcf4SKowalski, Kamil }
2013f4c4dcf4SKowalski, Kamil 
2014f4c4dcf4SKowalski, Kamil /**
2015f4c4dcf4SKowalski, Kamil  * @internal
2016f4c4dcf4SKowalski, Kamil  * @brief Formats AccountModified message into JSON
2017f4c4dcf4SKowalski, Kamil  *
2018f4c4dcf4SKowalski, Kamil  * See header file for more information
2019f4c4dcf4SKowalski, Kamil  * @endinternal
2020f4c4dcf4SKowalski, Kamil  */
2021b5c07418SJames Feist nlohmann::json accountModified(void)
20221abe55efSEd Tanous {
2023b7e069efSJames Feist     return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
2024684bb4b8SJason M. Bills                           {"MessageId", "Base.1.8.1.AccountModified"},
2025f4c4dcf4SKowalski, Kamil                           {"Message", "The account was successfully modified."},
202685659adfSJason M. Bills                           {"MessageArgs", nlohmann::json::array()},
2027684bb4b8SJason M. Bills                           {"MessageSeverity", "OK"},
2028b5c07418SJames Feist                           {"Resolution", "No resolution is required."}};
2029b5c07418SJames Feist }
2030b5c07418SJames Feist 
2031b5c07418SJames Feist void accountModified(crow::Response& res)
2032b5c07418SJames Feist {
2033b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
2034b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountModified());
2035f4c4dcf4SKowalski, Kamil }
2036f4c4dcf4SKowalski, Kamil 
2037f4c4dcf4SKowalski, Kamil /**
2038f4c4dcf4SKowalski, Kamil  * @internal
2039f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterOutOfRange message into JSON
2040f4c4dcf4SKowalski, Kamil  *
2041f4c4dcf4SKowalski, Kamil  * See header file for more information
2042f4c4dcf4SKowalski, Kamil  * @endinternal
2043f4c4dcf4SKowalski, Kamil  */
2044b5c07418SJames Feist nlohmann::json queryParameterOutOfRange(const std::string& arg1,
2045b5c07418SJames Feist                                         const std::string& arg2,
2046b5c07418SJames Feist                                         const std::string& arg3)
20471abe55efSEd Tanous {
2048b5c07418SJames Feist     return nlohmann::json{
2049b7e069efSJames Feist         {"@odata.type", "#Message.v1_0_0.Message"},
2050684bb4b8SJason M. Bills         {"MessageId", "Base.1.8.1.QueryParameterOutOfRange"},
2051b5c07418SJames Feist         {"Message", "The value " + arg1 + " for the query parameter " + arg2 +
2052b5c07418SJames Feist                         " is out of range " + arg3 + "."},
205385659adfSJason M. Bills         {"MessageArgs", {arg1, arg2, arg3}},
2054684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
2055f4c4dcf4SKowalski, Kamil         {"Resolution",
2056f12894f8SJason M. Bills          "Reduce the value for the query parameter to a value that is "
205766ac2b8cSJason M. Bills          "within range, such as a start or count value that is within "
205866ac2b8cSJason M. Bills          "bounds of the number of resources in a collection or a page that "
2059b5c07418SJames Feist          "is within the range of valid pages."}};
2060b5c07418SJames Feist }
2061b5c07418SJames Feist 
2062b5c07418SJames Feist void queryParameterOutOfRange(crow::Response& res, const std::string& arg1,
2063b5c07418SJames Feist                               const std::string& arg2, const std::string& arg3)
2064b5c07418SJames Feist {
2065b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
2066b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
2067b5c07418SJames Feist                           queryParameterOutOfRange(arg1, arg2, arg3));
2068f4c4dcf4SKowalski, Kamil }
2069f4c4dcf4SKowalski, Kamil 
20703bf4e632SJoseph Reynolds /**
20713bf4e632SJoseph Reynolds  * @internal
20723bf4e632SJoseph Reynolds  * @brief Formats PasswordChangeRequired message into JSON
20733bf4e632SJoseph Reynolds  *
20743bf4e632SJoseph Reynolds  * See header file for more information
20753bf4e632SJoseph Reynolds  * @endinternal
20763bf4e632SJoseph Reynolds  */
20773bf4e632SJoseph Reynolds void passwordChangeRequired(crow::Response& res, const std::string& arg1)
20783bf4e632SJoseph Reynolds {
20793bf4e632SJoseph Reynolds     messages::addMessageToJsonRoot(
20803bf4e632SJoseph Reynolds         res.jsonValue,
20813bf4e632SJoseph Reynolds         nlohmann::json{
20823bf4e632SJoseph Reynolds             {"@odata.type", "/redfish/v1/$metadata#Message.v1_5_0.Message"},
2083684bb4b8SJason M. Bills             {"MessageId", "Base.1.8.1.PasswordChangeRequired"},
20843bf4e632SJoseph Reynolds             {"Message", "The password provided for this account must be "
20853bf4e632SJoseph Reynolds                         "changed before access is granted.  PATCH the "
20863bf4e632SJoseph Reynolds                         "'Password' property for this account located at "
20873bf4e632SJoseph Reynolds                         "the target URI '" +
20883bf4e632SJoseph Reynolds                             arg1 + "' to complete this process."},
20893bf4e632SJoseph Reynolds             {"MessageArgs", {arg1}},
2090684bb4b8SJason M. Bills             {"MessageSeverity", "Critical"},
20913bf4e632SJoseph Reynolds             {"Resolution", "Change the password for this account using "
20923bf4e632SJoseph Reynolds                            "a PATCH to the 'Password' property at the URI "
20933bf4e632SJoseph Reynolds                            "provided."}});
20943bf4e632SJoseph Reynolds }
20953bf4e632SJoseph Reynolds 
20964cde5d90SJames Feist void invalidUpload(crow::Response& res, const std::string& arg1,
20974cde5d90SJames Feist                    const std::string& arg2)
20984cde5d90SJames Feist {
20994cde5d90SJames Feist     res.result(boost::beast::http::status::bad_request);
21004cde5d90SJames Feist     addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2));
21014cde5d90SJames Feist }
21024cde5d90SJames Feist 
21034cde5d90SJames Feist /**
21044cde5d90SJames Feist  * @internal
21054cde5d90SJames Feist  * @brief Formats Invalid File message into JSON
21064cde5d90SJames Feist  *
21074cde5d90SJames Feist  * See header file for more information
21084cde5d90SJames Feist  * @endinternal
21094cde5d90SJames Feist  */
21104cde5d90SJames Feist nlohmann::json invalidUpload(const std::string& arg1, const std::string& arg2)
21114cde5d90SJames Feist {
21124cde5d90SJames Feist     return nlohmann::json{
21134cde5d90SJames Feist         {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
21144cde5d90SJames Feist         {"MessageId", "OpenBMC.0.1.0.InvalidUpload"},
21154cde5d90SJames Feist         {"Message", "Invalid file uploaded to " + arg1 + ": " + arg2 + "."},
21164cde5d90SJames Feist         {"MessageArgs", {arg1, arg2}},
2117684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
21184cde5d90SJames Feist         {"Resolution", "None."}};
21194cde5d90SJames Feist }
21204cde5d90SJames Feist 
2121dd28ba82SAppaRao Puli /**
2122dd28ba82SAppaRao Puli  * @internal
2123dd28ba82SAppaRao Puli  * @brief Formats MutualExclusiveProperties into JSON
2124dd28ba82SAppaRao Puli  *
2125dd28ba82SAppaRao Puli  * See header file for more information
2126dd28ba82SAppaRao Puli  * @endinternal
2127dd28ba82SAppaRao Puli  */
2128dd28ba82SAppaRao Puli nlohmann::json mutualExclusiveProperties(const std::string& arg1,
2129dd28ba82SAppaRao Puli                                          const std::string& arg2)
2130dd28ba82SAppaRao Puli {
2131dd28ba82SAppaRao Puli     return nlohmann::json{
2132dd28ba82SAppaRao Puli         {"@odata.type", "#Message.v1_0_0.Message"},
2133dd28ba82SAppaRao Puli         {"MessageId", "Base.1.5.0.MutualExclusiveProperties"},
2134dd28ba82SAppaRao Puli         {"Message", "The properties " + arg1 + " and " + arg2 +
2135dd28ba82SAppaRao Puli                         " are mutually exclusive."},
2136dd28ba82SAppaRao Puli         {"MessageArgs", {arg1, arg2}},
2137684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
2138dd28ba82SAppaRao Puli         {"Resolution",
2139dd28ba82SAppaRao Puli          "Ensure that the request body doesn't contain mutually exclusive "
2140dd28ba82SAppaRao Puli          "properties and resubmit the request."}};
2141dd28ba82SAppaRao Puli }
2142dd28ba82SAppaRao Puli 
2143dd28ba82SAppaRao Puli void mutualExclusiveProperties(crow::Response& res, const std::string& arg1,
2144dd28ba82SAppaRao Puli                                const std::string& arg2)
2145dd28ba82SAppaRao Puli {
2146dd28ba82SAppaRao Puli     res.result(boost::beast::http::status::bad_request);
2147dd28ba82SAppaRao Puli     addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2));
2148dd28ba82SAppaRao Puli }
2149dd28ba82SAppaRao Puli 
2150f4c4dcf4SKowalski, Kamil } // namespace messages
2151f4c4dcf4SKowalski, Kamil 
2152d425c6f6SEd Tanous } // namespace redfish
2153