xref: /openbmc/bmcweb/features/redfish/src/error_messages.cpp (revision 65e4f1f7f44677ebaa0373f153084b97ba1a1194)
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 */
169ea15c35SEd Tanous #include "http_response.hpp"
17b6cd31e1SEd Tanous #include "registries/base_message_registry.hpp"
189ea15c35SEd Tanous 
199ea15c35SEd Tanous #include <boost/beast/http/status.hpp>
20ace85d60SEd Tanous #include <boost/url/url.hpp>
211abe55efSEd Tanous #include <error_messages.hpp>
2204e438cbSEd Tanous #include <logging.hpp>
239ea15c35SEd Tanous #include <nlohmann/json.hpp>
24f4c4dcf4SKowalski, Kamil 
251668ce6dSEd Tanous #include <array>
261668ce6dSEd Tanous 
271abe55efSEd Tanous namespace redfish
281abe55efSEd Tanous {
291abe55efSEd Tanous 
301abe55efSEd Tanous namespace messages
311abe55efSEd Tanous {
32f4c4dcf4SKowalski, Kamil 
33f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target,
341abe55efSEd Tanous                                   const nlohmann::json& message)
351abe55efSEd Tanous {
36f4c4dcf4SKowalski, Kamil     auto& error = target["error"];
37f4c4dcf4SKowalski, Kamil 
381abe55efSEd Tanous     // If this is the first error message, fill in the information from the
391abe55efSEd Tanous     // first error message to the top level struct
401abe55efSEd Tanous     if (!error.is_object())
411abe55efSEd Tanous     {
42c074230bSJason M. Bills         auto messageIdIterator = message.find("MessageId");
43c074230bSJason M. Bills         if (messageIdIterator == message.end())
441abe55efSEd Tanous         {
451abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
461abe55efSEd Tanous                 << "Attempt to add error message without MessageId";
47f4c4dcf4SKowalski, Kamil             return;
48f4c4dcf4SKowalski, Kamil         }
49f4c4dcf4SKowalski, Kamil 
50c074230bSJason M. Bills         auto messageFieldIterator = message.find("Message");
51c074230bSJason M. Bills         if (messageFieldIterator == message.end())
521abe55efSEd Tanous         {
531abe55efSEd Tanous             BMCWEB_LOG_CRITICAL
541abe55efSEd Tanous                 << "Attempt to add error message without Message";
55f4c4dcf4SKowalski, Kamil             return;
56f4c4dcf4SKowalski, Kamil         }
571476687dSEd Tanous         error["code"] = *messageIdIterator;
581476687dSEd Tanous         error["message"] = *messageFieldIterator;
591abe55efSEd Tanous     }
601abe55efSEd Tanous     else
611abe55efSEd Tanous     {
62f4c4dcf4SKowalski, Kamil         // More than 1 error occurred, so the message has to be generic
6355c7b7a2SEd Tanous         error["code"] = std::string(messageVersionPrefix) + "GeneralError";
64cc9139ecSJason M. Bills         error["message"] = "A general error has occurred. See Resolution for "
65cc9139ecSJason M. Bills                            "information on how to resolve the error.";
66f4c4dcf4SKowalski, Kamil     }
67f4c4dcf4SKowalski, Kamil 
68f4c4dcf4SKowalski, Kamil     // This check could technically be done in in the default construction
69f4c4dcf4SKowalski, Kamil     // branch above, but because we need the pointer to the extended info field
70f4c4dcf4SKowalski, Kamil     // anyway, it's more efficient to do it here.
71c074230bSJason M. Bills     auto& extendedInfo = error[messages::messageAnnotation];
72c074230bSJason M. Bills     if (!extendedInfo.is_array())
731abe55efSEd Tanous     {
74c074230bSJason M. Bills         extendedInfo = nlohmann::json::array();
75f4c4dcf4SKowalski, Kamil     }
76f4c4dcf4SKowalski, Kamil 
77c074230bSJason M. Bills     extendedInfo.push_back(message);
78f4c4dcf4SKowalski, Kamil }
79f4c4dcf4SKowalski, Kamil 
80f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target,
81f12894f8SJason M. Bills                                  const nlohmann::json& message)
821abe55efSEd Tanous {
831abe55efSEd Tanous     if (!target[messages::messageAnnotation].is_array())
841abe55efSEd Tanous     {
85f4c4dcf4SKowalski, Kamil         // Force object to be an array
8655c7b7a2SEd Tanous         target[messages::messageAnnotation] = nlohmann::json::array();
87f4c4dcf4SKowalski, Kamil     }
88f4c4dcf4SKowalski, Kamil 
8955c7b7a2SEd Tanous     target[messages::messageAnnotation].push_back(message);
90f4c4dcf4SKowalski, Kamil }
91f4c4dcf4SKowalski, Kamil 
92f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target,
93f12894f8SJason M. Bills                              const nlohmann::json& message,
941668ce6dSEd Tanous                              std::string_view fieldPath)
951abe55efSEd Tanous {
961668ce6dSEd Tanous     std::string extendedInfo(fieldPath);
971668ce6dSEd Tanous     extendedInfo += messages::messageAnnotation;
98f4c4dcf4SKowalski, Kamil 
991668ce6dSEd Tanous     nlohmann::json& field = target[extendedInfo];
1001668ce6dSEd Tanous     if (!field.is_array())
1011abe55efSEd Tanous     {
102f4c4dcf4SKowalski, Kamil         // Force object to be an array
1031668ce6dSEd Tanous         field = nlohmann::json::array();
104f4c4dcf4SKowalski, Kamil     }
105f4c4dcf4SKowalski, Kamil 
106f4c4dcf4SKowalski, Kamil     // Object exists and it is an array so we can just push in the message
1071668ce6dSEd Tanous     field.push_back(message);
108f4c4dcf4SKowalski, Kamil }
109f4c4dcf4SKowalski, Kamil 
110f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name,
111b6cd31e1SEd Tanous                              std::span<const std::string_view> args)
112b6cd31e1SEd Tanous {
113b6cd31e1SEd Tanous     size_t index = static_cast<size_t>(name);
114fffb8c1fSEd Tanous     if (index >= redfish::registries::base::registry.size())
115b6cd31e1SEd Tanous     {
116b6cd31e1SEd Tanous         return {};
117b6cd31e1SEd Tanous     }
118*65e4f1f7SEd Tanous     return getLogFromRegistry(redfish::registries::base::header,
119*65e4f1f7SEd Tanous                               redfish::registries::base::registry, index, args);
120b6cd31e1SEd Tanous }
121b6cd31e1SEd Tanous 
122f4c4dcf4SKowalski, Kamil /**
123f4c4dcf4SKowalski, Kamil  * @internal
124f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInUse message into JSON
125f4c4dcf4SKowalski, Kamil  *
126f4c4dcf4SKowalski, Kamil  * See header file for more information
127f4c4dcf4SKowalski, Kamil  * @endinternal
128f4c4dcf4SKowalski, Kamil  */
129b5c07418SJames Feist nlohmann::json resourceInUse(void)
1301abe55efSEd Tanous {
131fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceInUse, {});
132b5c07418SJames Feist }
133b5c07418SJames Feist 
134b5c07418SJames Feist void resourceInUse(crow::Response& res)
135b5c07418SJames Feist {
136b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
137b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInUse());
138f4c4dcf4SKowalski, Kamil }
139f4c4dcf4SKowalski, Kamil 
140f4c4dcf4SKowalski, Kamil /**
141f4c4dcf4SKowalski, Kamil  * @internal
142f4c4dcf4SKowalski, Kamil  * @brief Formats MalformedJSON message into JSON
143f4c4dcf4SKowalski, Kamil  *
144f4c4dcf4SKowalski, Kamil  * See header file for more information
145f4c4dcf4SKowalski, Kamil  * @endinternal
146f4c4dcf4SKowalski, Kamil  */
147b5c07418SJames Feist nlohmann::json malformedJSON(void)
1481abe55efSEd Tanous {
149fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::malformedJSON, {});
150b5c07418SJames Feist }
151b5c07418SJames Feist 
152b5c07418SJames Feist void malformedJSON(crow::Response& res)
153b5c07418SJames Feist {
154b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
155b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, malformedJSON());
156f4c4dcf4SKowalski, Kamil }
157f4c4dcf4SKowalski, Kamil 
158f4c4dcf4SKowalski, Kamil /**
159f4c4dcf4SKowalski, Kamil  * @internal
160f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceMissingAtURI message into JSON
161f4c4dcf4SKowalski, Kamil  *
162f4c4dcf4SKowalski, Kamil  * See header file for more information
163f4c4dcf4SKowalski, Kamil  * @endinternal
164f4c4dcf4SKowalski, Kamil  */
165ace85d60SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1)
1661abe55efSEd Tanous {
167b6cd31e1SEd Tanous     std::array<std::string_view, 1> args{
168b6cd31e1SEd Tanous         std::string_view{arg1.data(), arg1.size()}};
169fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceMissingAtURI, args);
170b5c07418SJames Feist }
171b5c07418SJames Feist 
172ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res,
173ace85d60SEd Tanous                           const boost::urls::url_view& arg1)
174b5c07418SJames Feist {
175b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
176b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
177f4c4dcf4SKowalski, Kamil }
178f4c4dcf4SKowalski, Kamil 
179f4c4dcf4SKowalski, Kamil /**
180f4c4dcf4SKowalski, Kamil  * @internal
181f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueFormatError message into JSON
182f4c4dcf4SKowalski, Kamil  *
183f4c4dcf4SKowalski, Kamil  * See header file for more information
184f4c4dcf4SKowalski, Kamil  * @endinternal
185f4c4dcf4SKowalski, Kamil  */
1861668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1,
1871668ce6dSEd Tanous                                                std::string_view arg2,
1881668ce6dSEd Tanous                                                std::string_view arg3)
1891abe55efSEd Tanous {
190fffb8c1fSEd Tanous     return getLog(
191fffb8c1fSEd Tanous         redfish::registries::base::Index::actionParameterValueFormatError,
1921668ce6dSEd Tanous         std::to_array({arg1, arg2, arg3}));
193b5c07418SJames Feist }
194b5c07418SJames Feist 
1951668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1,
1961668ce6dSEd Tanous                                      std::string_view arg2,
1971668ce6dSEd Tanous                                      std::string_view arg3)
198b5c07418SJames Feist {
199b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
200b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
201b5c07418SJames Feist                           actionParameterValueFormatError(arg1, arg2, arg3));
202f4c4dcf4SKowalski, Kamil }
203f4c4dcf4SKowalski, Kamil 
204f4c4dcf4SKowalski, Kamil /**
205f4c4dcf4SKowalski, Kamil  * @internal
206f4c4dcf4SKowalski, Kamil  * @brief Formats InternalError message into JSON
207f4c4dcf4SKowalski, Kamil  *
208f4c4dcf4SKowalski, Kamil  * See header file for more information
209f4c4dcf4SKowalski, Kamil  * @endinternal
210f4c4dcf4SKowalski, Kamil  */
211b5c07418SJames Feist nlohmann::json internalError(void)
2121abe55efSEd Tanous {
213fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::internalError, {});
214b5c07418SJames Feist }
215b5c07418SJames Feist 
216df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location)
217b5c07418SJames Feist {
218df5415fcSEd Tanous     BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "("
219df5415fcSEd Tanous                         << location.line() << ":" << location.column() << ") `"
220df5415fcSEd Tanous                         << location.function_name() << "`: ";
221b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
222b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, internalError());
223f12894f8SJason M. Bills }
224f12894f8SJason M. Bills 
225f12894f8SJason M. Bills /**
226f12894f8SJason M. Bills  * @internal
227f4c4dcf4SKowalski, Kamil  * @brief Formats UnrecognizedRequestBody message into JSON
228f4c4dcf4SKowalski, Kamil  *
229f4c4dcf4SKowalski, Kamil  * See header file for more information
230f4c4dcf4SKowalski, Kamil  * @endinternal
231f4c4dcf4SKowalski, Kamil  */
232b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void)
2331abe55efSEd Tanous {
234fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::unrecognizedRequestBody,
235fffb8c1fSEd Tanous                   {});
236b5c07418SJames Feist }
237b5c07418SJames Feist 
238b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res)
239b5c07418SJames Feist {
240b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
241b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
242f4c4dcf4SKowalski, Kamil }
243f4c4dcf4SKowalski, Kamil 
244f4c4dcf4SKowalski, Kamil /**
245f4c4dcf4SKowalski, Kamil  * @internal
246f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriUnauthorized message into JSON
247f4c4dcf4SKowalski, Kamil  *
248f4c4dcf4SKowalski, Kamil  * See header file for more information
249f4c4dcf4SKowalski, Kamil  * @endinternal
250f4c4dcf4SKowalski, Kamil  */
251ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1,
2521668ce6dSEd Tanous                                          std::string_view arg2)
2531abe55efSEd Tanous {
254b6cd31e1SEd Tanous     return getLog(
255fffb8c1fSEd Tanous         redfish::registries::base::Index::resourceAtUriUnauthorized,
2561668ce6dSEd Tanous         std::to_array({std::string_view{arg1.data(), arg1.size()}, arg2}));
257b5c07418SJames Feist }
258b5c07418SJames Feist 
259ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res,
260ace85d60SEd Tanous                                const boost::urls::url_view& arg1,
2611668ce6dSEd Tanous                                std::string_view arg2)
262b5c07418SJames Feist {
263b5c07418SJames Feist     res.result(boost::beast::http::status::unauthorized);
264b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
265f4c4dcf4SKowalski, Kamil }
266f4c4dcf4SKowalski, Kamil 
267f4c4dcf4SKowalski, Kamil /**
268f4c4dcf4SKowalski, Kamil  * @internal
269f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterUnknown message into JSON
270f4c4dcf4SKowalski, Kamil  *
271f4c4dcf4SKowalski, Kamil  * See header file for more information
272f4c4dcf4SKowalski, Kamil  * @endinternal
273f4c4dcf4SKowalski, Kamil  */
2741668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1,
2751668ce6dSEd Tanous                                       std::string_view arg2)
276b5c07418SJames Feist {
277fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterUnknown,
2781668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
279b5c07418SJames Feist }
280b5c07418SJames Feist 
2811668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1,
2821668ce6dSEd Tanous                             std::string_view arg2)
2831abe55efSEd Tanous {
284f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
285b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
286f4c4dcf4SKowalski, Kamil }
287f4c4dcf4SKowalski, Kamil 
288f4c4dcf4SKowalski, Kamil /**
289f4c4dcf4SKowalski, Kamil  * @internal
290f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceCannotBeDeleted message into JSON
291f4c4dcf4SKowalski, Kamil  *
292f4c4dcf4SKowalski, Kamil  * See header file for more information
293f4c4dcf4SKowalski, Kamil  * @endinternal
294f4c4dcf4SKowalski, Kamil  */
295b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void)
2961abe55efSEd Tanous {
297fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceCannotBeDeleted,
298fffb8c1fSEd Tanous                   {});
299b5c07418SJames Feist }
300b5c07418SJames Feist 
301b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res)
302b5c07418SJames Feist {
303b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
304b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
305f4c4dcf4SKowalski, Kamil }
306f4c4dcf4SKowalski, Kamil 
307f4c4dcf4SKowalski, Kamil /**
308f4c4dcf4SKowalski, Kamil  * @internal
309f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyDuplicate message into JSON
310f4c4dcf4SKowalski, Kamil  *
311f4c4dcf4SKowalski, Kamil  * See header file for more information
312f4c4dcf4SKowalski, Kamil  * @endinternal
313f4c4dcf4SKowalski, Kamil  */
3141668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1)
3151abe55efSEd Tanous {
316fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyDuplicate,
3171668ce6dSEd Tanous                   std::to_array({arg1}));
318b5c07418SJames Feist }
319b5c07418SJames Feist 
3201668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1)
321b5c07418SJames Feist {
322b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
323b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1);
324f4c4dcf4SKowalski, Kamil }
325f4c4dcf4SKowalski, Kamil 
326f4c4dcf4SKowalski, Kamil /**
327f4c4dcf4SKowalski, Kamil  * @internal
328f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceTemporarilyUnavailable message into JSON
329f4c4dcf4SKowalski, Kamil  *
330f4c4dcf4SKowalski, Kamil  * See header file for more information
331f4c4dcf4SKowalski, Kamil  * @endinternal
332f4c4dcf4SKowalski, Kamil  */
3331668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1)
3341abe55efSEd Tanous {
335b6cd31e1SEd Tanous     return getLog(
336fffb8c1fSEd Tanous         redfish::registries::base::Index::serviceTemporarilyUnavailable,
3371668ce6dSEd Tanous         std::to_array({arg1}));
338b5c07418SJames Feist }
339b5c07418SJames Feist 
3401668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1)
341b5c07418SJames Feist {
342d9f6c621SEd Tanous     res.addHeader(boost::beast::http::field::retry_after, arg1);
343b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
344b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
345f4c4dcf4SKowalski, Kamil }
346f4c4dcf4SKowalski, Kamil 
347f4c4dcf4SKowalski, Kamil /**
348f4c4dcf4SKowalski, Kamil  * @internal
349f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAlreadyExists message into JSON
350f4c4dcf4SKowalski, Kamil  *
351f4c4dcf4SKowalski, Kamil  * See header file for more information
352f4c4dcf4SKowalski, Kamil  * @endinternal
353f4c4dcf4SKowalski, Kamil  */
3541668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1,
3551668ce6dSEd Tanous                                      std::string_view arg2,
3561668ce6dSEd Tanous                                      std::string_view arg3)
3571abe55efSEd Tanous {
358fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceAlreadyExists,
3591668ce6dSEd Tanous                   std::to_array({arg1, arg2, arg3}));
360b5c07418SJames Feist }
361b5c07418SJames Feist 
3621668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
3631668ce6dSEd Tanous                            std::string_view arg2, std::string_view arg3)
364b5c07418SJames Feist {
365b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
366b5c07418SJames Feist     addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
367a08b46ccSJason M. Bills                      arg2);
368f4c4dcf4SKowalski, Kamil }
369f4c4dcf4SKowalski, Kamil 
370f4c4dcf4SKowalski, Kamil /**
371f4c4dcf4SKowalski, Kamil  * @internal
372f4c4dcf4SKowalski, Kamil  * @brief Formats AccountForSessionNoLongerExists message into JSON
373f4c4dcf4SKowalski, Kamil  *
374f4c4dcf4SKowalski, Kamil  * See header file for more information
375f4c4dcf4SKowalski, Kamil  * @endinternal
376f4c4dcf4SKowalski, Kamil  */
377b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void)
3781abe55efSEd Tanous {
379fffb8c1fSEd Tanous     return getLog(
380fffb8c1fSEd Tanous         redfish::registries::base::Index::accountForSessionNoLongerExists, {});
381b5c07418SJames Feist }
382b5c07418SJames Feist 
383b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res)
384b5c07418SJames Feist {
385b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
386b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
387f4c4dcf4SKowalski, Kamil }
388f4c4dcf4SKowalski, Kamil 
389f4c4dcf4SKowalski, Kamil /**
390f4c4dcf4SKowalski, Kamil  * @internal
391f4c4dcf4SKowalski, Kamil  * @brief Formats CreateFailedMissingReqProperties message into JSON
392f4c4dcf4SKowalski, Kamil  *
393f4c4dcf4SKowalski, Kamil  * See header file for more information
394f4c4dcf4SKowalski, Kamil  * @endinternal
395f4c4dcf4SKowalski, Kamil  */
3961668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1)
3971abe55efSEd Tanous {
398fffb8c1fSEd Tanous     return getLog(
399fffb8c1fSEd Tanous         redfish::registries::base::Index::createFailedMissingReqProperties,
4001668ce6dSEd Tanous         std::to_array({arg1}));
401b5c07418SJames Feist }
402b5c07418SJames Feist 
403b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res,
4041668ce6dSEd Tanous                                       std::string_view arg1)
405b5c07418SJames Feist {
406b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
407b5c07418SJames Feist     addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
408a08b46ccSJason M. Bills                      arg1);
409f12894f8SJason M. Bills }
410f12894f8SJason M. Bills 
411f12894f8SJason M. Bills /**
412f12894f8SJason M. Bills  * @internal
413f12894f8SJason M. Bills  * @brief Formats PropertyValueFormatError message into JSON for the specified
414f12894f8SJason M. Bills  * property
415f12894f8SJason M. Bills  *
416f12894f8SJason M. Bills  * See header file for more information
417f12894f8SJason M. Bills  * @endinternal
418f12894f8SJason M. Bills  */
4191668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1,
4201668ce6dSEd Tanous                                         std::string_view arg2)
421f12894f8SJason M. Bills {
422fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueFormatError,
4231668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
424b5c07418SJames Feist }
425b5c07418SJames Feist 
4261668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1,
4271668ce6dSEd Tanous                               std::string_view arg2)
428b5c07418SJames Feist {
429b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
430b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2);
431f12894f8SJason M. Bills }
432f12894f8SJason M. Bills 
433f12894f8SJason M. Bills /**
434f12894f8SJason M. Bills  * @internal
435f12894f8SJason M. Bills  * @brief Formats PropertyValueNotInList message into JSON for the specified
436f12894f8SJason M. Bills  * property
437f12894f8SJason M. Bills  *
438f12894f8SJason M. Bills  * See header file for more information
439f12894f8SJason M. Bills  * @endinternal
440f12894f8SJason M. Bills  */
4411668ce6dSEd Tanous nlohmann::json propertyValueNotInList(std::string_view arg1,
4421668ce6dSEd Tanous                                       std::string_view arg2)
443f12894f8SJason M. Bills {
444fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueNotInList,
4451668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
446b5c07418SJames Feist }
447b5c07418SJames Feist 
4481668ce6dSEd Tanous void propertyValueNotInList(crow::Response& res, std::string_view arg1,
4491668ce6dSEd Tanous                             std::string_view arg2)
450b5c07418SJames Feist {
451b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
452b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2);
453f4c4dcf4SKowalski, Kamil }
454f4c4dcf4SKowalski, Kamil 
455f4c4dcf4SKowalski, Kamil /**
456f4c4dcf4SKowalski, Kamil  * @internal
457227a2b0aSJiaqing Zhao  * @brief Formats PropertyValueOutOfRange message into JSON
458227a2b0aSJiaqing Zhao  *
459227a2b0aSJiaqing Zhao  * See header file for more information
460227a2b0aSJiaqing Zhao  * @endinternal
461227a2b0aSJiaqing Zhao  */
462227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1,
463227a2b0aSJiaqing Zhao                                        std::string_view arg2)
464227a2b0aSJiaqing Zhao {
465227a2b0aSJiaqing Zhao     return getLog(redfish::registries::base::Index::propertyValueOutOfRange,
466227a2b0aSJiaqing Zhao                   std::to_array({arg1, arg2}));
467227a2b0aSJiaqing Zhao }
468227a2b0aSJiaqing Zhao 
469227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1,
470227a2b0aSJiaqing Zhao                              std::string_view arg2)
471227a2b0aSJiaqing Zhao {
472227a2b0aSJiaqing Zhao     res.result(boost::beast::http::status::bad_request);
473227a2b0aSJiaqing Zhao     addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2));
474227a2b0aSJiaqing Zhao }
475227a2b0aSJiaqing Zhao 
476227a2b0aSJiaqing Zhao /**
477227a2b0aSJiaqing Zhao  * @internal
478f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
479f4c4dcf4SKowalski, Kamil  *
480f4c4dcf4SKowalski, Kamil  * See header file for more information
481f4c4dcf4SKowalski, Kamil  * @endinternal
482f4c4dcf4SKowalski, Kamil  */
483ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1)
4841abe55efSEd Tanous {
4851668ce6dSEd Tanous     std::string_view arg1str{arg1.data(), arg1.size()};
486b6cd31e1SEd Tanous     return getLog(
487fffb8c1fSEd Tanous         redfish::registries::base::Index::resourceAtUriInUnknownFormat,
4881668ce6dSEd Tanous         std::to_array({arg1str}));
489b5c07418SJames Feist }
490b5c07418SJames Feist 
491ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res,
492ace85d60SEd Tanous                                   const boost::urls::url_view& arg1)
493b5c07418SJames Feist {
494b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
495b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
496f4c4dcf4SKowalski, Kamil }
497f4c4dcf4SKowalski, Kamil 
498f4c4dcf4SKowalski, Kamil /**
499f4c4dcf4SKowalski, Kamil  * @internal
50081856681SAsmitha Karunanithi  * @brief Formats ServiceDisabled message into JSON
50181856681SAsmitha Karunanithi  *
50281856681SAsmitha Karunanithi  * See header file for more information
50381856681SAsmitha Karunanithi  * @endinternal
50481856681SAsmitha Karunanithi  */
5051668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1)
50681856681SAsmitha Karunanithi {
507fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceDisabled,
5081668ce6dSEd Tanous                   std::to_array({arg1}));
50981856681SAsmitha Karunanithi }
51081856681SAsmitha Karunanithi 
5111668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1)
51281856681SAsmitha Karunanithi {
51381856681SAsmitha Karunanithi     res.result(boost::beast::http::status::service_unavailable);
51481856681SAsmitha Karunanithi     addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1));
51581856681SAsmitha Karunanithi }
51681856681SAsmitha Karunanithi 
51781856681SAsmitha Karunanithi /**
51881856681SAsmitha Karunanithi  * @internal
519f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceInUnknownState message into JSON
520f4c4dcf4SKowalski, Kamil  *
521f4c4dcf4SKowalski, Kamil  * See header file for more information
522f4c4dcf4SKowalski, Kamil  * @endinternal
523f4c4dcf4SKowalski, Kamil  */
524b5c07418SJames Feist nlohmann::json serviceInUnknownState(void)
5251abe55efSEd Tanous {
526fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceInUnknownState, {});
527b5c07418SJames Feist }
528b5c07418SJames Feist 
529b5c07418SJames Feist void serviceInUnknownState(crow::Response& res)
530b5c07418SJames Feist {
531b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
532b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
533f4c4dcf4SKowalski, Kamil }
534f4c4dcf4SKowalski, Kamil 
535f4c4dcf4SKowalski, Kamil /**
536f4c4dcf4SKowalski, Kamil  * @internal
537f4c4dcf4SKowalski, Kamil  * @brief Formats EventSubscriptionLimitExceeded message into JSON
538f4c4dcf4SKowalski, Kamil  *
539f4c4dcf4SKowalski, Kamil  * See header file for more information
540f4c4dcf4SKowalski, Kamil  * @endinternal
541f4c4dcf4SKowalski, Kamil  */
542b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void)
5431abe55efSEd Tanous {
544fffb8c1fSEd Tanous     return getLog(
545fffb8c1fSEd Tanous         redfish::registries::base::Index::eventSubscriptionLimitExceeded, {});
546b5c07418SJames Feist }
547b5c07418SJames Feist 
548b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res)
549b5c07418SJames Feist {
550789fdab3SEd Tanous     res.result(boost::beast::http::status::service_unavailable);
551b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
552f4c4dcf4SKowalski, Kamil }
553f4c4dcf4SKowalski, Kamil 
554f4c4dcf4SKowalski, Kamil /**
555f4c4dcf4SKowalski, Kamil  * @internal
556f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterMissing message into JSON
557f4c4dcf4SKowalski, Kamil  *
558f4c4dcf4SKowalski, Kamil  * See header file for more information
559f4c4dcf4SKowalski, Kamil  * @endinternal
560f4c4dcf4SKowalski, Kamil  */
5611668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1,
5621668ce6dSEd Tanous                                       std::string_view arg2)
5631abe55efSEd Tanous {
564fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterMissing,
5651668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
566b5c07418SJames Feist }
567b5c07418SJames Feist 
5681668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1,
5691668ce6dSEd Tanous                             std::string_view arg2)
570b5c07418SJames Feist {
571b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
572b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2));
573f4c4dcf4SKowalski, Kamil }
574f4c4dcf4SKowalski, Kamil 
575f4c4dcf4SKowalski, Kamil /**
576f4c4dcf4SKowalski, Kamil  * @internal
577f4c4dcf4SKowalski, Kamil  * @brief Formats StringValueTooLong message into JSON
578f4c4dcf4SKowalski, Kamil  *
579f4c4dcf4SKowalski, Kamil  * See header file for more information
580f4c4dcf4SKowalski, Kamil  * @endinternal
581f4c4dcf4SKowalski, Kamil  */
5821668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2)
5831abe55efSEd Tanous {
584b6cd31e1SEd Tanous     std::string arg2String = std::to_string(arg2);
585fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::stringValueTooLong,
5861668ce6dSEd Tanous                   std::to_array({arg1, std::string_view(arg2String)}));
587b5c07418SJames Feist }
588b5c07418SJames Feist 
5891668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2)
590b5c07418SJames Feist {
591b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
592b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2));
593f4c4dcf4SKowalski, Kamil }
594f4c4dcf4SKowalski, Kamil 
595f4c4dcf4SKowalski, Kamil /**
596f4c4dcf4SKowalski, Kamil  * @internal
597cc9139ecSJason M. Bills  * @brief Formats SessionTerminated message into JSON
598cc9139ecSJason M. Bills  *
599cc9139ecSJason M. Bills  * See header file for more information
600cc9139ecSJason M. Bills  * @endinternal
601cc9139ecSJason M. Bills  */
602b5c07418SJames Feist nlohmann::json sessionTerminated(void)
603cc9139ecSJason M. Bills {
604fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::sessionTerminated, {});
605b5c07418SJames Feist }
606b5c07418SJames Feist 
607b5c07418SJames Feist void sessionTerminated(crow::Response& res)
608b5c07418SJames Feist {
609b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
610b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, sessionTerminated());
611cc9139ecSJason M. Bills }
612cc9139ecSJason M. Bills 
613cc9139ecSJason M. Bills /**
614cc9139ecSJason M. Bills  * @internal
615684bb4b8SJason M. Bills  * @brief Formats SubscriptionTerminated message into JSON
616684bb4b8SJason M. Bills  *
617684bb4b8SJason M. Bills  * See header file for more information
618684bb4b8SJason M. Bills  * @endinternal
619684bb4b8SJason M. Bills  */
620684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void)
621684bb4b8SJason M. Bills {
622fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::subscriptionTerminated, {});
623684bb4b8SJason M. Bills }
624684bb4b8SJason M. Bills 
625684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res)
626684bb4b8SJason M. Bills {
627684bb4b8SJason M. Bills     res.result(boost::beast::http::status::ok);
628684bb4b8SJason M. Bills     addMessageToJsonRoot(res.jsonValue, subscriptionTerminated());
629684bb4b8SJason M. Bills }
630684bb4b8SJason M. Bills 
631684bb4b8SJason M. Bills /**
632684bb4b8SJason M. Bills  * @internal
633cc9139ecSJason M. Bills  * @brief Formats ResourceTypeIncompatible message into JSON
634cc9139ecSJason M. Bills  *
635cc9139ecSJason M. Bills  * See header file for more information
636cc9139ecSJason M. Bills  * @endinternal
637cc9139ecSJason M. Bills  */
6381668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1,
6391668ce6dSEd Tanous                                         std::string_view arg2)
640cc9139ecSJason M. Bills {
641fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceTypeIncompatible,
6421668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
643b5c07418SJames Feist }
644b5c07418SJames Feist 
6451668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1,
6461668ce6dSEd Tanous                               std::string_view arg2)
647b5c07418SJames Feist {
648b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
649b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2));
650cc9139ecSJason M. Bills }
651cc9139ecSJason M. Bills 
652cc9139ecSJason M. Bills /**
653cc9139ecSJason M. Bills  * @internal
654684bb4b8SJason M. Bills  * @brief Formats ResetRequired message into JSON
655684bb4b8SJason M. Bills  *
656684bb4b8SJason M. Bills  * See header file for more information
657684bb4b8SJason M. Bills  * @endinternal
658684bb4b8SJason M. Bills  */
659ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1,
6601668ce6dSEd Tanous                              std::string_view arg2)
661684bb4b8SJason M. Bills {
6621668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
663fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resetRequired,
6641668ce6dSEd Tanous                   std::to_array({arg1str, arg2}));
665684bb4b8SJason M. Bills }
666684bb4b8SJason M. Bills 
667ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1,
6681668ce6dSEd Tanous                    std::string_view arg2)
669684bb4b8SJason M. Bills {
670684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
671684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2));
672684bb4b8SJason M. Bills }
673684bb4b8SJason M. Bills 
674684bb4b8SJason M. Bills /**
675684bb4b8SJason M. Bills  * @internal
676684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOnRequired message into JSON
677684bb4b8SJason M. Bills  *
678684bb4b8SJason M. Bills  * See header file for more information
679684bb4b8SJason M. Bills  * @endinternal
680684bb4b8SJason M. Bills  */
6811668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1)
682684bb4b8SJason M. Bills {
683fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resetRequired,
6841668ce6dSEd Tanous                   std::to_array({arg1}));
685684bb4b8SJason M. Bills }
686684bb4b8SJason M. Bills 
6871668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1)
688684bb4b8SJason M. Bills {
689684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
690684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1));
691684bb4b8SJason M. Bills }
692684bb4b8SJason M. Bills 
693684bb4b8SJason M. Bills /**
694684bb4b8SJason M. Bills  * @internal
695684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOffRequired message into JSON
696684bb4b8SJason M. Bills  *
697684bb4b8SJason M. Bills  * See header file for more information
698684bb4b8SJason M. Bills  * @endinternal
699684bb4b8SJason M. Bills  */
7001668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1)
701684bb4b8SJason M. Bills {
702b6cd31e1SEd Tanous     return getLog(
703fffb8c1fSEd Tanous         redfish::registries::base::Index::chassisPowerStateOffRequired,
7041668ce6dSEd Tanous         std::to_array({arg1}));
705684bb4b8SJason M. Bills }
706684bb4b8SJason M. Bills 
7071668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1)
708684bb4b8SJason M. Bills {
709684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
710684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1));
711684bb4b8SJason M. Bills }
712684bb4b8SJason M. Bills 
713684bb4b8SJason M. Bills /**
714684bb4b8SJason M. Bills  * @internal
715684bb4b8SJason M. Bills  * @brief Formats PropertyValueConflict message into JSON
716684bb4b8SJason M. Bills  *
717684bb4b8SJason M. Bills  * See header file for more information
718684bb4b8SJason M. Bills  * @endinternal
719684bb4b8SJason M. Bills  */
7201668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1,
7211668ce6dSEd Tanous                                      std::string_view arg2)
722684bb4b8SJason M. Bills {
723fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueConflict,
7241668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
725684bb4b8SJason M. Bills }
726684bb4b8SJason M. Bills 
7271668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1,
7281668ce6dSEd Tanous                            std::string_view arg2)
729684bb4b8SJason M. Bills {
730684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
731684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2));
732684bb4b8SJason M. Bills }
733684bb4b8SJason M. Bills 
734684bb4b8SJason M. Bills /**
735684bb4b8SJason M. Bills  * @internal
7362a6af81cSRamesh Iyyar  * @brief Formats PropertyValueResourceConflict message into JSON
7372a6af81cSRamesh Iyyar  *
7382a6af81cSRamesh Iyyar  * See header file for more information
7392a6af81cSRamesh Iyyar  * @endinternal
7402a6af81cSRamesh Iyyar  */
7412a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1,
7422a6af81cSRamesh Iyyar                                              std::string_view arg2,
7432a6af81cSRamesh Iyyar                                              const boost::urls::url_view& arg3)
7442a6af81cSRamesh Iyyar {
7452a6af81cSRamesh Iyyar     return getLog(
7462a6af81cSRamesh Iyyar         redfish::registries::base::Index::propertyValueResourceConflict,
7472a6af81cSRamesh Iyyar         std::to_array(
7482a6af81cSRamesh Iyyar             {arg1, arg2, std::string_view{arg3.data(), arg3.size()}}));
7492a6af81cSRamesh Iyyar }
7502a6af81cSRamesh Iyyar 
7512a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1,
7522a6af81cSRamesh Iyyar                                    std::string_view arg2,
7532a6af81cSRamesh Iyyar                                    const boost::urls::url_view& arg3)
7542a6af81cSRamesh Iyyar {
7552a6af81cSRamesh Iyyar     res.result(boost::beast::http::status::conflict);
7562a6af81cSRamesh Iyyar     addMessageToErrorJson(res.jsonValue,
7572a6af81cSRamesh Iyyar                           propertyValueResourceConflict(arg1, arg2, arg3));
7582a6af81cSRamesh Iyyar }
7592a6af81cSRamesh Iyyar 
7602a6af81cSRamesh Iyyar /**
7612a6af81cSRamesh Iyyar  * @internal
76224861a28SRamesh Iyyar  * @brief Formats PropertyValueExternalConflict message into JSON
76324861a28SRamesh Iyyar  *
76424861a28SRamesh Iyyar  * See header file for more information
76524861a28SRamesh Iyyar  * @endinternal
76624861a28SRamesh Iyyar  */
76724861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1,
76824861a28SRamesh Iyyar                                              std::string_view arg2)
76924861a28SRamesh Iyyar {
77024861a28SRamesh Iyyar     return getLog(
77124861a28SRamesh Iyyar         redfish::registries::base::Index::propertyValueExternalConflict,
77224861a28SRamesh Iyyar         std::to_array({arg1, arg2}));
77324861a28SRamesh Iyyar }
77424861a28SRamesh Iyyar 
77524861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1,
77624861a28SRamesh Iyyar                                    std::string_view arg2)
77724861a28SRamesh Iyyar {
77824861a28SRamesh Iyyar     res.result(boost::beast::http::status::conflict);
77924861a28SRamesh Iyyar     addMessageToErrorJson(res.jsonValue,
78024861a28SRamesh Iyyar                           propertyValueExternalConflict(arg1, arg2));
78124861a28SRamesh Iyyar }
78224861a28SRamesh Iyyar 
78324861a28SRamesh Iyyar /**
78424861a28SRamesh Iyyar  * @internal
785684bb4b8SJason M. Bills  * @brief Formats PropertyValueIncorrect message into JSON
786684bb4b8SJason M. Bills  *
787684bb4b8SJason M. Bills  * See header file for more information
788684bb4b8SJason M. Bills  * @endinternal
789684bb4b8SJason M. Bills  */
7901668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1,
7911668ce6dSEd Tanous                                       std::string_view arg2)
792684bb4b8SJason M. Bills {
793fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueIncorrect,
7941668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
795684bb4b8SJason M. Bills }
796684bb4b8SJason M. Bills 
7971668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
7981668ce6dSEd Tanous                             std::string_view arg2)
799684bb4b8SJason M. Bills {
800684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
801684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));
802684bb4b8SJason M. Bills }
803684bb4b8SJason M. Bills 
804684bb4b8SJason M. Bills /**
805684bb4b8SJason M. Bills  * @internal
806684bb4b8SJason M. Bills  * @brief Formats ResourceCreationConflict message into JSON
807684bb4b8SJason M. Bills  *
808684bb4b8SJason M. Bills  * See header file for more information
809684bb4b8SJason M. Bills  * @endinternal
810684bb4b8SJason M. Bills  */
811ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1)
812684bb4b8SJason M. Bills {
8131668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
814fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceCreationConflict,
8151668ce6dSEd Tanous                   std::to_array({arg1str}));
816684bb4b8SJason M. Bills }
817684bb4b8SJason M. Bills 
818ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res,
819ace85d60SEd Tanous                               const boost::urls::url_view& arg1)
820684bb4b8SJason M. Bills {
821684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
822684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1));
823684bb4b8SJason M. Bills }
824684bb4b8SJason M. Bills 
825684bb4b8SJason M. Bills /**
826684bb4b8SJason M. Bills  * @internal
827684bb4b8SJason M. Bills  * @brief Formats MaximumErrorsExceeded message into JSON
828684bb4b8SJason M. Bills  *
829684bb4b8SJason M. Bills  * See header file for more information
830684bb4b8SJason M. Bills  * @endinternal
831684bb4b8SJason M. Bills  */
832684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void)
833684bb4b8SJason M. Bills {
834fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {});
835684bb4b8SJason M. Bills }
836684bb4b8SJason M. Bills 
837684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res)
838684bb4b8SJason M. Bills {
839684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
840684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded());
841684bb4b8SJason M. Bills }
842684bb4b8SJason M. Bills 
843684bb4b8SJason M. Bills /**
844684bb4b8SJason M. Bills  * @internal
845684bb4b8SJason M. Bills  * @brief Formats PreconditionFailed message into JSON
846684bb4b8SJason M. Bills  *
847684bb4b8SJason M. Bills  * See header file for more information
848684bb4b8SJason M. Bills  * @endinternal
849684bb4b8SJason M. Bills  */
850684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void)
851684bb4b8SJason M. Bills {
852fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::preconditionFailed, {});
853684bb4b8SJason M. Bills }
854684bb4b8SJason M. Bills 
855684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res)
856684bb4b8SJason M. Bills {
8574df1bee0SEd Tanous     res.result(boost::beast::http::status::precondition_failed);
858684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionFailed());
859684bb4b8SJason M. Bills }
860684bb4b8SJason M. Bills 
861684bb4b8SJason M. Bills /**
862684bb4b8SJason M. Bills  * @internal
863684bb4b8SJason M. Bills  * @brief Formats PreconditionRequired message into JSON
864684bb4b8SJason M. Bills  *
865684bb4b8SJason M. Bills  * See header file for more information
866684bb4b8SJason M. Bills  * @endinternal
867684bb4b8SJason M. Bills  */
868684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void)
869684bb4b8SJason M. Bills {
870fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::preconditionRequired, {});
871684bb4b8SJason M. Bills }
872684bb4b8SJason M. Bills 
873684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res)
874684bb4b8SJason M. Bills {
875684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
876684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionRequired());
877684bb4b8SJason M. Bills }
878684bb4b8SJason M. Bills 
879684bb4b8SJason M. Bills /**
880684bb4b8SJason M. Bills  * @internal
881684bb4b8SJason M. Bills  * @brief Formats OperationFailed message into JSON
882684bb4b8SJason M. Bills  *
883684bb4b8SJason M. Bills  * See header file for more information
884684bb4b8SJason M. Bills  * @endinternal
885684bb4b8SJason M. Bills  */
886684bb4b8SJason M. Bills nlohmann::json operationFailed(void)
887684bb4b8SJason M. Bills {
888fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::operationFailed, {});
889684bb4b8SJason M. Bills }
890684bb4b8SJason M. Bills 
891684bb4b8SJason M. Bills void operationFailed(crow::Response& res)
892684bb4b8SJason M. Bills {
8938868776eSEd Tanous     res.result(boost::beast::http::status::bad_gateway);
894684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationFailed());
895684bb4b8SJason M. Bills }
896684bb4b8SJason M. Bills 
897684bb4b8SJason M. Bills /**
898684bb4b8SJason M. Bills  * @internal
899684bb4b8SJason M. Bills  * @brief Formats OperationTimeout message into JSON
900684bb4b8SJason M. Bills  *
901684bb4b8SJason M. Bills  * See header file for more information
902684bb4b8SJason M. Bills  * @endinternal
903684bb4b8SJason M. Bills  */
904684bb4b8SJason M. Bills nlohmann::json operationTimeout(void)
905684bb4b8SJason M. Bills {
906fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::operationTimeout, {});
907684bb4b8SJason M. Bills }
908684bb4b8SJason M. Bills 
909684bb4b8SJason M. Bills void operationTimeout(crow::Response& res)
910684bb4b8SJason M. Bills {
911684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
912684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationTimeout());
913684bb4b8SJason M. Bills }
914684bb4b8SJason M. Bills 
915684bb4b8SJason M. Bills /**
916684bb4b8SJason M. Bills  * @internal
917f12894f8SJason M. Bills  * @brief Formats PropertyValueTypeError message into JSON for the specified
918f12894f8SJason M. Bills  * property
919f12894f8SJason M. Bills  *
920f12894f8SJason M. Bills  * See header file for more information
921f12894f8SJason M. Bills  * @endinternal
922f12894f8SJason M. Bills  */
9231668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1,
9241668ce6dSEd Tanous                                       std::string_view arg2)
925f12894f8SJason M. Bills {
926fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueTypeError,
9271668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
928b5c07418SJames Feist }
929b5c07418SJames Feist 
9301668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1,
9311668ce6dSEd Tanous                             std::string_view arg2)
932b5c07418SJames Feist {
933b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
934b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
935f4c4dcf4SKowalski, Kamil }
936f4c4dcf4SKowalski, Kamil 
937f4c4dcf4SKowalski, Kamil /**
938f4c4dcf4SKowalski, Kamil  * @internal
939b6cd31e1SEd Tanous  * @brief Formats ResourceNotFound message into JSONd
940f4c4dcf4SKowalski, Kamil  *
941f4c4dcf4SKowalski, Kamil  * See header file for more information
942f4c4dcf4SKowalski, Kamil  * @endinternal
943f4c4dcf4SKowalski, Kamil  */
9441668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2)
9451abe55efSEd Tanous {
946fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceNotFound,
9471668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
948b5c07418SJames Feist }
949b5c07418SJames Feist 
9501668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1,
9511668ce6dSEd Tanous                       std::string_view arg2)
952b5c07418SJames Feist {
953b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
954b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
955f4c4dcf4SKowalski, Kamil }
956f4c4dcf4SKowalski, Kamil 
957f4c4dcf4SKowalski, Kamil /**
958f4c4dcf4SKowalski, Kamil  * @internal
959f4c4dcf4SKowalski, Kamil  * @brief Formats CouldNotEstablishConnection message into JSON
960f4c4dcf4SKowalski, Kamil  *
961f4c4dcf4SKowalski, Kamil  * See header file for more information
962f4c4dcf4SKowalski, Kamil  * @endinternal
963f4c4dcf4SKowalski, Kamil  */
964ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1)
9651abe55efSEd Tanous {
9661668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
967fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::couldNotEstablishConnection,
9681668ce6dSEd Tanous                   std::to_array({arg1str}));
969b5c07418SJames Feist }
970b5c07418SJames Feist 
971ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res,
972ace85d60SEd Tanous                                  const boost::urls::url_view& arg1)
973b5c07418SJames Feist {
974b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
975b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
976f4c4dcf4SKowalski, Kamil }
977f4c4dcf4SKowalski, Kamil 
978f4c4dcf4SKowalski, Kamil /**
979f4c4dcf4SKowalski, Kamil  * @internal
980f12894f8SJason M. Bills  * @brief Formats PropertyNotWritable message into JSON for the specified
981f12894f8SJason M. Bills  * property
982f12894f8SJason M. Bills  *
983f12894f8SJason M. Bills  * See header file for more information
984f12894f8SJason M. Bills  * @endinternal
985f12894f8SJason M. Bills  */
9861668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1)
987f12894f8SJason M. Bills {
988fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyNotWritable,
9891668ce6dSEd Tanous                   std::to_array({arg1}));
990b5c07418SJames Feist }
991b5c07418SJames Feist 
9921668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1)
993b5c07418SJames Feist {
994b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
995b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
996f4c4dcf4SKowalski, Kamil }
997f4c4dcf4SKowalski, Kamil 
998f4c4dcf4SKowalski, Kamil /**
999f4c4dcf4SKowalski, Kamil  * @internal
1000f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueTypeError message into JSON
1001f4c4dcf4SKowalski, Kamil  *
1002f4c4dcf4SKowalski, Kamil  * See header file for more information
1003f4c4dcf4SKowalski, Kamil  * @endinternal
1004f4c4dcf4SKowalski, Kamil  */
10051668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1,
10061668ce6dSEd Tanous                                             std::string_view arg2)
10071abe55efSEd Tanous {
1008b6cd31e1SEd Tanous     return getLog(
1009fffb8c1fSEd Tanous         redfish::registries::base::Index::queryParameterValueTypeError,
10101668ce6dSEd Tanous         std::to_array({arg1, arg2}));
1011b5c07418SJames Feist }
1012b5c07418SJames Feist 
10131668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1,
10141668ce6dSEd Tanous                                   std::string_view arg2)
1015b5c07418SJames Feist {
1016b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1017b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1018b5c07418SJames Feist                           queryParameterValueTypeError(arg1, arg2));
1019f4c4dcf4SKowalski, Kamil }
1020f4c4dcf4SKowalski, Kamil 
1021f4c4dcf4SKowalski, Kamil /**
1022f4c4dcf4SKowalski, Kamil  * @internal
1023f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceShuttingDown message into JSON
1024f4c4dcf4SKowalski, Kamil  *
1025f4c4dcf4SKowalski, Kamil  * See header file for more information
1026f4c4dcf4SKowalski, Kamil  * @endinternal
1027f4c4dcf4SKowalski, Kamil  */
1028b5c07418SJames Feist nlohmann::json serviceShuttingDown(void)
10291abe55efSEd Tanous {
1030fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceShuttingDown, {});
1031b5c07418SJames Feist }
1032b5c07418SJames Feist 
1033b5c07418SJames Feist void serviceShuttingDown(crow::Response& res)
1034b5c07418SJames Feist {
1035b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1036b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
1037f4c4dcf4SKowalski, Kamil }
1038f4c4dcf4SKowalski, Kamil 
1039f4c4dcf4SKowalski, Kamil /**
1040f4c4dcf4SKowalski, Kamil  * @internal
1041f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterDuplicate message into JSON
1042f4c4dcf4SKowalski, Kamil  *
1043f4c4dcf4SKowalski, Kamil  * See header file for more information
1044f4c4dcf4SKowalski, Kamil  * @endinternal
1045f4c4dcf4SKowalski, Kamil  */
10461668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1,
10471668ce6dSEd Tanous                                         std::string_view arg2)
10481abe55efSEd Tanous {
1049fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterDuplicate,
10501668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1051b5c07418SJames Feist }
1052b5c07418SJames Feist 
10531668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
10541668ce6dSEd Tanous                               std::string_view arg2)
1055b5c07418SJames Feist {
1056b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1057b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
1058f4c4dcf4SKowalski, Kamil }
1059f4c4dcf4SKowalski, Kamil 
1060f4c4dcf4SKowalski, Kamil /**
1061f4c4dcf4SKowalski, Kamil  * @internal
1062f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterNotSupported message into JSON
1063f4c4dcf4SKowalski, Kamil  *
1064f4c4dcf4SKowalski, Kamil  * See header file for more information
1065f4c4dcf4SKowalski, Kamil  * @endinternal
1066f4c4dcf4SKowalski, Kamil  */
10671668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1,
10681668ce6dSEd Tanous                                            std::string_view arg2)
10691abe55efSEd Tanous {
1070fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterNotSupported,
10711668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1072b5c07418SJames Feist }
1073b5c07418SJames Feist 
10741668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
10751668ce6dSEd Tanous                                  std::string_view arg2)
1076b5c07418SJames Feist {
1077b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1078b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1079b5c07418SJames Feist                           actionParameterNotSupported(arg1, arg2));
1080f4c4dcf4SKowalski, Kamil }
1081f4c4dcf4SKowalski, Kamil 
1082f4c4dcf4SKowalski, Kamil /**
1083f4c4dcf4SKowalski, Kamil  * @internal
1084f4c4dcf4SKowalski, Kamil  * @brief Formats SourceDoesNotSupportProtocol message into JSON
1085f4c4dcf4SKowalski, Kamil  *
1086f4c4dcf4SKowalski, Kamil  * See header file for more information
1087f4c4dcf4SKowalski, Kamil  * @endinternal
1088f4c4dcf4SKowalski, Kamil  */
1089ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1,
10901668ce6dSEd Tanous                                             std::string_view arg2)
10911abe55efSEd Tanous {
10921668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
1093b6cd31e1SEd Tanous     return getLog(
1094fffb8c1fSEd Tanous         redfish::registries::base::Index::sourceDoesNotSupportProtocol,
10951668ce6dSEd Tanous         std::to_array({arg1str, arg2}));
1096b5c07418SJames Feist }
1097b5c07418SJames Feist 
1098ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res,
1099ace85d60SEd Tanous                                   const boost::urls::url_view& arg1,
11001668ce6dSEd Tanous                                   std::string_view arg2)
1101b5c07418SJames Feist {
1102b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1103b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1104b5c07418SJames Feist                           sourceDoesNotSupportProtocol(arg1, arg2));
1105f4c4dcf4SKowalski, Kamil }
1106f4c4dcf4SKowalski, Kamil 
1107f4c4dcf4SKowalski, Kamil /**
1108f4c4dcf4SKowalski, Kamil  * @internal
1109f4c4dcf4SKowalski, Kamil  * @brief Formats AccountRemoved message into JSON
1110f4c4dcf4SKowalski, Kamil  *
1111f4c4dcf4SKowalski, Kamil  * See header file for more information
1112f4c4dcf4SKowalski, Kamil  * @endinternal
1113f4c4dcf4SKowalski, Kamil  */
1114b5c07418SJames Feist nlohmann::json accountRemoved(void)
11151abe55efSEd Tanous {
1116fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountRemoved, {});
1117b5c07418SJames Feist }
1118b5c07418SJames Feist 
1119b5c07418SJames Feist void accountRemoved(crow::Response& res)
1120b5c07418SJames Feist {
1121b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1122b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, accountRemoved());
1123f4c4dcf4SKowalski, Kamil }
1124f4c4dcf4SKowalski, Kamil 
1125f4c4dcf4SKowalski, Kamil /**
1126f4c4dcf4SKowalski, Kamil  * @internal
1127f4c4dcf4SKowalski, Kamil  * @brief Formats AccessDenied message into JSON
1128f4c4dcf4SKowalski, Kamil  *
1129f4c4dcf4SKowalski, Kamil  * See header file for more information
1130f4c4dcf4SKowalski, Kamil  * @endinternal
1131f4c4dcf4SKowalski, Kamil  */
1132ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1)
11331abe55efSEd Tanous {
11341668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
1135fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accessDenied,
11361668ce6dSEd Tanous                   std::to_array({arg1str}));
1137b5c07418SJames Feist }
1138b5c07418SJames Feist 
1139ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1)
1140b5c07418SJames Feist {
1141b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1142b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
1143f4c4dcf4SKowalski, Kamil }
1144f4c4dcf4SKowalski, Kamil 
1145f4c4dcf4SKowalski, Kamil /**
1146f4c4dcf4SKowalski, Kamil  * @internal
1147f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupported message into JSON
1148f4c4dcf4SKowalski, Kamil  *
1149f4c4dcf4SKowalski, Kamil  * See header file for more information
1150f4c4dcf4SKowalski, Kamil  * @endinternal
1151f4c4dcf4SKowalski, Kamil  */
1152b5c07418SJames Feist nlohmann::json queryNotSupported(void)
11531abe55efSEd Tanous {
1154fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryNotSupported, {});
1155b5c07418SJames Feist }
1156b5c07418SJames Feist 
1157b5c07418SJames Feist void queryNotSupported(crow::Response& res)
1158b5c07418SJames Feist {
1159b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1160b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupported());
1161f4c4dcf4SKowalski, Kamil }
1162f4c4dcf4SKowalski, Kamil 
1163f4c4dcf4SKowalski, Kamil /**
1164f4c4dcf4SKowalski, Kamil  * @internal
1165f4c4dcf4SKowalski, Kamil  * @brief Formats CreateLimitReachedForResource message into JSON
1166f4c4dcf4SKowalski, Kamil  *
1167f4c4dcf4SKowalski, Kamil  * See header file for more information
1168f4c4dcf4SKowalski, Kamil  * @endinternal
1169f4c4dcf4SKowalski, Kamil  */
1170b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void)
11711abe55efSEd Tanous {
1172b6cd31e1SEd Tanous     return getLog(
1173fffb8c1fSEd Tanous         redfish::registries::base::Index::createLimitReachedForResource, {});
1174b5c07418SJames Feist }
1175b5c07418SJames Feist 
1176b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res)
1177b5c07418SJames Feist {
1178b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1179b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
1180f4c4dcf4SKowalski, Kamil }
1181f4c4dcf4SKowalski, Kamil 
1182f4c4dcf4SKowalski, Kamil /**
1183f4c4dcf4SKowalski, Kamil  * @internal
1184f4c4dcf4SKowalski, Kamil  * @brief Formats GeneralError message into JSON
1185f4c4dcf4SKowalski, Kamil  *
1186f4c4dcf4SKowalski, Kamil  * See header file for more information
1187f4c4dcf4SKowalski, Kamil  * @endinternal
1188f4c4dcf4SKowalski, Kamil  */
1189b5c07418SJames Feist nlohmann::json generalError(void)
11901abe55efSEd Tanous {
1191fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::generalError, {});
1192b5c07418SJames Feist }
1193b5c07418SJames Feist 
1194b5c07418SJames Feist void generalError(crow::Response& res)
1195b5c07418SJames Feist {
1196b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
1197b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, generalError());
1198f4c4dcf4SKowalski, Kamil }
1199f4c4dcf4SKowalski, Kamil 
1200f4c4dcf4SKowalski, Kamil /**
1201f4c4dcf4SKowalski, Kamil  * @internal
1202f4c4dcf4SKowalski, Kamil  * @brief Formats Success message into JSON
1203f4c4dcf4SKowalski, Kamil  *
1204f4c4dcf4SKowalski, Kamil  * See header file for more information
1205f4c4dcf4SKowalski, Kamil  * @endinternal
1206f4c4dcf4SKowalski, Kamil  */
1207b5c07418SJames Feist nlohmann::json success(void)
12081abe55efSEd Tanous {
1209fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::success, {});
1210b5c07418SJames Feist }
1211b5c07418SJames Feist 
1212b5c07418SJames Feist void success(crow::Response& res)
1213b5c07418SJames Feist {
1214b5c07418SJames Feist     // don't set res.result here because success is the default and any
1215b5c07418SJames Feist     // error should overwrite the default
1216b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, success());
1217f12894f8SJason M. Bills }
1218f12894f8SJason M. Bills 
1219f12894f8SJason M. Bills /**
1220f12894f8SJason M. Bills  * @internal
1221f4c4dcf4SKowalski, Kamil  * @brief Formats Created message into JSON
1222f4c4dcf4SKowalski, Kamil  *
1223f4c4dcf4SKowalski, Kamil  * See header file for more information
1224f4c4dcf4SKowalski, Kamil  * @endinternal
1225f4c4dcf4SKowalski, Kamil  */
1226b5c07418SJames Feist nlohmann::json created(void)
12271abe55efSEd Tanous {
1228fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::created, {});
1229b5c07418SJames Feist }
1230b5c07418SJames Feist 
1231b5c07418SJames Feist void created(crow::Response& res)
1232b5c07418SJames Feist {
1233b5c07418SJames Feist     res.result(boost::beast::http::status::created);
1234b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, created());
1235f4c4dcf4SKowalski, Kamil }
1236f4c4dcf4SKowalski, Kamil 
1237f4c4dcf4SKowalski, Kamil /**
1238f4c4dcf4SKowalski, Kamil  * @internal
1239cc9139ecSJason M. Bills  * @brief Formats NoOperation message into JSON
1240cc9139ecSJason M. Bills  *
1241cc9139ecSJason M. Bills  * See header file for more information
1242cc9139ecSJason M. Bills  * @endinternal
1243cc9139ecSJason M. Bills  */
1244b5c07418SJames Feist nlohmann::json noOperation(void)
1245cc9139ecSJason M. Bills {
1246fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::noOperation, {});
1247b5c07418SJames Feist }
1248b5c07418SJames Feist 
1249b5c07418SJames Feist void noOperation(crow::Response& res)
1250b5c07418SJames Feist {
1251b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1252b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noOperation());
1253cc9139ecSJason M. Bills }
1254cc9139ecSJason M. Bills 
1255cc9139ecSJason M. Bills /**
1256cc9139ecSJason M. Bills  * @internal
1257b5c07418SJames Feist  * @brief Formats PropertyUnknown message into JSON for the specified
1258b5c07418SJames Feist  * property
1259f12894f8SJason M. Bills  *
1260f12894f8SJason M. Bills  * See header file for more information
1261f12894f8SJason M. Bills  * @endinternal
1262f12894f8SJason M. Bills  */
12631668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1)
1264b5c07418SJames Feist {
1265fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyUnknown,
12661668ce6dSEd Tanous                   std::to_array({arg1}));
1267b5c07418SJames Feist }
1268b5c07418SJames Feist 
12691668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1)
1270f12894f8SJason M. Bills {
1271f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
12727b1dd2f9SEd Tanous     addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1));
1273f4c4dcf4SKowalski, Kamil }
1274f4c4dcf4SKowalski, Kamil 
1275f4c4dcf4SKowalski, Kamil /**
1276f4c4dcf4SKowalski, Kamil  * @internal
1277f4c4dcf4SKowalski, Kamil  * @brief Formats NoValidSession message into JSON
1278f4c4dcf4SKowalski, Kamil  *
1279f4c4dcf4SKowalski, Kamil  * See header file for more information
1280f4c4dcf4SKowalski, Kamil  * @endinternal
1281f4c4dcf4SKowalski, Kamil  */
1282b5c07418SJames Feist nlohmann::json noValidSession(void)
12831abe55efSEd Tanous {
1284fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::noValidSession, {});
1285b5c07418SJames Feist }
1286b5c07418SJames Feist 
1287b5c07418SJames Feist void noValidSession(crow::Response& res)
1288b5c07418SJames Feist {
1289b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1290b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noValidSession());
1291f4c4dcf4SKowalski, Kamil }
1292f4c4dcf4SKowalski, Kamil 
1293f4c4dcf4SKowalski, Kamil /**
1294f4c4dcf4SKowalski, Kamil  * @internal
1295f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidObject message into JSON
1296f4c4dcf4SKowalski, Kamil  *
1297f4c4dcf4SKowalski, Kamil  * See header file for more information
1298f4c4dcf4SKowalski, Kamil  * @endinternal
1299f4c4dcf4SKowalski, Kamil  */
1300ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1)
13011abe55efSEd Tanous {
13021668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
1303fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::invalidObject,
13041668ce6dSEd Tanous                   std::to_array({arg1str}));
1305b5c07418SJames Feist }
1306b5c07418SJames Feist 
1307ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1)
1308b5c07418SJames Feist {
1309b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1310b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
1311f4c4dcf4SKowalski, Kamil }
1312f4c4dcf4SKowalski, Kamil 
1313f4c4dcf4SKowalski, Kamil /**
1314f4c4dcf4SKowalski, Kamil  * @internal
1315f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInStandby message into JSON
1316f4c4dcf4SKowalski, Kamil  *
1317f4c4dcf4SKowalski, Kamil  * See header file for more information
1318f4c4dcf4SKowalski, Kamil  * @endinternal
1319f4c4dcf4SKowalski, Kamil  */
1320b5c07418SJames Feist nlohmann::json resourceInStandby(void)
13211abe55efSEd Tanous {
1322fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceInStandby, {});
1323b5c07418SJames Feist }
1324b5c07418SJames Feist 
1325b5c07418SJames Feist void resourceInStandby(crow::Response& res)
1326b5c07418SJames Feist {
1327b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1328b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInStandby());
1329f4c4dcf4SKowalski, Kamil }
1330f4c4dcf4SKowalski, Kamil 
1331f4c4dcf4SKowalski, Kamil /**
1332f4c4dcf4SKowalski, Kamil  * @internal
1333f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueTypeError message into JSON
1334f4c4dcf4SKowalski, Kamil  *
1335f4c4dcf4SKowalski, Kamil  * See header file for more information
1336f4c4dcf4SKowalski, Kamil  * @endinternal
1337f4c4dcf4SKowalski, Kamil  */
13381668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1,
13391668ce6dSEd Tanous                                              std::string_view arg2,
13401668ce6dSEd Tanous                                              std::string_view arg3)
13411abe55efSEd Tanous {
1342b6cd31e1SEd Tanous     return getLog(
1343fffb8c1fSEd Tanous         redfish::registries::base::Index::actionParameterValueTypeError,
13441668ce6dSEd Tanous         std::to_array({arg1, arg2, arg3}));
1345b5c07418SJames Feist }
1346b5c07418SJames Feist 
13471668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1,
13481668ce6dSEd Tanous                                    std::string_view arg2, std::string_view arg3)
1349b5c07418SJames Feist {
1350b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1351b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1352b5c07418SJames Feist                           actionParameterValueTypeError(arg1, arg2, arg3));
1353f4c4dcf4SKowalski, Kamil }
1354f4c4dcf4SKowalski, Kamil 
1355f4c4dcf4SKowalski, Kamil /**
1356f4c4dcf4SKowalski, Kamil  * @internal
1357f4c4dcf4SKowalski, Kamil  * @brief Formats SessionLimitExceeded message into JSON
1358f4c4dcf4SKowalski, Kamil  *
1359f4c4dcf4SKowalski, Kamil  * See header file for more information
1360f4c4dcf4SKowalski, Kamil  * @endinternal
1361f4c4dcf4SKowalski, Kamil  */
1362b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void)
13631abe55efSEd Tanous {
1364fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::sessionLimitExceeded, {});
1365b5c07418SJames Feist }
1366b5c07418SJames Feist 
1367b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res)
1368b5c07418SJames Feist {
1369b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1370b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
1371f4c4dcf4SKowalski, Kamil }
1372f4c4dcf4SKowalski, Kamil 
1373f4c4dcf4SKowalski, Kamil /**
1374f4c4dcf4SKowalski, Kamil  * @internal
1375f4c4dcf4SKowalski, Kamil  * @brief Formats ActionNotSupported message into JSON
1376f4c4dcf4SKowalski, Kamil  *
1377f4c4dcf4SKowalski, Kamil  * See header file for more information
1378f4c4dcf4SKowalski, Kamil  * @endinternal
1379f4c4dcf4SKowalski, Kamil  */
13801668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1)
13811abe55efSEd Tanous {
1382fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionNotSupported,
13831668ce6dSEd Tanous                   std::to_array({arg1}));
1384b5c07418SJames Feist }
1385b5c07418SJames Feist 
13861668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1)
1387b5c07418SJames Feist {
1388b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1389b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
1390f4c4dcf4SKowalski, Kamil }
1391f4c4dcf4SKowalski, Kamil 
1392f4c4dcf4SKowalski, Kamil /**
1393f4c4dcf4SKowalski, Kamil  * @internal
1394f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidIndex message into JSON
1395f4c4dcf4SKowalski, Kamil  *
1396f4c4dcf4SKowalski, Kamil  * See header file for more information
1397f4c4dcf4SKowalski, Kamil  * @endinternal
1398f4c4dcf4SKowalski, Kamil  */
13995187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1)
14001abe55efSEd Tanous {
1401b6cd31e1SEd Tanous     std::string arg1Str = std::to_string(arg1);
1402fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::invalidIndex,
14031668ce6dSEd Tanous                   std::to_array<std::string_view>({arg1Str}));
1404b5c07418SJames Feist }
1405b5c07418SJames Feist 
14065187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1)
1407b5c07418SJames Feist {
1408b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1409b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
1410f4c4dcf4SKowalski, Kamil }
1411f4c4dcf4SKowalski, Kamil 
1412f4c4dcf4SKowalski, Kamil /**
1413f4c4dcf4SKowalski, Kamil  * @internal
1414f4c4dcf4SKowalski, Kamil  * @brief Formats EmptyJSON message into JSON
1415f4c4dcf4SKowalski, Kamil  *
1416f4c4dcf4SKowalski, Kamil  * See header file for more information
1417f4c4dcf4SKowalski, Kamil  * @endinternal
1418f4c4dcf4SKowalski, Kamil  */
1419b5c07418SJames Feist nlohmann::json emptyJSON(void)
14201abe55efSEd Tanous {
1421fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::emptyJSON, {});
1422b5c07418SJames Feist }
1423b5c07418SJames Feist 
1424b5c07418SJames Feist void emptyJSON(crow::Response& res)
1425b5c07418SJames Feist {
1426b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1427b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, emptyJSON());
1428f4c4dcf4SKowalski, Kamil }
1429f4c4dcf4SKowalski, Kamil 
1430f4c4dcf4SKowalski, Kamil /**
1431f4c4dcf4SKowalski, Kamil  * @internal
1432f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupportedOnResource message into JSON
1433f4c4dcf4SKowalski, Kamil  *
1434f4c4dcf4SKowalski, Kamil  * See header file for more information
1435f4c4dcf4SKowalski, Kamil  * @endinternal
1436f4c4dcf4SKowalski, Kamil  */
1437b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void)
14381abe55efSEd Tanous {
1439fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryNotSupportedOnResource,
1440b6cd31e1SEd Tanous                   {});
1441b5c07418SJames Feist }
1442b5c07418SJames Feist 
1443b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res)
1444b5c07418SJames Feist {
14456a409c12SEd Tanous     res.result(boost::beast::http::status::bad_request);
1446b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
1447f4c4dcf4SKowalski, Kamil }
1448f4c4dcf4SKowalski, Kamil 
1449f4c4dcf4SKowalski, Kamil /**
1450f4c4dcf4SKowalski, Kamil  * @internal
1451684bb4b8SJason M. Bills  * @brief Formats QueryNotSupportedOnOperation message into JSON
1452684bb4b8SJason M. Bills  *
1453684bb4b8SJason M. Bills  * See header file for more information
1454684bb4b8SJason M. Bills  * @endinternal
1455684bb4b8SJason M. Bills  */
1456684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void)
1457684bb4b8SJason M. Bills {
1458b6cd31e1SEd Tanous     return getLog(
1459fffb8c1fSEd Tanous         redfish::registries::base::Index::queryNotSupportedOnOperation, {});
1460684bb4b8SJason M. Bills }
1461684bb4b8SJason M. Bills 
1462684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res)
1463684bb4b8SJason M. Bills {
14646a409c12SEd Tanous     res.result(boost::beast::http::status::bad_request);
1465684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
1466684bb4b8SJason M. Bills }
1467684bb4b8SJason M. Bills 
1468684bb4b8SJason M. Bills /**
1469684bb4b8SJason M. Bills  * @internal
1470684bb4b8SJason M. Bills  * @brief Formats QueryCombinationInvalid message into JSON
1471684bb4b8SJason M. Bills  *
1472684bb4b8SJason M. Bills  * See header file for more information
1473684bb4b8SJason M. Bills  * @endinternal
1474684bb4b8SJason M. Bills  */
1475684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void)
1476684bb4b8SJason M. Bills {
1477fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryCombinationInvalid,
1478fffb8c1fSEd Tanous                   {});
1479684bb4b8SJason M. Bills }
1480684bb4b8SJason M. Bills 
1481684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res)
1482684bb4b8SJason M. Bills {
1483684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1484684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
1485684bb4b8SJason M. Bills }
1486684bb4b8SJason M. Bills 
1487684bb4b8SJason M. Bills /**
1488684bb4b8SJason M. Bills  * @internal
1489f4c4dcf4SKowalski, Kamil  * @brief Formats InsufficientPrivilege message into JSON
1490f4c4dcf4SKowalski, Kamil  *
1491f4c4dcf4SKowalski, Kamil  * See header file for more information
1492f4c4dcf4SKowalski, Kamil  * @endinternal
1493f4c4dcf4SKowalski, Kamil  */
1494b5c07418SJames Feist nlohmann::json insufficientPrivilege(void)
14951abe55efSEd Tanous {
1496fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::insufficientPrivilege, {});
1497b5c07418SJames Feist }
1498b5c07418SJames Feist 
1499b5c07418SJames Feist void insufficientPrivilege(crow::Response& res)
1500b5c07418SJames Feist {
1501b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1502b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
1503f4c4dcf4SKowalski, Kamil }
1504f4c4dcf4SKowalski, Kamil 
1505f4c4dcf4SKowalski, Kamil /**
1506f4c4dcf4SKowalski, Kamil  * @internal
1507f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyValueModified message into JSON
1508f4c4dcf4SKowalski, Kamil  *
1509f4c4dcf4SKowalski, Kamil  * See header file for more information
1510f4c4dcf4SKowalski, Kamil  * @endinternal
1511f4c4dcf4SKowalski, Kamil  */
15121668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1,
15131668ce6dSEd Tanous                                      std::string_view arg2)
1514b5c07418SJames Feist {
1515fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueModified,
15161668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1517b5c07418SJames Feist }
1518b5c07418SJames Feist 
15191668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1,
15201668ce6dSEd Tanous                            std::string_view arg2)
15211abe55efSEd Tanous {
1522f12894f8SJason M. Bills     res.result(boost::beast::http::status::ok);
1523b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
1524f4c4dcf4SKowalski, Kamil }
1525f4c4dcf4SKowalski, Kamil 
1526f4c4dcf4SKowalski, Kamil /**
1527f4c4dcf4SKowalski, Kamil  * @internal
1528f4c4dcf4SKowalski, Kamil  * @brief Formats AccountNotModified message into JSON
1529f4c4dcf4SKowalski, Kamil  *
1530f4c4dcf4SKowalski, Kamil  * See header file for more information
1531f4c4dcf4SKowalski, Kamil  * @endinternal
1532f4c4dcf4SKowalski, Kamil  */
1533b5c07418SJames Feist nlohmann::json accountNotModified(void)
15341abe55efSEd Tanous {
1535fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountNotModified, {});
1536b5c07418SJames Feist }
1537b5c07418SJames Feist 
1538b5c07418SJames Feist void accountNotModified(crow::Response& res)
1539b5c07418SJames Feist {
1540b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1541b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountNotModified());
1542f4c4dcf4SKowalski, Kamil }
1543f4c4dcf4SKowalski, Kamil 
1544f4c4dcf4SKowalski, Kamil /**
1545f4c4dcf4SKowalski, Kamil  * @internal
1546f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueFormatError message into JSON
1547f4c4dcf4SKowalski, Kamil  *
1548f4c4dcf4SKowalski, Kamil  * See header file for more information
1549f4c4dcf4SKowalski, Kamil  * @endinternal
1550f4c4dcf4SKowalski, Kamil  */
15511668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1,
15521668ce6dSEd Tanous                                               std::string_view arg2)
15531abe55efSEd Tanous {
1554fffb8c1fSEd Tanous     return getLog(
1555fffb8c1fSEd Tanous         redfish::registries::base::Index::queryParameterValueFormatError,
15561668ce6dSEd Tanous         std::to_array({arg1, arg2}));
1557b5c07418SJames Feist }
1558b5c07418SJames Feist 
15591668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1,
15601668ce6dSEd Tanous                                     std::string_view arg2)
1561b5c07418SJames Feist {
1562b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1563b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1564b5c07418SJames Feist                           queryParameterValueFormatError(arg1, arg2));
1565f4c4dcf4SKowalski, Kamil }
1566f4c4dcf4SKowalski, Kamil 
1567f4c4dcf4SKowalski, Kamil /**
1568f4c4dcf4SKowalski, Kamil  * @internal
1569b5c07418SJames Feist  * @brief Formats PropertyMissing message into JSON for the specified
1570b5c07418SJames Feist  * property
1571f12894f8SJason M. Bills  *
1572f12894f8SJason M. Bills  * See header file for more information
1573f12894f8SJason M. Bills  * @endinternal
1574f12894f8SJason M. Bills  */
15751668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1)
1576f12894f8SJason M. Bills {
1577fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyMissing,
15781668ce6dSEd Tanous                   std::to_array({arg1}));
1579b5c07418SJames Feist }
1580b5c07418SJames Feist 
15811668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1)
1582b5c07418SJames Feist {
1583b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1584b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
1585f4c4dcf4SKowalski, Kamil }
1586f4c4dcf4SKowalski, Kamil 
1587f4c4dcf4SKowalski, Kamil /**
1588f4c4dcf4SKowalski, Kamil  * @internal
1589f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceExhaustion message into JSON
1590f4c4dcf4SKowalski, Kamil  *
1591f4c4dcf4SKowalski, Kamil  * See header file for more information
1592f4c4dcf4SKowalski, Kamil  * @endinternal
1593f4c4dcf4SKowalski, Kamil  */
15941668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1)
15951abe55efSEd Tanous {
1596fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceExhaustion,
15971668ce6dSEd Tanous                   std::to_array({arg1}));
1598b5c07418SJames Feist }
1599b5c07418SJames Feist 
16001668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1)
1601b5c07418SJames Feist {
1602b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1603b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
1604f4c4dcf4SKowalski, Kamil }
1605f4c4dcf4SKowalski, Kamil 
1606f4c4dcf4SKowalski, Kamil /**
1607f4c4dcf4SKowalski, Kamil  * @internal
1608f4c4dcf4SKowalski, Kamil  * @brief Formats AccountModified message into JSON
1609f4c4dcf4SKowalski, Kamil  *
1610f4c4dcf4SKowalski, Kamil  * See header file for more information
1611f4c4dcf4SKowalski, Kamil  * @endinternal
1612f4c4dcf4SKowalski, Kamil  */
1613b5c07418SJames Feist nlohmann::json accountModified(void)
16141abe55efSEd Tanous {
1615fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountModified, {});
1616b5c07418SJames Feist }
1617b5c07418SJames Feist 
1618b5c07418SJames Feist void accountModified(crow::Response& res)
1619b5c07418SJames Feist {
1620b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1621b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountModified());
1622f4c4dcf4SKowalski, Kamil }
1623f4c4dcf4SKowalski, Kamil 
1624f4c4dcf4SKowalski, Kamil /**
1625f4c4dcf4SKowalski, Kamil  * @internal
1626f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterOutOfRange message into JSON
1627f4c4dcf4SKowalski, Kamil  *
1628f4c4dcf4SKowalski, Kamil  * See header file for more information
1629f4c4dcf4SKowalski, Kamil  * @endinternal
1630f4c4dcf4SKowalski, Kamil  */
16311668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1,
16321668ce6dSEd Tanous                                         std::string_view arg2,
16331668ce6dSEd Tanous                                         std::string_view arg3)
16341abe55efSEd Tanous {
1635fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryParameterOutOfRange,
16361668ce6dSEd Tanous                   std::to_array({arg1, arg2, arg3}));
1637b5c07418SJames Feist }
1638b5c07418SJames Feist 
16391668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
16401668ce6dSEd Tanous                               std::string_view arg2, std::string_view arg3)
1641b5c07418SJames Feist {
1642b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1643b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1644b5c07418SJames Feist                           queryParameterOutOfRange(arg1, arg2, arg3));
1645f4c4dcf4SKowalski, Kamil }
1646f4c4dcf4SKowalski, Kamil 
1647b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1)
1648b6cd31e1SEd Tanous {
16491668ce6dSEd Tanous     std::string_view arg1str(arg1.data(), arg1.size());
1650fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::passwordChangeRequired,
16511668ce6dSEd Tanous                   std::to_array({arg1str}));
1652b6cd31e1SEd Tanous }
1653b6cd31e1SEd Tanous 
16543bf4e632SJoseph Reynolds /**
16553bf4e632SJoseph Reynolds  * @internal
16563bf4e632SJoseph Reynolds  * @brief Formats PasswordChangeRequired message into JSON
16573bf4e632SJoseph Reynolds  *
16583bf4e632SJoseph Reynolds  * See header file for more information
16593bf4e632SJoseph Reynolds  * @endinternal
16603bf4e632SJoseph Reynolds  */
1661ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res,
1662ace85d60SEd Tanous                             const boost::urls::url_view& arg1)
16633bf4e632SJoseph Reynolds {
1664b6cd31e1SEd Tanous     messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1));
16653bf4e632SJoseph Reynolds }
16663bf4e632SJoseph Reynolds 
16671668ce6dSEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1,
16681668ce6dSEd Tanous                    std::string_view arg2)
16694cde5d90SJames Feist {
16704cde5d90SJames Feist     res.result(boost::beast::http::status::bad_request);
16714cde5d90SJames Feist     addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2));
16724cde5d90SJames Feist }
16734cde5d90SJames Feist 
16744cde5d90SJames Feist /**
16754cde5d90SJames Feist  * @internal
16764cde5d90SJames Feist  * @brief Formats Invalid File message into JSON
16774cde5d90SJames Feist  *
16784cde5d90SJames Feist  * See header file for more information
16794cde5d90SJames Feist  * @endinternal
16804cde5d90SJames Feist  */
16811668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2)
16824cde5d90SJames Feist {
16831668ce6dSEd Tanous     std::string msg = "Invalid file uploaded to ";
16841668ce6dSEd Tanous     msg += arg1;
16851668ce6dSEd Tanous     msg += ": ";
16861668ce6dSEd Tanous     msg += arg2;
16871668ce6dSEd Tanous     msg += ".";
16884cde5d90SJames Feist     return nlohmann::json{
16893e082749SAsmitha Karunanithi         {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"},
16904a0bf539SManojkiran Eda         {"MessageId", "OpenBMC.0.2.InvalidUpload"},
16911668ce6dSEd Tanous         {"Message", std::move(msg)},
16924cde5d90SJames Feist         {"MessageArgs", {arg1, arg2}},
1693684bb4b8SJason M. Bills         {"MessageSeverity", "Warning"},
16944cde5d90SJames Feist         {"Resolution", "None."}};
16954cde5d90SJames Feist }
1696f4c4dcf4SKowalski, Kamil } // namespace messages
1697f4c4dcf4SKowalski, Kamil 
1698d425c6f6SEd Tanous } // namespace redfish
1699