xref: /openbmc/bmcweb/features/redfish/src/error_messages.cpp (revision 034e1259223252624a4652bc0288058bdd4da9b8)
1f4c4dcf4SKowalski, Kamil /*
26be832e2SEd Tanous Copyright (c) 2018 Intel Corporation
36be832e2SEd Tanous 
46be832e2SEd Tanous Licensed under the Apache License, Version 2.0 (the "License");
56be832e2SEd Tanous you may not use this file except in compliance with the License.
66be832e2SEd Tanous You may obtain a copy of the License at
76be832e2SEd Tanous 
86be832e2SEd Tanous       http://www.apache.org/licenses/LICENSE-2.0
96be832e2SEd Tanous 
106be832e2SEd Tanous Unless required by applicable law or agreed to in writing, software
116be832e2SEd Tanous distributed under the License is distributed on an "AS IS" BASIS,
126be832e2SEd Tanous WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136be832e2SEd Tanous See the License for the specific language governing permissions and
146be832e2SEd Tanous limitations under the License.
15f4c4dcf4SKowalski, Kamil */
160442ef92SNan Zhou #include "error_messages.hpp"
179ea15c35SEd Tanous 
180442ef92SNan Zhou #include "http_response.hpp"
190442ef92SNan Zhou #include "logging.hpp"
200442ef92SNan Zhou #include "registries.hpp"
210442ef92SNan Zhou #include "registries/base_message_registry.hpp"
220442ef92SNan Zhou 
230442ef92SNan Zhou #include <boost/beast/http/field.hpp>
249ea15c35SEd Tanous #include <boost/beast/http/status.hpp>
254a7fbefdSEd Tanous #include <boost/url/url_view_base.hpp>
26faf100f9SEd Tanous #include <nlohmann/json.hpp>
27f4c4dcf4SKowalski, Kamil 
281668ce6dSEd Tanous #include <array>
290442ef92SNan Zhou #include <cstddef>
30f0b59af4SEd Tanous #include <cstdint>
31d85418e3SPatrick Williams #include <source_location>
320442ef92SNan Zhou #include <span>
330442ef92SNan Zhou #include <string>
34f0b59af4SEd Tanous #include <string_view>
350442ef92SNan Zhou #include <utility>
360442ef92SNan Zhou 
371abe55efSEd Tanous namespace redfish
381abe55efSEd Tanous {
391abe55efSEd Tanous 
401abe55efSEd Tanous namespace messages
411abe55efSEd Tanous {
42f4c4dcf4SKowalski, Kamil 
43f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target,
441abe55efSEd Tanous                                   const nlohmann::json& message)
451abe55efSEd Tanous {
46f4c4dcf4SKowalski, Kamil     auto& error = target["error"];
47f4c4dcf4SKowalski, Kamil 
481abe55efSEd Tanous     // If this is the first error message, fill in the information from the
491abe55efSEd Tanous     // first error message to the top level struct
501abe55efSEd Tanous     if (!error.is_object())
511abe55efSEd Tanous     {
52c074230bSJason M. Bills         auto messageIdIterator = message.find("MessageId");
53c074230bSJason M. Bills         if (messageIdIterator == message.end())
541abe55efSEd Tanous         {
5562598e31SEd Tanous             BMCWEB_LOG_CRITICAL(
5662598e31SEd Tanous                 "Attempt to add error message without MessageId");
57f4c4dcf4SKowalski, Kamil             return;
58f4c4dcf4SKowalski, Kamil         }
59f4c4dcf4SKowalski, Kamil 
60c074230bSJason M. Bills         auto messageFieldIterator = message.find("Message");
61c074230bSJason M. Bills         if (messageFieldIterator == message.end())
621abe55efSEd Tanous         {
6362598e31SEd Tanous             BMCWEB_LOG_CRITICAL("Attempt to add error message without Message");
64f4c4dcf4SKowalski, Kamil             return;
65f4c4dcf4SKowalski, Kamil         }
661476687dSEd Tanous         error["code"] = *messageIdIterator;
671476687dSEd Tanous         error["message"] = *messageFieldIterator;
681abe55efSEd Tanous     }
691abe55efSEd Tanous     else
701abe55efSEd Tanous     {
71f4c4dcf4SKowalski, Kamil         // More than 1 error occurred, so the message has to be generic
7255c7b7a2SEd Tanous         error["code"] = std::string(messageVersionPrefix) + "GeneralError";
73cc9139ecSJason M. Bills         error["message"] = "A general error has occurred. See Resolution for "
74cc9139ecSJason M. Bills                            "information on how to resolve the error.";
75f4c4dcf4SKowalski, Kamil     }
76f4c4dcf4SKowalski, Kamil 
773590bd1dSNan Zhou     // This check could technically be done in the default construction
78f4c4dcf4SKowalski, Kamil     // branch above, but because we need the pointer to the extended info field
79f4c4dcf4SKowalski, Kamil     // anyway, it's more efficient to do it here.
80c074230bSJason M. Bills     auto& extendedInfo = error[messages::messageAnnotation];
81c074230bSJason M. Bills     if (!extendedInfo.is_array())
821abe55efSEd Tanous     {
83c074230bSJason M. Bills         extendedInfo = nlohmann::json::array();
84f4c4dcf4SKowalski, Kamil     }
85f4c4dcf4SKowalski, Kamil 
86c074230bSJason M. Bills     extendedInfo.push_back(message);
87f4c4dcf4SKowalski, Kamil }
88f4c4dcf4SKowalski, Kamil 
893590bd1dSNan Zhou void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source)
903590bd1dSNan Zhou {
913590bd1dSNan Zhou     if (!source.is_object())
923590bd1dSNan Zhou     {
933590bd1dSNan Zhou         return;
943590bd1dSNan Zhou     }
953590bd1dSNan Zhou     auto errorIt = source.find("error");
963590bd1dSNan Zhou     if (errorIt == source.end())
973590bd1dSNan Zhou     {
983590bd1dSNan Zhou         // caller puts error message in root
993590bd1dSNan Zhou         messages::addMessageToErrorJson(target, source);
1003590bd1dSNan Zhou         source.clear();
1013590bd1dSNan Zhou         return;
1023590bd1dSNan Zhou     }
1033590bd1dSNan Zhou     auto extendedInfoIt = errorIt->find(messages::messageAnnotation);
1043590bd1dSNan Zhou     if (extendedInfoIt == errorIt->end())
1053590bd1dSNan Zhou     {
1063590bd1dSNan Zhou         return;
1073590bd1dSNan Zhou     }
1083590bd1dSNan Zhou     const nlohmann::json::array_t* extendedInfo =
1093590bd1dSNan Zhou         (*extendedInfoIt).get_ptr<const nlohmann::json::array_t*>();
1103590bd1dSNan Zhou     if (extendedInfo == nullptr)
1113590bd1dSNan Zhou     {
1123590bd1dSNan Zhou         source.erase(errorIt);
1133590bd1dSNan Zhou         return;
1143590bd1dSNan Zhou     }
1153590bd1dSNan Zhou     for (const nlohmann::json& message : *extendedInfo)
1163590bd1dSNan Zhou     {
1173590bd1dSNan Zhou         addMessageToErrorJson(target, message);
1183590bd1dSNan Zhou     }
1193590bd1dSNan Zhou     source.erase(errorIt);
1203590bd1dSNan Zhou }
1213590bd1dSNan Zhou 
122f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target,
123f12894f8SJason M. Bills                                  const nlohmann::json& message)
1241abe55efSEd Tanous {
1251abe55efSEd Tanous     if (!target[messages::messageAnnotation].is_array())
1261abe55efSEd Tanous     {
127f4c4dcf4SKowalski, Kamil         // Force object to be an array
12855c7b7a2SEd Tanous         target[messages::messageAnnotation] = nlohmann::json::array();
129f4c4dcf4SKowalski, Kamil     }
130f4c4dcf4SKowalski, Kamil 
13155c7b7a2SEd Tanous     target[messages::messageAnnotation].push_back(message);
132f4c4dcf4SKowalski, Kamil }
133f4c4dcf4SKowalski, Kamil 
134f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target,
135f12894f8SJason M. Bills                              const nlohmann::json& message,
1361668ce6dSEd Tanous                              std::string_view fieldPath)
1371abe55efSEd Tanous {
1381668ce6dSEd Tanous     std::string extendedInfo(fieldPath);
1391668ce6dSEd Tanous     extendedInfo += messages::messageAnnotation;
140f4c4dcf4SKowalski, Kamil 
1411668ce6dSEd Tanous     nlohmann::json& field = target[extendedInfo];
1421668ce6dSEd Tanous     if (!field.is_array())
1431abe55efSEd Tanous     {
144f4c4dcf4SKowalski, Kamil         // Force object to be an array
1451668ce6dSEd Tanous         field = nlohmann::json::array();
146f4c4dcf4SKowalski, Kamil     }
147f4c4dcf4SKowalski, Kamil 
148f4c4dcf4SKowalski, Kamil     // Object exists and it is an array so we can just push in the message
1491668ce6dSEd Tanous     field.push_back(message);
150f4c4dcf4SKowalski, Kamil }
151f4c4dcf4SKowalski, Kamil 
152f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name,
153b6cd31e1SEd Tanous                              std::span<const std::string_view> args)
154b6cd31e1SEd Tanous {
155b6cd31e1SEd Tanous     size_t index = static_cast<size_t>(name);
156fffb8c1fSEd Tanous     if (index >= redfish::registries::base::registry.size())
157b6cd31e1SEd Tanous     {
158b6cd31e1SEd Tanous         return {};
159b6cd31e1SEd Tanous     }
16065e4f1f7SEd Tanous     return getLogFromRegistry(redfish::registries::base::header,
16165e4f1f7SEd Tanous                               redfish::registries::base::registry, index, args);
162b6cd31e1SEd Tanous }
163b6cd31e1SEd Tanous 
164f4c4dcf4SKowalski, Kamil /**
165f4c4dcf4SKowalski, Kamil  * @internal
166f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInUse message into JSON
167f4c4dcf4SKowalski, Kamil  *
168f4c4dcf4SKowalski, Kamil  * See header file for more information
169f4c4dcf4SKowalski, Kamil  * @endinternal
170f4c4dcf4SKowalski, Kamil  */
171d9fcfcc1SEd Tanous nlohmann::json resourceInUse()
1721abe55efSEd Tanous {
173fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceInUse, {});
174b5c07418SJames Feist }
175b5c07418SJames Feist 
176b5c07418SJames Feist void resourceInUse(crow::Response& res)
177b5c07418SJames Feist {
178b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
179b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInUse());
180f4c4dcf4SKowalski, Kamil }
181f4c4dcf4SKowalski, Kamil 
182f4c4dcf4SKowalski, Kamil /**
183f4c4dcf4SKowalski, Kamil  * @internal
184f4c4dcf4SKowalski, Kamil  * @brief Formats MalformedJSON message into JSON
185f4c4dcf4SKowalski, Kamil  *
186f4c4dcf4SKowalski, Kamil  * See header file for more information
187f4c4dcf4SKowalski, Kamil  * @endinternal
188f4c4dcf4SKowalski, Kamil  */
189d9fcfcc1SEd Tanous nlohmann::json malformedJSON()
1901abe55efSEd Tanous {
191fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::malformedJSON, {});
192b5c07418SJames Feist }
193b5c07418SJames Feist 
194b5c07418SJames Feist void malformedJSON(crow::Response& res)
195b5c07418SJames Feist {
196b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
197b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, malformedJSON());
198f4c4dcf4SKowalski, Kamil }
199f4c4dcf4SKowalski, Kamil 
200f4c4dcf4SKowalski, Kamil /**
201f4c4dcf4SKowalski, Kamil  * @internal
202f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceMissingAtURI message into JSON
203f4c4dcf4SKowalski, Kamil  *
204f4c4dcf4SKowalski, Kamil  * See header file for more information
205f4c4dcf4SKowalski, Kamil  * @endinternal
206f4c4dcf4SKowalski, Kamil  */
2074a7fbefdSEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1)
2081abe55efSEd Tanous {
209079360aeSEd Tanous     std::array<std::string_view, 1> args{arg1.buffer()};
210fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceMissingAtURI, args);
211b5c07418SJames Feist }
212b5c07418SJames Feist 
2134a7fbefdSEd Tanous void resourceMissingAtURI(crow::Response& res,
2144a7fbefdSEd Tanous                           const boost::urls::url_view_base& arg1)
215b5c07418SJames Feist {
216b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
217b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
218f4c4dcf4SKowalski, Kamil }
219f4c4dcf4SKowalski, Kamil 
220f4c4dcf4SKowalski, Kamil /**
221f4c4dcf4SKowalski, Kamil  * @internal
222f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueFormatError message into JSON
223f4c4dcf4SKowalski, Kamil  *
224f4c4dcf4SKowalski, Kamil  * See header file for more information
225f4c4dcf4SKowalski, Kamil  * @endinternal
226f4c4dcf4SKowalski, Kamil  */
227bd79bce8SPatrick Williams nlohmann::json actionParameterValueFormatError(
228bd79bce8SPatrick Williams     const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
2291abe55efSEd Tanous {
230bd79bce8SPatrick Williams     std::string arg1Str =
231*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
232fffb8c1fSEd Tanous     return getLog(
233fffb8c1fSEd Tanous         redfish::registries::base::Index::actionParameterValueFormatError,
23495b3ad73SEd Tanous         std::to_array<std::string_view>({arg1Str, arg2, arg3}));
235b5c07418SJames Feist }
236b5c07418SJames Feist 
237bd79bce8SPatrick Williams void actionParameterValueFormatError(
238bd79bce8SPatrick Williams     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
2391668ce6dSEd Tanous     std::string_view arg3)
240b5c07418SJames Feist {
241b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
242b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
243b5c07418SJames Feist                           actionParameterValueFormatError(arg1, arg2, arg3));
244f4c4dcf4SKowalski, Kamil }
245f4c4dcf4SKowalski, Kamil 
246f4c4dcf4SKowalski, Kamil /**
247f4c4dcf4SKowalski, Kamil  * @internal
2484ef82a15SAlex Schendel  * @brief Formats ActionParameterValueNotInList message into JSON
2494ef82a15SAlex Schendel  *
2504ef82a15SAlex Schendel  * See header file for more information
2514ef82a15SAlex Schendel  * @endinternal
2524ef82a15SAlex Schendel  */
253bd79bce8SPatrick Williams nlohmann::json actionParameterValueNotInList(
254bd79bce8SPatrick Williams     std::string_view arg1, std::string_view arg2, std::string_view arg3)
2554ef82a15SAlex Schendel {
2564ef82a15SAlex Schendel     return getLog(
2574ef82a15SAlex Schendel         redfish::registries::base::Index::actionParameterValueNotInList,
2584ef82a15SAlex Schendel         std::to_array({arg1, arg2, arg3}));
2594ef82a15SAlex Schendel }
2604ef82a15SAlex Schendel 
2614ef82a15SAlex Schendel void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
2624ef82a15SAlex Schendel                                    std::string_view arg2, std::string_view arg3)
2634ef82a15SAlex Schendel {
2644ef82a15SAlex Schendel     res.result(boost::beast::http::status::bad_request);
2654ef82a15SAlex Schendel     addMessageToErrorJson(res.jsonValue,
2664ef82a15SAlex Schendel                           actionParameterValueNotInList(arg1, arg2, arg3));
2674ef82a15SAlex Schendel }
2684ef82a15SAlex Schendel 
2694ef82a15SAlex Schendel /**
2704ef82a15SAlex Schendel  * @internal
271f4c4dcf4SKowalski, Kamil  * @brief Formats InternalError message into JSON
272f4c4dcf4SKowalski, Kamil  *
273f4c4dcf4SKowalski, Kamil  * See header file for more information
274f4c4dcf4SKowalski, Kamil  * @endinternal
275f4c4dcf4SKowalski, Kamil  */
276d9fcfcc1SEd Tanous nlohmann::json internalError()
2771abe55efSEd Tanous {
278fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::internalError, {});
279b5c07418SJames Feist }
280b5c07418SJames Feist 
281d85418e3SPatrick Williams void internalError(crow::Response& res, const std::source_location location)
282b5c07418SJames Feist {
28362598e31SEd Tanous     BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
28462598e31SEd Tanous                         location.line(), location.column(),
28562598e31SEd Tanous                         location.function_name());
286b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
287b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, internalError());
288f12894f8SJason M. Bills }
289f12894f8SJason M. Bills 
290f12894f8SJason M. Bills /**
291f12894f8SJason M. Bills  * @internal
292f4c4dcf4SKowalski, Kamil  * @brief Formats UnrecognizedRequestBody message into JSON
293f4c4dcf4SKowalski, Kamil  *
294f4c4dcf4SKowalski, Kamil  * See header file for more information
295f4c4dcf4SKowalski, Kamil  * @endinternal
296f4c4dcf4SKowalski, Kamil  */
297d9fcfcc1SEd Tanous nlohmann::json unrecognizedRequestBody()
2981abe55efSEd Tanous {
299fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::unrecognizedRequestBody,
300fffb8c1fSEd Tanous                   {});
301b5c07418SJames Feist }
302b5c07418SJames Feist 
303b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res)
304b5c07418SJames Feist {
305b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
306b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
307f4c4dcf4SKowalski, Kamil }
308f4c4dcf4SKowalski, Kamil 
309f4c4dcf4SKowalski, Kamil /**
310f4c4dcf4SKowalski, Kamil  * @internal
311f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriUnauthorized message into JSON
312f4c4dcf4SKowalski, Kamil  *
313f4c4dcf4SKowalski, Kamil  * See header file for more information
314f4c4dcf4SKowalski, Kamil  * @endinternal
315f4c4dcf4SKowalski, Kamil  */
3164a7fbefdSEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1,
3171668ce6dSEd Tanous                                          std::string_view arg2)
3181abe55efSEd Tanous {
319079360aeSEd Tanous     return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized,
320079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer(), arg2}));
321b5c07418SJames Feist }
322b5c07418SJames Feist 
3234a7fbefdSEd Tanous void resourceAtUriUnauthorized(crow::Response& res,
3244a7fbefdSEd Tanous                                const boost::urls::url_view_base& arg1,
3251668ce6dSEd Tanous                                std::string_view arg2)
326b5c07418SJames Feist {
327b5c07418SJames Feist     res.result(boost::beast::http::status::unauthorized);
328b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
329f4c4dcf4SKowalski, Kamil }
330f4c4dcf4SKowalski, Kamil 
331f4c4dcf4SKowalski, Kamil /**
332f4c4dcf4SKowalski, Kamil  * @internal
333f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterUnknown message into JSON
334f4c4dcf4SKowalski, Kamil  *
335f4c4dcf4SKowalski, Kamil  * See header file for more information
336f4c4dcf4SKowalski, Kamil  * @endinternal
337f4c4dcf4SKowalski, Kamil  */
3381668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1,
3391668ce6dSEd Tanous                                       std::string_view arg2)
340b5c07418SJames Feist {
341fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterUnknown,
3421668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
343b5c07418SJames Feist }
344b5c07418SJames Feist 
3451668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1,
3461668ce6dSEd Tanous                             std::string_view arg2)
3471abe55efSEd Tanous {
348f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
349b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
350f4c4dcf4SKowalski, Kamil }
351f4c4dcf4SKowalski, Kamil 
352f4c4dcf4SKowalski, Kamil /**
353f4c4dcf4SKowalski, Kamil  * @internal
354f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceCannotBeDeleted message into JSON
355f4c4dcf4SKowalski, Kamil  *
356f4c4dcf4SKowalski, Kamil  * See header file for more information
357f4c4dcf4SKowalski, Kamil  * @endinternal
358f4c4dcf4SKowalski, Kamil  */
359d9fcfcc1SEd Tanous nlohmann::json resourceCannotBeDeleted()
3601abe55efSEd Tanous {
361fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceCannotBeDeleted,
362fffb8c1fSEd Tanous                   {});
363b5c07418SJames Feist }
364b5c07418SJames Feist 
365b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res)
366b5c07418SJames Feist {
36744c70412SEd Tanous     res.result(boost::beast::http::status::method_not_allowed);
368b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
369f4c4dcf4SKowalski, Kamil }
370f4c4dcf4SKowalski, Kamil 
371f4c4dcf4SKowalski, Kamil /**
372f4c4dcf4SKowalski, Kamil  * @internal
373f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyDuplicate message into JSON
374f4c4dcf4SKowalski, Kamil  *
375f4c4dcf4SKowalski, Kamil  * See header file for more information
376f4c4dcf4SKowalski, Kamil  * @endinternal
377f4c4dcf4SKowalski, Kamil  */
3781668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1)
3791abe55efSEd Tanous {
380fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyDuplicate,
3811668ce6dSEd Tanous                   std::to_array({arg1}));
382b5c07418SJames Feist }
383b5c07418SJames Feist 
3841668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1)
385b5c07418SJames Feist {
386b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
387b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1);
388f4c4dcf4SKowalski, Kamil }
389f4c4dcf4SKowalski, Kamil 
390f4c4dcf4SKowalski, Kamil /**
391f4c4dcf4SKowalski, Kamil  * @internal
392f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceTemporarilyUnavailable message into JSON
393f4c4dcf4SKowalski, Kamil  *
394f4c4dcf4SKowalski, Kamil  * See header file for more information
395f4c4dcf4SKowalski, Kamil  * @endinternal
396f4c4dcf4SKowalski, Kamil  */
3971668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1)
3981abe55efSEd Tanous {
399b6cd31e1SEd Tanous     return getLog(
400fffb8c1fSEd Tanous         redfish::registries::base::Index::serviceTemporarilyUnavailable,
4011668ce6dSEd Tanous         std::to_array({arg1}));
402b5c07418SJames Feist }
403b5c07418SJames Feist 
4041668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1)
405b5c07418SJames Feist {
406d9f6c621SEd Tanous     res.addHeader(boost::beast::http::field::retry_after, arg1);
407b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
408b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
409f4c4dcf4SKowalski, Kamil }
410f4c4dcf4SKowalski, Kamil 
411f4c4dcf4SKowalski, Kamil /**
412f4c4dcf4SKowalski, Kamil  * @internal
413f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAlreadyExists message into JSON
414f4c4dcf4SKowalski, Kamil  *
415f4c4dcf4SKowalski, Kamil  * See header file for more information
416f4c4dcf4SKowalski, Kamil  * @endinternal
417f4c4dcf4SKowalski, Kamil  */
418bd79bce8SPatrick Williams nlohmann::json resourceAlreadyExists(
419bd79bce8SPatrick Williams     std::string_view arg1, std::string_view arg2, std::string_view arg3)
4201abe55efSEd Tanous {
421fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceAlreadyExists,
4221668ce6dSEd Tanous                   std::to_array({arg1, arg2, arg3}));
423b5c07418SJames Feist }
424b5c07418SJames Feist 
4251668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
4261668ce6dSEd Tanous                            std::string_view arg2, std::string_view arg3)
427b5c07418SJames Feist {
428b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
429b5c07418SJames Feist     addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
430a08b46ccSJason M. Bills                      arg2);
431f4c4dcf4SKowalski, Kamil }
432f4c4dcf4SKowalski, Kamil 
433f4c4dcf4SKowalski, Kamil /**
434f4c4dcf4SKowalski, Kamil  * @internal
435f4c4dcf4SKowalski, Kamil  * @brief Formats AccountForSessionNoLongerExists message into JSON
436f4c4dcf4SKowalski, Kamil  *
437f4c4dcf4SKowalski, Kamil  * See header file for more information
438f4c4dcf4SKowalski, Kamil  * @endinternal
439f4c4dcf4SKowalski, Kamil  */
440d9fcfcc1SEd Tanous nlohmann::json accountForSessionNoLongerExists()
4411abe55efSEd Tanous {
442fffb8c1fSEd Tanous     return getLog(
443fffb8c1fSEd Tanous         redfish::registries::base::Index::accountForSessionNoLongerExists, {});
444b5c07418SJames Feist }
445b5c07418SJames Feist 
446b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res)
447b5c07418SJames Feist {
448b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
449b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
450f4c4dcf4SKowalski, Kamil }
451f4c4dcf4SKowalski, Kamil 
452f4c4dcf4SKowalski, Kamil /**
453f4c4dcf4SKowalski, Kamil  * @internal
454f4c4dcf4SKowalski, Kamil  * @brief Formats CreateFailedMissingReqProperties message into JSON
455f4c4dcf4SKowalski, Kamil  *
456f4c4dcf4SKowalski, Kamil  * See header file for more information
457f4c4dcf4SKowalski, Kamil  * @endinternal
458f4c4dcf4SKowalski, Kamil  */
4591668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1)
4601abe55efSEd Tanous {
461fffb8c1fSEd Tanous     return getLog(
462fffb8c1fSEd Tanous         redfish::registries::base::Index::createFailedMissingReqProperties,
4631668ce6dSEd Tanous         std::to_array({arg1}));
464b5c07418SJames Feist }
465b5c07418SJames Feist 
466b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res,
4671668ce6dSEd Tanous                                       std::string_view arg1)
468b5c07418SJames Feist {
469b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
470b5c07418SJames Feist     addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
471a08b46ccSJason M. Bills                      arg1);
472f12894f8SJason M. Bills }
473f12894f8SJason M. Bills 
474f12894f8SJason M. Bills /**
475f12894f8SJason M. Bills  * @internal
476f12894f8SJason M. Bills  * @brief Formats PropertyValueFormatError message into JSON for the specified
477f12894f8SJason M. Bills  * property
478f12894f8SJason M. Bills  *
479f12894f8SJason M. Bills  * See header file for more information
480f12894f8SJason M. Bills  * @endinternal
481f12894f8SJason M. Bills  */
482f818b04dSEd Tanous nlohmann::json propertyValueFormatError(const nlohmann::json& arg1,
4831668ce6dSEd Tanous                                         std::string_view arg2)
484f12894f8SJason M. Bills {
485bd79bce8SPatrick Williams     std::string arg1Str =
486*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
487fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueFormatError,
488f818b04dSEd Tanous                   std::to_array<std::string_view>({arg1Str, arg2}));
489b5c07418SJames Feist }
490b5c07418SJames Feist 
491f818b04dSEd Tanous void propertyValueFormatError(crow::Response& res, const nlohmann::json& arg1,
4921668ce6dSEd Tanous                               std::string_view arg2)
493b5c07418SJames Feist {
494b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
495b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2);
496f12894f8SJason M. Bills }
497f12894f8SJason M. Bills 
498f12894f8SJason M. Bills /**
499f12894f8SJason M. Bills  * @internal
500f12894f8SJason M. Bills  * @brief Formats PropertyValueNotInList message into JSON for the specified
501f12894f8SJason M. Bills  * property
502f12894f8SJason M. Bills  *
503f12894f8SJason M. Bills  * See header file for more information
504f12894f8SJason M. Bills  * @endinternal
505f12894f8SJason M. Bills  */
506e2616cc5SEd Tanous 
507e2616cc5SEd Tanous nlohmann::json propertyValueNotInList(const nlohmann::json& arg1,
5081668ce6dSEd Tanous                                       std::string_view arg2)
509f12894f8SJason M. Bills {
510bd79bce8SPatrick Williams     std::string arg1Str =
511bd79bce8SPatrick Williams         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
512fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueNotInList,
513e2616cc5SEd Tanous                   std::to_array<std::string_view>({arg1Str, arg2}));
514b5c07418SJames Feist }
515b5c07418SJames Feist 
516e2616cc5SEd Tanous void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1,
5171668ce6dSEd Tanous                             std::string_view arg2)
518b5c07418SJames Feist {
519b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
520b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2);
521f4c4dcf4SKowalski, Kamil }
522f4c4dcf4SKowalski, Kamil 
523f4c4dcf4SKowalski, Kamil /**
524f4c4dcf4SKowalski, Kamil  * @internal
525227a2b0aSJiaqing Zhao  * @brief Formats PropertyValueOutOfRange message into JSON
526227a2b0aSJiaqing Zhao  *
527227a2b0aSJiaqing Zhao  * See header file for more information
528227a2b0aSJiaqing Zhao  * @endinternal
529227a2b0aSJiaqing Zhao  */
53095b3ad73SEd Tanous nlohmann::json propertyValueOutOfRange(const nlohmann::json& arg1,
531227a2b0aSJiaqing Zhao                                        std::string_view arg2)
532227a2b0aSJiaqing Zhao {
533bd79bce8SPatrick Williams     std::string arg1Str =
534*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
535227a2b0aSJiaqing Zhao     return getLog(redfish::registries::base::Index::propertyValueOutOfRange,
53695b3ad73SEd Tanous                   std::to_array<std::string_view>({arg1Str, arg2}));
537227a2b0aSJiaqing Zhao }
538227a2b0aSJiaqing Zhao 
53995b3ad73SEd Tanous void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1,
540227a2b0aSJiaqing Zhao                              std::string_view arg2)
541227a2b0aSJiaqing Zhao {
542227a2b0aSJiaqing Zhao     res.result(boost::beast::http::status::bad_request);
543227a2b0aSJiaqing Zhao     addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2));
544227a2b0aSJiaqing Zhao }
545227a2b0aSJiaqing Zhao 
546227a2b0aSJiaqing Zhao /**
547227a2b0aSJiaqing Zhao  * @internal
548f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
549f4c4dcf4SKowalski, Kamil  *
550f4c4dcf4SKowalski, Kamil  * See header file for more information
551f4c4dcf4SKowalski, Kamil  * @endinternal
552f4c4dcf4SKowalski, Kamil  */
5534a7fbefdSEd Tanous nlohmann::json
5544a7fbefdSEd Tanous     resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1)
5551abe55efSEd Tanous {
556b6cd31e1SEd Tanous     return getLog(
557fffb8c1fSEd Tanous         redfish::registries::base::Index::resourceAtUriInUnknownFormat,
558079360aeSEd Tanous         std::to_array<std::string_view>({arg1.buffer()}));
559b5c07418SJames Feist }
560b5c07418SJames Feist 
561ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res,
5624a7fbefdSEd Tanous                                   const boost::urls::url_view_base& arg1)
563b5c07418SJames Feist {
564b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
565b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
566f4c4dcf4SKowalski, Kamil }
567f4c4dcf4SKowalski, Kamil 
568f4c4dcf4SKowalski, Kamil /**
569f4c4dcf4SKowalski, Kamil  * @internal
57081856681SAsmitha Karunanithi  * @brief Formats ServiceDisabled message into JSON
57181856681SAsmitha Karunanithi  *
57281856681SAsmitha Karunanithi  * See header file for more information
57381856681SAsmitha Karunanithi  * @endinternal
57481856681SAsmitha Karunanithi  */
5751668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1)
57681856681SAsmitha Karunanithi {
577fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceDisabled,
5781668ce6dSEd Tanous                   std::to_array({arg1}));
57981856681SAsmitha Karunanithi }
58081856681SAsmitha Karunanithi 
5811668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1)
58281856681SAsmitha Karunanithi {
58381856681SAsmitha Karunanithi     res.result(boost::beast::http::status::service_unavailable);
58481856681SAsmitha Karunanithi     addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1));
58581856681SAsmitha Karunanithi }
58681856681SAsmitha Karunanithi 
58781856681SAsmitha Karunanithi /**
58881856681SAsmitha Karunanithi  * @internal
589f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceInUnknownState message into JSON
590f4c4dcf4SKowalski, Kamil  *
591f4c4dcf4SKowalski, Kamil  * See header file for more information
592f4c4dcf4SKowalski, Kamil  * @endinternal
593f4c4dcf4SKowalski, Kamil  */
594d9fcfcc1SEd Tanous nlohmann::json serviceInUnknownState()
5951abe55efSEd Tanous {
596fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceInUnknownState, {});
597b5c07418SJames Feist }
598b5c07418SJames Feist 
599b5c07418SJames Feist void serviceInUnknownState(crow::Response& res)
600b5c07418SJames Feist {
601b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
602b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
603f4c4dcf4SKowalski, Kamil }
604f4c4dcf4SKowalski, Kamil 
605f4c4dcf4SKowalski, Kamil /**
606f4c4dcf4SKowalski, Kamil  * @internal
607f4c4dcf4SKowalski, Kamil  * @brief Formats EventSubscriptionLimitExceeded message into JSON
608f4c4dcf4SKowalski, Kamil  *
609f4c4dcf4SKowalski, Kamil  * See header file for more information
610f4c4dcf4SKowalski, Kamil  * @endinternal
611f4c4dcf4SKowalski, Kamil  */
612d9fcfcc1SEd Tanous nlohmann::json eventSubscriptionLimitExceeded()
6131abe55efSEd Tanous {
614fffb8c1fSEd Tanous     return getLog(
615fffb8c1fSEd Tanous         redfish::registries::base::Index::eventSubscriptionLimitExceeded, {});
616b5c07418SJames Feist }
617b5c07418SJames Feist 
618b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res)
619b5c07418SJames Feist {
620789fdab3SEd Tanous     res.result(boost::beast::http::status::service_unavailable);
621b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
622f4c4dcf4SKowalski, Kamil }
623f4c4dcf4SKowalski, Kamil 
624f4c4dcf4SKowalski, Kamil /**
625f4c4dcf4SKowalski, Kamil  * @internal
626f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterMissing message into JSON
627f4c4dcf4SKowalski, Kamil  *
628f4c4dcf4SKowalski, Kamil  * See header file for more information
629f4c4dcf4SKowalski, Kamil  * @endinternal
630f4c4dcf4SKowalski, Kamil  */
6311668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1,
6321668ce6dSEd Tanous                                       std::string_view arg2)
6331abe55efSEd Tanous {
634fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterMissing,
6351668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
636b5c07418SJames Feist }
637b5c07418SJames Feist 
6381668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1,
6391668ce6dSEd Tanous                             std::string_view arg2)
640b5c07418SJames Feist {
641b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
642b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2));
643f4c4dcf4SKowalski, Kamil }
644f4c4dcf4SKowalski, Kamil 
645f4c4dcf4SKowalski, Kamil /**
646f4c4dcf4SKowalski, Kamil  * @internal
647f4c4dcf4SKowalski, Kamil  * @brief Formats StringValueTooLong message into JSON
648f4c4dcf4SKowalski, Kamil  *
649f4c4dcf4SKowalski, Kamil  * See header file for more information
650f4c4dcf4SKowalski, Kamil  * @endinternal
651f4c4dcf4SKowalski, Kamil  */
6521668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2)
6531abe55efSEd Tanous {
654b6cd31e1SEd Tanous     std::string arg2String = std::to_string(arg2);
655fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::stringValueTooLong,
6561668ce6dSEd Tanous                   std::to_array({arg1, std::string_view(arg2String)}));
657b5c07418SJames Feist }
658b5c07418SJames Feist 
6591668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2)
660b5c07418SJames Feist {
661b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
662b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2));
663f4c4dcf4SKowalski, Kamil }
664f4c4dcf4SKowalski, Kamil 
665f4c4dcf4SKowalski, Kamil /**
666f4c4dcf4SKowalski, Kamil  * @internal
667cc9139ecSJason M. Bills  * @brief Formats SessionTerminated message into JSON
668cc9139ecSJason M. Bills  *
669cc9139ecSJason M. Bills  * See header file for more information
670cc9139ecSJason M. Bills  * @endinternal
671cc9139ecSJason M. Bills  */
672d9fcfcc1SEd Tanous nlohmann::json sessionTerminated()
673cc9139ecSJason M. Bills {
674fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::sessionTerminated, {});
675b5c07418SJames Feist }
676b5c07418SJames Feist 
677b5c07418SJames Feist void sessionTerminated(crow::Response& res)
678b5c07418SJames Feist {
679b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
680b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, sessionTerminated());
681cc9139ecSJason M. Bills }
682cc9139ecSJason M. Bills 
683cc9139ecSJason M. Bills /**
684cc9139ecSJason M. Bills  * @internal
685684bb4b8SJason M. Bills  * @brief Formats SubscriptionTerminated message into JSON
686684bb4b8SJason M. Bills  *
687684bb4b8SJason M. Bills  * See header file for more information
688684bb4b8SJason M. Bills  * @endinternal
689684bb4b8SJason M. Bills  */
690d9fcfcc1SEd Tanous nlohmann::json subscriptionTerminated()
691684bb4b8SJason M. Bills {
692fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::subscriptionTerminated, {});
693684bb4b8SJason M. Bills }
694684bb4b8SJason M. Bills 
695684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res)
696684bb4b8SJason M. Bills {
697684bb4b8SJason M. Bills     res.result(boost::beast::http::status::ok);
698684bb4b8SJason M. Bills     addMessageToJsonRoot(res.jsonValue, subscriptionTerminated());
699684bb4b8SJason M. Bills }
700684bb4b8SJason M. Bills 
701684bb4b8SJason M. Bills /**
702684bb4b8SJason M. Bills  * @internal
703cc9139ecSJason M. Bills  * @brief Formats ResourceTypeIncompatible message into JSON
704cc9139ecSJason M. Bills  *
705cc9139ecSJason M. Bills  * See header file for more information
706cc9139ecSJason M. Bills  * @endinternal
707cc9139ecSJason M. Bills  */
7081668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1,
7091668ce6dSEd Tanous                                         std::string_view arg2)
710cc9139ecSJason M. Bills {
711fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceTypeIncompatible,
7121668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
713b5c07418SJames Feist }
714b5c07418SJames Feist 
7151668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1,
7161668ce6dSEd Tanous                               std::string_view arg2)
717b5c07418SJames Feist {
718b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
719b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2));
720cc9139ecSJason M. Bills }
721cc9139ecSJason M. Bills 
722cc9139ecSJason M. Bills /**
723cc9139ecSJason M. Bills  * @internal
724684bb4b8SJason M. Bills  * @brief Formats ResetRequired message into JSON
725684bb4b8SJason M. Bills  *
726684bb4b8SJason M. Bills  * See header file for more information
727684bb4b8SJason M. Bills  * @endinternal
728684bb4b8SJason M. Bills  */
7294a7fbefdSEd Tanous nlohmann::json resetRequired(const boost::urls::url_view_base& arg1,
7304a7fbefdSEd Tanous                              std::string_view arg2)
731684bb4b8SJason M. Bills {
732fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resetRequired,
733079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer(), arg2}));
734684bb4b8SJason M. Bills }
735684bb4b8SJason M. Bills 
7364a7fbefdSEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1,
7371668ce6dSEd Tanous                    std::string_view arg2)
738684bb4b8SJason M. Bills {
739684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
740684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2));
741684bb4b8SJason M. Bills }
742684bb4b8SJason M. Bills 
743684bb4b8SJason M. Bills /**
744684bb4b8SJason M. Bills  * @internal
745684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOnRequired message into JSON
746684bb4b8SJason M. Bills  *
747684bb4b8SJason M. Bills  * See header file for more information
748684bb4b8SJason M. Bills  * @endinternal
749684bb4b8SJason M. Bills  */
7501668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1)
751684bb4b8SJason M. Bills {
752fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resetRequired,
7531668ce6dSEd Tanous                   std::to_array({arg1}));
754684bb4b8SJason M. Bills }
755684bb4b8SJason M. Bills 
7561668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1)
757684bb4b8SJason M. Bills {
758684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
759684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1));
760684bb4b8SJason M. Bills }
761684bb4b8SJason M. Bills 
762684bb4b8SJason M. Bills /**
763684bb4b8SJason M. Bills  * @internal
764684bb4b8SJason M. Bills  * @brief Formats ChassisPowerStateOffRequired message into JSON
765684bb4b8SJason M. Bills  *
766684bb4b8SJason M. Bills  * See header file for more information
767684bb4b8SJason M. Bills  * @endinternal
768684bb4b8SJason M. Bills  */
7691668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1)
770684bb4b8SJason M. Bills {
771b6cd31e1SEd Tanous     return getLog(
772fffb8c1fSEd Tanous         redfish::registries::base::Index::chassisPowerStateOffRequired,
7731668ce6dSEd Tanous         std::to_array({arg1}));
774684bb4b8SJason M. Bills }
775684bb4b8SJason M. Bills 
7761668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1)
777684bb4b8SJason M. Bills {
778684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
779684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1));
780684bb4b8SJason M. Bills }
781684bb4b8SJason M. Bills 
782684bb4b8SJason M. Bills /**
783684bb4b8SJason M. Bills  * @internal
784684bb4b8SJason M. Bills  * @brief Formats PropertyValueConflict message into JSON
785684bb4b8SJason M. Bills  *
786684bb4b8SJason M. Bills  * See header file for more information
787684bb4b8SJason M. Bills  * @endinternal
788684bb4b8SJason M. Bills  */
7891668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1,
7901668ce6dSEd Tanous                                      std::string_view arg2)
791684bb4b8SJason M. Bills {
792fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueConflict,
7931668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
794684bb4b8SJason M. Bills }
795684bb4b8SJason M. Bills 
7961668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1,
7971668ce6dSEd Tanous                            std::string_view arg2)
798684bb4b8SJason M. Bills {
799684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
800684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2));
801684bb4b8SJason M. Bills }
802684bb4b8SJason M. Bills 
803684bb4b8SJason M. Bills /**
804684bb4b8SJason M. Bills  * @internal
8052a6af81cSRamesh Iyyar  * @brief Formats PropertyValueResourceConflict message into JSON
8062a6af81cSRamesh Iyyar  *
8072a6af81cSRamesh Iyyar  * See header file for more information
8082a6af81cSRamesh Iyyar  * @endinternal
8092a6af81cSRamesh Iyyar  */
810bd79bce8SPatrick Williams nlohmann::json propertyValueResourceConflict(
811bd79bce8SPatrick Williams     std::string_view arg1, const nlohmann::json& arg2,
8124a7fbefdSEd Tanous     const boost::urls::url_view_base& arg3)
8132a6af81cSRamesh Iyyar {
814bd79bce8SPatrick Williams     std::string arg2Str =
815*034e1259SEd Tanous         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
81695b3ad73SEd Tanous 
8172a6af81cSRamesh Iyyar     return getLog(
8182a6af81cSRamesh Iyyar         redfish::registries::base::Index::propertyValueResourceConflict,
81995b3ad73SEd Tanous         std::to_array<std::string_view>({arg1, arg2Str, arg3.buffer()}));
8202a6af81cSRamesh Iyyar }
8212a6af81cSRamesh Iyyar 
8222a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1,
82395b3ad73SEd Tanous                                    const nlohmann::json& arg2,
8244a7fbefdSEd Tanous                                    const boost::urls::url_view_base& arg3)
8252a6af81cSRamesh Iyyar {
8262a6af81cSRamesh Iyyar     res.result(boost::beast::http::status::conflict);
8272a6af81cSRamesh Iyyar     addMessageToErrorJson(res.jsonValue,
8282a6af81cSRamesh Iyyar                           propertyValueResourceConflict(arg1, arg2, arg3));
8292a6af81cSRamesh Iyyar }
8302a6af81cSRamesh Iyyar 
8312a6af81cSRamesh Iyyar /**
8322a6af81cSRamesh Iyyar  * @internal
83324861a28SRamesh Iyyar  * @brief Formats PropertyValueExternalConflict message into JSON
83424861a28SRamesh Iyyar  *
83524861a28SRamesh Iyyar  * See header file for more information
83624861a28SRamesh Iyyar  * @endinternal
83724861a28SRamesh Iyyar  */
83824861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1,
83995b3ad73SEd Tanous                                              const nlohmann::json& arg2)
84024861a28SRamesh Iyyar {
841bd79bce8SPatrick Williams     std::string arg2Str =
842*034e1259SEd Tanous         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
84395b3ad73SEd Tanous 
84424861a28SRamesh Iyyar     return getLog(
84524861a28SRamesh Iyyar         redfish::registries::base::Index::propertyValueExternalConflict,
84695b3ad73SEd Tanous         std::to_array<std::string_view>({arg1, arg2Str}));
84724861a28SRamesh Iyyar }
84824861a28SRamesh Iyyar 
84924861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1,
85095b3ad73SEd Tanous                                    const nlohmann::json& arg2)
85124861a28SRamesh Iyyar {
85224861a28SRamesh Iyyar     res.result(boost::beast::http::status::conflict);
85324861a28SRamesh Iyyar     addMessageToErrorJson(res.jsonValue,
85424861a28SRamesh Iyyar                           propertyValueExternalConflict(arg1, arg2));
85524861a28SRamesh Iyyar }
85624861a28SRamesh Iyyar 
85724861a28SRamesh Iyyar /**
85824861a28SRamesh Iyyar  * @internal
859684bb4b8SJason M. Bills  * @brief Formats PropertyValueIncorrect message into JSON
860684bb4b8SJason M. Bills  *
861684bb4b8SJason M. Bills  * See header file for more information
862684bb4b8SJason M. Bills  * @endinternal
863684bb4b8SJason M. Bills  */
864367b3dceSGinu George nlohmann::json propertyValueIncorrect(std::string_view arg1,
865367b3dceSGinu George                                       const nlohmann::json& arg2)
866684bb4b8SJason M. Bills {
867bd79bce8SPatrick Williams     std::string arg2Str =
868*034e1259SEd Tanous         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
869fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueIncorrect,
870367b3dceSGinu George                   std::to_array<std::string_view>({arg1, arg2Str}));
871684bb4b8SJason M. Bills }
872684bb4b8SJason M. Bills 
873367b3dceSGinu George void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
874367b3dceSGinu George                             const nlohmann::json& arg2)
875684bb4b8SJason M. Bills {
876684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
877684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));
878684bb4b8SJason M. Bills }
879684bb4b8SJason M. Bills 
880684bb4b8SJason M. Bills /**
881684bb4b8SJason M. Bills  * @internal
882684bb4b8SJason M. Bills  * @brief Formats ResourceCreationConflict message into JSON
883684bb4b8SJason M. Bills  *
884684bb4b8SJason M. Bills  * See header file for more information
885684bb4b8SJason M. Bills  * @endinternal
886684bb4b8SJason M. Bills  */
8874a7fbefdSEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view_base& arg1)
888684bb4b8SJason M. Bills {
889fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceCreationConflict,
890079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer()}));
891684bb4b8SJason M. Bills }
892684bb4b8SJason M. Bills 
8934a7fbefdSEd Tanous void resourceCreationConflict(crow::Response& res,
8944a7fbefdSEd Tanous                               const boost::urls::url_view_base& arg1)
895684bb4b8SJason M. Bills {
896684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
897684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1));
898684bb4b8SJason M. Bills }
899684bb4b8SJason M. Bills 
900684bb4b8SJason M. Bills /**
901684bb4b8SJason M. Bills  * @internal
902684bb4b8SJason M. Bills  * @brief Formats MaximumErrorsExceeded message into JSON
903684bb4b8SJason M. Bills  *
904684bb4b8SJason M. Bills  * See header file for more information
905684bb4b8SJason M. Bills  * @endinternal
906684bb4b8SJason M. Bills  */
907d9fcfcc1SEd Tanous nlohmann::json maximumErrorsExceeded()
908684bb4b8SJason M. Bills {
909fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {});
910684bb4b8SJason M. Bills }
911684bb4b8SJason M. Bills 
912684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res)
913684bb4b8SJason M. Bills {
914684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
915684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded());
916684bb4b8SJason M. Bills }
917684bb4b8SJason M. Bills 
918684bb4b8SJason M. Bills /**
919684bb4b8SJason M. Bills  * @internal
920684bb4b8SJason M. Bills  * @brief Formats PreconditionFailed message into JSON
921684bb4b8SJason M. Bills  *
922684bb4b8SJason M. Bills  * See header file for more information
923684bb4b8SJason M. Bills  * @endinternal
924684bb4b8SJason M. Bills  */
925d9fcfcc1SEd Tanous nlohmann::json preconditionFailed()
926684bb4b8SJason M. Bills {
927fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::preconditionFailed, {});
928684bb4b8SJason M. Bills }
929684bb4b8SJason M. Bills 
930684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res)
931684bb4b8SJason M. Bills {
9324df1bee0SEd Tanous     res.result(boost::beast::http::status::precondition_failed);
933684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionFailed());
934684bb4b8SJason M. Bills }
935684bb4b8SJason M. Bills 
936684bb4b8SJason M. Bills /**
937684bb4b8SJason M. Bills  * @internal
938684bb4b8SJason M. Bills  * @brief Formats PreconditionRequired message into JSON
939684bb4b8SJason M. Bills  *
940684bb4b8SJason M. Bills  * See header file for more information
941684bb4b8SJason M. Bills  * @endinternal
942684bb4b8SJason M. Bills  */
943d9fcfcc1SEd Tanous nlohmann::json preconditionRequired()
944684bb4b8SJason M. Bills {
945fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::preconditionRequired, {});
946684bb4b8SJason M. Bills }
947684bb4b8SJason M. Bills 
948684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res)
949684bb4b8SJason M. Bills {
950684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
951684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, preconditionRequired());
952684bb4b8SJason M. Bills }
953684bb4b8SJason M. Bills 
954684bb4b8SJason M. Bills /**
955684bb4b8SJason M. Bills  * @internal
956684bb4b8SJason M. Bills  * @brief Formats OperationFailed message into JSON
957684bb4b8SJason M. Bills  *
958684bb4b8SJason M. Bills  * See header file for more information
959684bb4b8SJason M. Bills  * @endinternal
960684bb4b8SJason M. Bills  */
961d9fcfcc1SEd Tanous nlohmann::json operationFailed()
962684bb4b8SJason M. Bills {
963fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::operationFailed, {});
964684bb4b8SJason M. Bills }
965684bb4b8SJason M. Bills 
966684bb4b8SJason M. Bills void operationFailed(crow::Response& res)
967684bb4b8SJason M. Bills {
9688868776eSEd Tanous     res.result(boost::beast::http::status::bad_gateway);
969684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationFailed());
970684bb4b8SJason M. Bills }
971684bb4b8SJason M. Bills 
972684bb4b8SJason M. Bills /**
973684bb4b8SJason M. Bills  * @internal
974684bb4b8SJason M. Bills  * @brief Formats OperationTimeout message into JSON
975684bb4b8SJason M. Bills  *
976684bb4b8SJason M. Bills  * See header file for more information
977684bb4b8SJason M. Bills  * @endinternal
978684bb4b8SJason M. Bills  */
979d9fcfcc1SEd Tanous nlohmann::json operationTimeout()
980684bb4b8SJason M. Bills {
981fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::operationTimeout, {});
982684bb4b8SJason M. Bills }
983684bb4b8SJason M. Bills 
984684bb4b8SJason M. Bills void operationTimeout(crow::Response& res)
985684bb4b8SJason M. Bills {
986684bb4b8SJason M. Bills     res.result(boost::beast::http::status::internal_server_error);
987684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, operationTimeout());
988684bb4b8SJason M. Bills }
989684bb4b8SJason M. Bills 
990684bb4b8SJason M. Bills /**
991684bb4b8SJason M. Bills  * @internal
992f12894f8SJason M. Bills  * @brief Formats PropertyValueTypeError message into JSON for the specified
993f12894f8SJason M. Bills  * property
994f12894f8SJason M. Bills  *
995f12894f8SJason M. Bills  * See header file for more information
996f12894f8SJason M. Bills  * @endinternal
997f12894f8SJason M. Bills  */
9982e8c4bdaSEd Tanous nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
9991668ce6dSEd Tanous                                       std::string_view arg2)
1000f12894f8SJason M. Bills {
1001bd79bce8SPatrick Williams     std::string arg1Str =
1002*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1003fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueTypeError,
10042e8c4bdaSEd Tanous                   std::to_array<std::string_view>({arg1Str, arg2}));
1005b5c07418SJames Feist }
1006b5c07418SJames Feist 
10072e8c4bdaSEd Tanous void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
10081668ce6dSEd Tanous                             std::string_view arg2)
1009b5c07418SJames Feist {
1010b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1011b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
1012f4c4dcf4SKowalski, Kamil }
1013f4c4dcf4SKowalski, Kamil 
1014f4c4dcf4SKowalski, Kamil /**
1015f4c4dcf4SKowalski, Kamil  * @internal
1016b54eb49fSEd Tanous  * @brief Formats PropertyValueError message into JSON for the specified
1017b54eb49fSEd Tanous  * property
1018b54eb49fSEd Tanous  *
1019b54eb49fSEd Tanous  * See header file for more information
1020b54eb49fSEd Tanous  * @endinternal
1021b54eb49fSEd Tanous  */
1022b54eb49fSEd Tanous nlohmann::json propertyValueError(std::string_view arg1)
1023b54eb49fSEd Tanous {
1024b54eb49fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueError,
1025b54eb49fSEd Tanous                   std::to_array<std::string_view>({arg1}));
1026b54eb49fSEd Tanous }
1027b54eb49fSEd Tanous 
1028b54eb49fSEd Tanous void propertyValueError(crow::Response& res, std::string_view arg1)
1029b54eb49fSEd Tanous {
1030b54eb49fSEd Tanous     res.result(boost::beast::http::status::bad_request);
1031b54eb49fSEd Tanous     addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1);
1032b54eb49fSEd Tanous }
1033b54eb49fSEd Tanous 
1034b54eb49fSEd Tanous /**
1035b54eb49fSEd Tanous  * @internal
1036b6cd31e1SEd Tanous  * @brief Formats ResourceNotFound message into JSONd
1037f4c4dcf4SKowalski, Kamil  *
1038f4c4dcf4SKowalski, Kamil  * See header file for more information
1039f4c4dcf4SKowalski, Kamil  * @endinternal
1040f4c4dcf4SKowalski, Kamil  */
10411668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2)
10421abe55efSEd Tanous {
1043fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceNotFound,
10441668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1045b5c07418SJames Feist }
1046b5c07418SJames Feist 
10471668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1,
10481668ce6dSEd Tanous                       std::string_view arg2)
1049b5c07418SJames Feist {
1050b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1051b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
1052f4c4dcf4SKowalski, Kamil }
1053f4c4dcf4SKowalski, Kamil 
1054f4c4dcf4SKowalski, Kamil /**
1055f4c4dcf4SKowalski, Kamil  * @internal
1056f4c4dcf4SKowalski, Kamil  * @brief Formats CouldNotEstablishConnection message into JSON
1057f4c4dcf4SKowalski, Kamil  *
1058f4c4dcf4SKowalski, Kamil  * See header file for more information
1059f4c4dcf4SKowalski, Kamil  * @endinternal
1060f4c4dcf4SKowalski, Kamil  */
10614a7fbefdSEd Tanous nlohmann::json
10624a7fbefdSEd Tanous     couldNotEstablishConnection(const boost::urls::url_view_base& arg1)
10631abe55efSEd Tanous {
1064fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::couldNotEstablishConnection,
1065079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer()}));
1066b5c07418SJames Feist }
1067b5c07418SJames Feist 
1068ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res,
10694a7fbefdSEd Tanous                                  const boost::urls::url_view_base& arg1)
1070b5c07418SJames Feist {
1071b5c07418SJames Feist     res.result(boost::beast::http::status::not_found);
1072b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
1073f4c4dcf4SKowalski, Kamil }
1074f4c4dcf4SKowalski, Kamil 
1075f4c4dcf4SKowalski, Kamil /**
1076f4c4dcf4SKowalski, Kamil  * @internal
1077f12894f8SJason M. Bills  * @brief Formats PropertyNotWritable message into JSON for the specified
1078f12894f8SJason M. Bills  * property
1079f12894f8SJason M. Bills  *
1080f12894f8SJason M. Bills  * See header file for more information
1081f12894f8SJason M. Bills  * @endinternal
1082f12894f8SJason M. Bills  */
10831668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1)
1084f12894f8SJason M. Bills {
1085fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyNotWritable,
10861668ce6dSEd Tanous                   std::to_array({arg1}));
1087b5c07418SJames Feist }
1088b5c07418SJames Feist 
10891668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1)
1090b5c07418SJames Feist {
1091b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1092b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
1093f4c4dcf4SKowalski, Kamil }
1094f4c4dcf4SKowalski, Kamil 
1095f4c4dcf4SKowalski, Kamil /**
1096f4c4dcf4SKowalski, Kamil  * @internal
1097f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueTypeError message into JSON
1098f4c4dcf4SKowalski, Kamil  *
1099f4c4dcf4SKowalski, Kamil  * See header file for more information
1100f4c4dcf4SKowalski, Kamil  * @endinternal
1101f4c4dcf4SKowalski, Kamil  */
110295b3ad73SEd Tanous nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
11031668ce6dSEd Tanous                                             std::string_view arg2)
11041abe55efSEd Tanous {
1105bd79bce8SPatrick Williams     std::string arg1Str =
1106*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1107b6cd31e1SEd Tanous     return getLog(
1108fffb8c1fSEd Tanous         redfish::registries::base::Index::queryParameterValueTypeError,
110995b3ad73SEd Tanous         std::to_array<std::string_view>({arg1Str, arg2}));
1110b5c07418SJames Feist }
1111b5c07418SJames Feist 
1112bd79bce8SPatrick Williams void queryParameterValueTypeError(
1113bd79bce8SPatrick Williams     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
1114b5c07418SJames Feist {
1115b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1116b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1117b5c07418SJames Feist                           queryParameterValueTypeError(arg1, arg2));
1118f4c4dcf4SKowalski, Kamil }
1119f4c4dcf4SKowalski, Kamil 
1120f4c4dcf4SKowalski, Kamil /**
1121f4c4dcf4SKowalski, Kamil  * @internal
1122f4c4dcf4SKowalski, Kamil  * @brief Formats ServiceShuttingDown message into JSON
1123f4c4dcf4SKowalski, Kamil  *
1124f4c4dcf4SKowalski, Kamil  * See header file for more information
1125f4c4dcf4SKowalski, Kamil  * @endinternal
1126f4c4dcf4SKowalski, Kamil  */
1127d9fcfcc1SEd Tanous nlohmann::json serviceShuttingDown()
11281abe55efSEd Tanous {
1129fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::serviceShuttingDown, {});
1130b5c07418SJames Feist }
1131b5c07418SJames Feist 
1132b5c07418SJames Feist void serviceShuttingDown(crow::Response& res)
1133b5c07418SJames Feist {
1134b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1135b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
1136f4c4dcf4SKowalski, Kamil }
1137f4c4dcf4SKowalski, Kamil 
1138f4c4dcf4SKowalski, Kamil /**
1139f4c4dcf4SKowalski, Kamil  * @internal
1140f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterDuplicate message into JSON
1141f4c4dcf4SKowalski, Kamil  *
1142f4c4dcf4SKowalski, Kamil  * See header file for more information
1143f4c4dcf4SKowalski, Kamil  * @endinternal
1144f4c4dcf4SKowalski, Kamil  */
11451668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1,
11461668ce6dSEd Tanous                                         std::string_view arg2)
11471abe55efSEd Tanous {
1148fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterDuplicate,
11491668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1150b5c07418SJames Feist }
1151b5c07418SJames Feist 
11521668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
11531668ce6dSEd Tanous                               std::string_view arg2)
1154b5c07418SJames Feist {
1155b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1156b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
1157f4c4dcf4SKowalski, Kamil }
1158f4c4dcf4SKowalski, Kamil 
1159f4c4dcf4SKowalski, Kamil /**
1160f4c4dcf4SKowalski, Kamil  * @internal
1161f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterNotSupported message into JSON
1162f4c4dcf4SKowalski, Kamil  *
1163f4c4dcf4SKowalski, Kamil  * See header file for more information
1164f4c4dcf4SKowalski, Kamil  * @endinternal
1165f4c4dcf4SKowalski, Kamil  */
11661668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1,
11671668ce6dSEd Tanous                                            std::string_view arg2)
11681abe55efSEd Tanous {
1169fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionParameterNotSupported,
11701668ce6dSEd Tanous                   std::to_array({arg1, arg2}));
1171b5c07418SJames Feist }
1172b5c07418SJames Feist 
11731668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
11741668ce6dSEd Tanous                                  std::string_view arg2)
1175b5c07418SJames Feist {
1176b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1177b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1178b5c07418SJames Feist                           actionParameterNotSupported(arg1, arg2));
1179f4c4dcf4SKowalski, Kamil }
1180f4c4dcf4SKowalski, Kamil 
1181f4c4dcf4SKowalski, Kamil /**
1182f4c4dcf4SKowalski, Kamil  * @internal
1183f4c4dcf4SKowalski, Kamil  * @brief Formats SourceDoesNotSupportProtocol message into JSON
1184f4c4dcf4SKowalski, Kamil  *
1185f4c4dcf4SKowalski, Kamil  * See header file for more information
1186f4c4dcf4SKowalski, Kamil  * @endinternal
1187f4c4dcf4SKowalski, Kamil  */
1188bd79bce8SPatrick Williams nlohmann::json sourceDoesNotSupportProtocol(
1189bd79bce8SPatrick Williams     const boost::urls::url_view_base& arg1, std::string_view arg2)
11901abe55efSEd Tanous {
1191b6cd31e1SEd Tanous     return getLog(
1192fffb8c1fSEd Tanous         redfish::registries::base::Index::sourceDoesNotSupportProtocol,
1193079360aeSEd Tanous         std::to_array<std::string_view>({arg1.buffer(), arg2}));
1194b5c07418SJames Feist }
1195b5c07418SJames Feist 
1196ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res,
11974a7fbefdSEd Tanous                                   const boost::urls::url_view_base& arg1,
11981668ce6dSEd Tanous                                   std::string_view arg2)
1199b5c07418SJames Feist {
1200b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1201b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1202b5c07418SJames Feist                           sourceDoesNotSupportProtocol(arg1, arg2));
1203f4c4dcf4SKowalski, Kamil }
1204f4c4dcf4SKowalski, Kamil 
1205f4c4dcf4SKowalski, Kamil /**
1206f4c4dcf4SKowalski, Kamil  * @internal
1207b4ad4c05SShantappa Teekappanavar  * @brief Formats StrictAccountTypes message into JSON
1208b4ad4c05SShantappa Teekappanavar  *
1209b4ad4c05SShantappa Teekappanavar  * See header file for more information
1210b4ad4c05SShantappa Teekappanavar  * @endinternal
1211b4ad4c05SShantappa Teekappanavar  */
1212b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1)
1213b4ad4c05SShantappa Teekappanavar {
1214b4ad4c05SShantappa Teekappanavar     return getLog(redfish::registries::base::Index::strictAccountTypes,
1215b4ad4c05SShantappa Teekappanavar                   std::to_array({arg1}));
1216b4ad4c05SShantappa Teekappanavar }
1217b4ad4c05SShantappa Teekappanavar 
1218b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1)
1219b4ad4c05SShantappa Teekappanavar {
1220b4ad4c05SShantappa Teekappanavar     res.result(boost::beast::http::status::bad_request);
1221b4ad4c05SShantappa Teekappanavar     addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1));
1222b4ad4c05SShantappa Teekappanavar }
1223b4ad4c05SShantappa Teekappanavar 
1224b4ad4c05SShantappa Teekappanavar /**
1225b4ad4c05SShantappa Teekappanavar  * @internal
1226f4c4dcf4SKowalski, Kamil  * @brief Formats AccountRemoved message into JSON
1227f4c4dcf4SKowalski, Kamil  *
1228f4c4dcf4SKowalski, Kamil  * See header file for more information
1229f4c4dcf4SKowalski, Kamil  * @endinternal
1230f4c4dcf4SKowalski, Kamil  */
1231d9fcfcc1SEd Tanous nlohmann::json accountRemoved()
12321abe55efSEd Tanous {
1233fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountRemoved, {});
1234b5c07418SJames Feist }
1235b5c07418SJames Feist 
1236b5c07418SJames Feist void accountRemoved(crow::Response& res)
1237b5c07418SJames Feist {
1238b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1239b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, accountRemoved());
1240f4c4dcf4SKowalski, Kamil }
1241f4c4dcf4SKowalski, Kamil 
1242f4c4dcf4SKowalski, Kamil /**
1243f4c4dcf4SKowalski, Kamil  * @internal
1244f4c4dcf4SKowalski, Kamil  * @brief Formats AccessDenied message into JSON
1245f4c4dcf4SKowalski, Kamil  *
1246f4c4dcf4SKowalski, Kamil  * See header file for more information
1247f4c4dcf4SKowalski, Kamil  * @endinternal
1248f4c4dcf4SKowalski, Kamil  */
12494a7fbefdSEd Tanous nlohmann::json accessDenied(const boost::urls::url_view_base& arg1)
12501abe55efSEd Tanous {
1251fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accessDenied,
1252079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer()}));
1253b5c07418SJames Feist }
1254b5c07418SJames Feist 
12554a7fbefdSEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1)
1256b5c07418SJames Feist {
1257b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1258b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
1259f4c4dcf4SKowalski, Kamil }
1260f4c4dcf4SKowalski, Kamil 
1261f4c4dcf4SKowalski, Kamil /**
1262f4c4dcf4SKowalski, Kamil  * @internal
1263f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupported message into JSON
1264f4c4dcf4SKowalski, Kamil  *
1265f4c4dcf4SKowalski, Kamil  * See header file for more information
1266f4c4dcf4SKowalski, Kamil  * @endinternal
1267f4c4dcf4SKowalski, Kamil  */
1268d9fcfcc1SEd Tanous nlohmann::json queryNotSupported()
12691abe55efSEd Tanous {
1270fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryNotSupported, {});
1271b5c07418SJames Feist }
1272b5c07418SJames Feist 
1273b5c07418SJames Feist void queryNotSupported(crow::Response& res)
1274b5c07418SJames Feist {
1275b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1276b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupported());
1277f4c4dcf4SKowalski, Kamil }
1278f4c4dcf4SKowalski, Kamil 
1279f4c4dcf4SKowalski, Kamil /**
1280f4c4dcf4SKowalski, Kamil  * @internal
1281f4c4dcf4SKowalski, Kamil  * @brief Formats CreateLimitReachedForResource message into JSON
1282f4c4dcf4SKowalski, Kamil  *
1283f4c4dcf4SKowalski, Kamil  * See header file for more information
1284f4c4dcf4SKowalski, Kamil  * @endinternal
1285f4c4dcf4SKowalski, Kamil  */
1286d9fcfcc1SEd Tanous nlohmann::json createLimitReachedForResource()
12871abe55efSEd Tanous {
1288b6cd31e1SEd Tanous     return getLog(
1289fffb8c1fSEd Tanous         redfish::registries::base::Index::createLimitReachedForResource, {});
1290b5c07418SJames Feist }
1291b5c07418SJames Feist 
1292b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res)
1293b5c07418SJames Feist {
1294b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1295b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
1296f4c4dcf4SKowalski, Kamil }
1297f4c4dcf4SKowalski, Kamil 
1298f4c4dcf4SKowalski, Kamil /**
1299f4c4dcf4SKowalski, Kamil  * @internal
1300f4c4dcf4SKowalski, Kamil  * @brief Formats GeneralError message into JSON
1301f4c4dcf4SKowalski, Kamil  *
1302f4c4dcf4SKowalski, Kamil  * See header file for more information
1303f4c4dcf4SKowalski, Kamil  * @endinternal
1304f4c4dcf4SKowalski, Kamil  */
1305d9fcfcc1SEd Tanous nlohmann::json generalError()
13061abe55efSEd Tanous {
1307fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::generalError, {});
1308b5c07418SJames Feist }
1309b5c07418SJames Feist 
1310b5c07418SJames Feist void generalError(crow::Response& res)
1311b5c07418SJames Feist {
1312b5c07418SJames Feist     res.result(boost::beast::http::status::internal_server_error);
1313b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, generalError());
1314f4c4dcf4SKowalski, Kamil }
1315f4c4dcf4SKowalski, Kamil 
1316f4c4dcf4SKowalski, Kamil /**
1317f4c4dcf4SKowalski, Kamil  * @internal
1318f4c4dcf4SKowalski, Kamil  * @brief Formats Success message into JSON
1319f4c4dcf4SKowalski, Kamil  *
1320f4c4dcf4SKowalski, Kamil  * See header file for more information
1321f4c4dcf4SKowalski, Kamil  * @endinternal
1322f4c4dcf4SKowalski, Kamil  */
1323d9fcfcc1SEd Tanous nlohmann::json success()
13241abe55efSEd Tanous {
1325fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::success, {});
1326b5c07418SJames Feist }
1327b5c07418SJames Feist 
1328b5c07418SJames Feist void success(crow::Response& res)
1329b5c07418SJames Feist {
1330b5c07418SJames Feist     // don't set res.result here because success is the default and any
1331b5c07418SJames Feist     // error should overwrite the default
1332b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, success());
1333f12894f8SJason M. Bills }
1334f12894f8SJason M. Bills 
1335f12894f8SJason M. Bills /**
1336f12894f8SJason M. Bills  * @internal
1337f4c4dcf4SKowalski, Kamil  * @brief Formats Created message into JSON
1338f4c4dcf4SKowalski, Kamil  *
1339f4c4dcf4SKowalski, Kamil  * See header file for more information
1340f4c4dcf4SKowalski, Kamil  * @endinternal
1341f4c4dcf4SKowalski, Kamil  */
1342d9fcfcc1SEd Tanous nlohmann::json created()
13431abe55efSEd Tanous {
1344fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::created, {});
1345b5c07418SJames Feist }
1346b5c07418SJames Feist 
1347b5c07418SJames Feist void created(crow::Response& res)
1348b5c07418SJames Feist {
1349b5c07418SJames Feist     res.result(boost::beast::http::status::created);
1350b5c07418SJames Feist     addMessageToJsonRoot(res.jsonValue, created());
1351f4c4dcf4SKowalski, Kamil }
1352f4c4dcf4SKowalski, Kamil 
1353f4c4dcf4SKowalski, Kamil /**
1354f4c4dcf4SKowalski, Kamil  * @internal
1355cc9139ecSJason M. Bills  * @brief Formats NoOperation message into JSON
1356cc9139ecSJason M. Bills  *
1357cc9139ecSJason M. Bills  * See header file for more information
1358cc9139ecSJason M. Bills  * @endinternal
1359cc9139ecSJason M. Bills  */
1360d9fcfcc1SEd Tanous nlohmann::json noOperation()
1361cc9139ecSJason M. Bills {
1362fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::noOperation, {});
1363b5c07418SJames Feist }
1364b5c07418SJames Feist 
1365b5c07418SJames Feist void noOperation(crow::Response& res)
1366b5c07418SJames Feist {
1367b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1368b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noOperation());
1369cc9139ecSJason M. Bills }
1370cc9139ecSJason M. Bills 
1371cc9139ecSJason M. Bills /**
1372cc9139ecSJason M. Bills  * @internal
1373b5c07418SJames Feist  * @brief Formats PropertyUnknown message into JSON for the specified
1374b5c07418SJames Feist  * property
1375f12894f8SJason M. Bills  *
1376f12894f8SJason M. Bills  * See header file for more information
1377f12894f8SJason M. Bills  * @endinternal
1378f12894f8SJason M. Bills  */
13791668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1)
1380b5c07418SJames Feist {
1381fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyUnknown,
13821668ce6dSEd Tanous                   std::to_array({arg1}));
1383b5c07418SJames Feist }
1384b5c07418SJames Feist 
13851668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1)
1386f12894f8SJason M. Bills {
1387f12894f8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
13887b1dd2f9SEd Tanous     addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1));
1389f4c4dcf4SKowalski, Kamil }
1390f4c4dcf4SKowalski, Kamil 
1391f4c4dcf4SKowalski, Kamil /**
1392f4c4dcf4SKowalski, Kamil  * @internal
1393f4c4dcf4SKowalski, Kamil  * @brief Formats NoValidSession message into JSON
1394f4c4dcf4SKowalski, Kamil  *
1395f4c4dcf4SKowalski, Kamil  * See header file for more information
1396f4c4dcf4SKowalski, Kamil  * @endinternal
1397f4c4dcf4SKowalski, Kamil  */
1398d9fcfcc1SEd Tanous nlohmann::json noValidSession()
13991abe55efSEd Tanous {
1400fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::noValidSession, {});
1401b5c07418SJames Feist }
1402b5c07418SJames Feist 
1403b5c07418SJames Feist void noValidSession(crow::Response& res)
1404b5c07418SJames Feist {
1405b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1406b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, noValidSession());
1407f4c4dcf4SKowalski, Kamil }
1408f4c4dcf4SKowalski, Kamil 
1409f4c4dcf4SKowalski, Kamil /**
1410f4c4dcf4SKowalski, Kamil  * @internal
1411f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidObject message into JSON
1412f4c4dcf4SKowalski, Kamil  *
1413f4c4dcf4SKowalski, Kamil  * See header file for more information
1414f4c4dcf4SKowalski, Kamil  * @endinternal
1415f4c4dcf4SKowalski, Kamil  */
14164a7fbefdSEd Tanous nlohmann::json invalidObject(const boost::urls::url_view_base& arg1)
14171abe55efSEd Tanous {
1418fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::invalidObject,
1419079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer()}));
1420b5c07418SJames Feist }
1421b5c07418SJames Feist 
14224a7fbefdSEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1)
1423b5c07418SJames Feist {
1424b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1425b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
1426f4c4dcf4SKowalski, Kamil }
1427f4c4dcf4SKowalski, Kamil 
1428f4c4dcf4SKowalski, Kamil /**
1429f4c4dcf4SKowalski, Kamil  * @internal
1430f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceInStandby message into JSON
1431f4c4dcf4SKowalski, Kamil  *
1432f4c4dcf4SKowalski, Kamil  * See header file for more information
1433f4c4dcf4SKowalski, Kamil  * @endinternal
1434f4c4dcf4SKowalski, Kamil  */
1435d9fcfcc1SEd Tanous nlohmann::json resourceInStandby()
14361abe55efSEd Tanous {
1437fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceInStandby, {});
1438b5c07418SJames Feist }
1439b5c07418SJames Feist 
1440b5c07418SJames Feist void resourceInStandby(crow::Response& res)
1441b5c07418SJames Feist {
1442b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1443b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceInStandby());
1444f4c4dcf4SKowalski, Kamil }
1445f4c4dcf4SKowalski, Kamil 
1446f4c4dcf4SKowalski, Kamil /**
1447f4c4dcf4SKowalski, Kamil  * @internal
1448f4c4dcf4SKowalski, Kamil  * @brief Formats ActionParameterValueTypeError message into JSON
1449f4c4dcf4SKowalski, Kamil  *
1450f4c4dcf4SKowalski, Kamil  * See header file for more information
1451f4c4dcf4SKowalski, Kamil  * @endinternal
1452f4c4dcf4SKowalski, Kamil  */
1453bd79bce8SPatrick Williams nlohmann::json actionParameterValueTypeError(
1454bd79bce8SPatrick Williams     const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
14551abe55efSEd Tanous {
1456bd79bce8SPatrick Williams     std::string arg1Str =
1457*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1458b6cd31e1SEd Tanous     return getLog(
1459fffb8c1fSEd Tanous         redfish::registries::base::Index::actionParameterValueTypeError,
146095b3ad73SEd Tanous         std::to_array<std::string_view>({arg1Str, arg2, arg3}));
1461b5c07418SJames Feist }
1462b5c07418SJames Feist 
146395b3ad73SEd Tanous void actionParameterValueTypeError(crow::Response& res,
146495b3ad73SEd Tanous                                    const nlohmann::json& arg1,
14651668ce6dSEd Tanous                                    std::string_view arg2, std::string_view arg3)
1466b5c07418SJames Feist {
1467b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1468b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1469b5c07418SJames Feist                           actionParameterValueTypeError(arg1, arg2, arg3));
1470f4c4dcf4SKowalski, Kamil }
1471f4c4dcf4SKowalski, Kamil 
1472f4c4dcf4SKowalski, Kamil /**
1473f4c4dcf4SKowalski, Kamil  * @internal
14741827b4f1SAsmitha Karunanithi  * @brief Formats actionParameterValueError message into JSON
14751827b4f1SAsmitha Karunanithi  *
14761827b4f1SAsmitha Karunanithi  * See header file for more information
14771827b4f1SAsmitha Karunanithi  * @endinternal
14781827b4f1SAsmitha Karunanithi  */
14791827b4f1SAsmitha Karunanithi nlohmann::json actionParameterValueError(const nlohmann::json& arg1,
14801827b4f1SAsmitha Karunanithi                                          std::string_view arg2)
14811827b4f1SAsmitha Karunanithi {
1482bd79bce8SPatrick Williams     std::string arg1Str =
1483*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
14841827b4f1SAsmitha Karunanithi     return getLog(redfish::registries::base::Index::actionParameterValueError,
14851827b4f1SAsmitha Karunanithi                   std::to_array<std::string_view>({arg1Str, arg2}));
14861827b4f1SAsmitha Karunanithi }
14871827b4f1SAsmitha Karunanithi 
14881827b4f1SAsmitha Karunanithi void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
14891827b4f1SAsmitha Karunanithi                                std::string_view arg2)
14901827b4f1SAsmitha Karunanithi {
14911827b4f1SAsmitha Karunanithi     res.result(boost::beast::http::status::bad_request);
14921827b4f1SAsmitha Karunanithi     addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2));
14931827b4f1SAsmitha Karunanithi }
14941827b4f1SAsmitha Karunanithi 
14951827b4f1SAsmitha Karunanithi /**
14961827b4f1SAsmitha Karunanithi  * @internal
1497f4c4dcf4SKowalski, Kamil  * @brief Formats SessionLimitExceeded message into JSON
1498f4c4dcf4SKowalski, Kamil  *
1499f4c4dcf4SKowalski, Kamil  * See header file for more information
1500f4c4dcf4SKowalski, Kamil  * @endinternal
1501f4c4dcf4SKowalski, Kamil  */
1502d9fcfcc1SEd Tanous nlohmann::json sessionLimitExceeded()
15031abe55efSEd Tanous {
1504fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::sessionLimitExceeded, {});
1505b5c07418SJames Feist }
1506b5c07418SJames Feist 
1507b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res)
1508b5c07418SJames Feist {
1509b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1510b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
1511f4c4dcf4SKowalski, Kamil }
1512f4c4dcf4SKowalski, Kamil 
1513f4c4dcf4SKowalski, Kamil /**
1514f4c4dcf4SKowalski, Kamil  * @internal
1515f4c4dcf4SKowalski, Kamil  * @brief Formats ActionNotSupported message into JSON
1516f4c4dcf4SKowalski, Kamil  *
1517f4c4dcf4SKowalski, Kamil  * See header file for more information
1518f4c4dcf4SKowalski, Kamil  * @endinternal
1519f4c4dcf4SKowalski, Kamil  */
15201668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1)
15211abe55efSEd Tanous {
1522fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::actionNotSupported,
15231668ce6dSEd Tanous                   std::to_array({arg1}));
1524b5c07418SJames Feist }
1525b5c07418SJames Feist 
15261668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1)
1527b5c07418SJames Feist {
1528b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1529b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
1530f4c4dcf4SKowalski, Kamil }
1531f4c4dcf4SKowalski, Kamil 
1532f4c4dcf4SKowalski, Kamil /**
1533f4c4dcf4SKowalski, Kamil  * @internal
1534f4c4dcf4SKowalski, Kamil  * @brief Formats InvalidIndex message into JSON
1535f4c4dcf4SKowalski, Kamil  *
1536f4c4dcf4SKowalski, Kamil  * See header file for more information
1537f4c4dcf4SKowalski, Kamil  * @endinternal
1538f4c4dcf4SKowalski, Kamil  */
15395187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1)
15401abe55efSEd Tanous {
1541b6cd31e1SEd Tanous     std::string arg1Str = std::to_string(arg1);
1542fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::invalidIndex,
15431668ce6dSEd Tanous                   std::to_array<std::string_view>({arg1Str}));
1544b5c07418SJames Feist }
1545b5c07418SJames Feist 
15465187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1)
1547b5c07418SJames Feist {
1548b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1549b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
1550f4c4dcf4SKowalski, Kamil }
1551f4c4dcf4SKowalski, Kamil 
1552f4c4dcf4SKowalski, Kamil /**
1553f4c4dcf4SKowalski, Kamil  * @internal
1554f4c4dcf4SKowalski, Kamil  * @brief Formats EmptyJSON message into JSON
1555f4c4dcf4SKowalski, Kamil  *
1556f4c4dcf4SKowalski, Kamil  * See header file for more information
1557f4c4dcf4SKowalski, Kamil  * @endinternal
1558f4c4dcf4SKowalski, Kamil  */
1559d9fcfcc1SEd Tanous nlohmann::json emptyJSON()
15601abe55efSEd Tanous {
1561fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::emptyJSON, {});
1562b5c07418SJames Feist }
1563b5c07418SJames Feist 
1564b5c07418SJames Feist void emptyJSON(crow::Response& res)
1565b5c07418SJames Feist {
1566b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1567b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, emptyJSON());
1568f4c4dcf4SKowalski, Kamil }
1569f4c4dcf4SKowalski, Kamil 
1570f4c4dcf4SKowalski, Kamil /**
1571f4c4dcf4SKowalski, Kamil  * @internal
1572f4c4dcf4SKowalski, Kamil  * @brief Formats QueryNotSupportedOnResource message into JSON
1573f4c4dcf4SKowalski, Kamil  *
1574f4c4dcf4SKowalski, Kamil  * See header file for more information
1575f4c4dcf4SKowalski, Kamil  * @endinternal
1576f4c4dcf4SKowalski, Kamil  */
1577d9fcfcc1SEd Tanous nlohmann::json queryNotSupportedOnResource()
15781abe55efSEd Tanous {
1579fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryNotSupportedOnResource,
1580b6cd31e1SEd Tanous                   {});
1581b5c07418SJames Feist }
1582b5c07418SJames Feist 
1583b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res)
1584b5c07418SJames Feist {
15856a409c12SEd Tanous     res.result(boost::beast::http::status::bad_request);
1586b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
1587f4c4dcf4SKowalski, Kamil }
1588f4c4dcf4SKowalski, Kamil 
1589f4c4dcf4SKowalski, Kamil /**
1590f4c4dcf4SKowalski, Kamil  * @internal
1591684bb4b8SJason M. Bills  * @brief Formats QueryNotSupportedOnOperation message into JSON
1592684bb4b8SJason M. Bills  *
1593684bb4b8SJason M. Bills  * See header file for more information
1594684bb4b8SJason M. Bills  * @endinternal
1595684bb4b8SJason M. Bills  */
1596d9fcfcc1SEd Tanous nlohmann::json queryNotSupportedOnOperation()
1597684bb4b8SJason M. Bills {
1598b6cd31e1SEd Tanous     return getLog(
1599fffb8c1fSEd Tanous         redfish::registries::base::Index::queryNotSupportedOnOperation, {});
1600684bb4b8SJason M. Bills }
1601684bb4b8SJason M. Bills 
1602684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res)
1603684bb4b8SJason M. Bills {
16046a409c12SEd Tanous     res.result(boost::beast::http::status::bad_request);
1605684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
1606684bb4b8SJason M. Bills }
1607684bb4b8SJason M. Bills 
1608684bb4b8SJason M. Bills /**
1609684bb4b8SJason M. Bills  * @internal
1610684bb4b8SJason M. Bills  * @brief Formats QueryCombinationInvalid message into JSON
1611684bb4b8SJason M. Bills  *
1612684bb4b8SJason M. Bills  * See header file for more information
1613684bb4b8SJason M. Bills  * @endinternal
1614684bb4b8SJason M. Bills  */
1615d9fcfcc1SEd Tanous nlohmann::json queryCombinationInvalid()
1616684bb4b8SJason M. Bills {
1617fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryCombinationInvalid,
1618fffb8c1fSEd Tanous                   {});
1619684bb4b8SJason M. Bills }
1620684bb4b8SJason M. Bills 
1621684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res)
1622684bb4b8SJason M. Bills {
1623684bb4b8SJason M. Bills     res.result(boost::beast::http::status::bad_request);
1624684bb4b8SJason M. Bills     addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
1625684bb4b8SJason M. Bills }
1626684bb4b8SJason M. Bills 
1627684bb4b8SJason M. Bills /**
1628684bb4b8SJason M. Bills  * @internal
1629fa345c78SEd Tanous  * @brief Formats EventBufferExceeded message into JSON
1630fa345c78SEd Tanous  *
1631fa345c78SEd Tanous  * See header file for more information
1632fa345c78SEd Tanous  * @endinternal
1633fa345c78SEd Tanous  */
1634fa345c78SEd Tanous nlohmann::json eventBufferExceeded()
1635fa345c78SEd Tanous {
1636fa345c78SEd Tanous     return getLog(redfish::registries::base::Index::eventBufferExceeded, {});
1637fa345c78SEd Tanous }
1638fa345c78SEd Tanous 
1639fa345c78SEd Tanous void eventBufferExceeded(crow::Response& res)
1640fa345c78SEd Tanous {
1641fa345c78SEd Tanous     res.result(boost::beast::http::status::bad_request);
1642fa345c78SEd Tanous     addMessageToErrorJson(res.jsonValue, eventBufferExceeded());
1643fa345c78SEd Tanous }
1644fa345c78SEd Tanous 
1645fa345c78SEd Tanous /**
1646fa345c78SEd Tanous  * @internal
1647f4c4dcf4SKowalski, Kamil  * @brief Formats InsufficientPrivilege message into JSON
1648f4c4dcf4SKowalski, Kamil  *
1649f4c4dcf4SKowalski, Kamil  * See header file for more information
1650f4c4dcf4SKowalski, Kamil  * @endinternal
1651f4c4dcf4SKowalski, Kamil  */
1652d9fcfcc1SEd Tanous nlohmann::json insufficientPrivilege()
16531abe55efSEd Tanous {
1654fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::insufficientPrivilege, {});
1655b5c07418SJames Feist }
1656b5c07418SJames Feist 
1657b5c07418SJames Feist void insufficientPrivilege(crow::Response& res)
1658b5c07418SJames Feist {
1659b5c07418SJames Feist     res.result(boost::beast::http::status::forbidden);
1660b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
1661f4c4dcf4SKowalski, Kamil }
1662f4c4dcf4SKowalski, Kamil 
1663f4c4dcf4SKowalski, Kamil /**
1664f4c4dcf4SKowalski, Kamil  * @internal
1665f4c4dcf4SKowalski, Kamil  * @brief Formats PropertyValueModified message into JSON
1666f4c4dcf4SKowalski, Kamil  *
1667f4c4dcf4SKowalski, Kamil  * See header file for more information
1668f4c4dcf4SKowalski, Kamil  * @endinternal
1669f4c4dcf4SKowalski, Kamil  */
16701668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1,
167195b3ad73SEd Tanous                                      const nlohmann::json& arg2)
1672b5c07418SJames Feist {
1673bd79bce8SPatrick Williams     std::string arg2Str =
1674*034e1259SEd Tanous         arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1675fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyValueModified,
167695b3ad73SEd Tanous                   std::to_array<std::string_view>({arg1, arg2Str}));
1677b5c07418SJames Feist }
1678b5c07418SJames Feist 
16791668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1,
168095b3ad73SEd Tanous                            const nlohmann::json& arg2)
16811abe55efSEd Tanous {
1682f12894f8SJason M. Bills     res.result(boost::beast::http::status::ok);
1683b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
1684f4c4dcf4SKowalski, Kamil }
1685f4c4dcf4SKowalski, Kamil 
1686f4c4dcf4SKowalski, Kamil /**
1687f4c4dcf4SKowalski, Kamil  * @internal
1688f4c4dcf4SKowalski, Kamil  * @brief Formats AccountNotModified message into JSON
1689f4c4dcf4SKowalski, Kamil  *
1690f4c4dcf4SKowalski, Kamil  * See header file for more information
1691f4c4dcf4SKowalski, Kamil  * @endinternal
1692f4c4dcf4SKowalski, Kamil  */
1693d9fcfcc1SEd Tanous nlohmann::json accountNotModified()
16941abe55efSEd Tanous {
1695fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountNotModified, {});
1696b5c07418SJames Feist }
1697b5c07418SJames Feist 
1698b5c07418SJames Feist void accountNotModified(crow::Response& res)
1699b5c07418SJames Feist {
1700b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1701b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountNotModified());
1702f4c4dcf4SKowalski, Kamil }
1703f4c4dcf4SKowalski, Kamil 
1704f4c4dcf4SKowalski, Kamil /**
1705f4c4dcf4SKowalski, Kamil  * @internal
1706f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterValueFormatError message into JSON
1707f4c4dcf4SKowalski, Kamil  *
1708f4c4dcf4SKowalski, Kamil  * See header file for more information
1709f4c4dcf4SKowalski, Kamil  * @endinternal
1710f4c4dcf4SKowalski, Kamil  */
171195b3ad73SEd Tanous nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
17121668ce6dSEd Tanous                                               std::string_view arg2)
17131abe55efSEd Tanous {
1714bd79bce8SPatrick Williams     std::string arg1Str =
1715*034e1259SEd Tanous         arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
1716fffb8c1fSEd Tanous     return getLog(
1717fffb8c1fSEd Tanous         redfish::registries::base::Index::queryParameterValueFormatError,
171895b3ad73SEd Tanous         std::to_array<std::string_view>({arg1Str, arg2}));
1719b5c07418SJames Feist }
1720b5c07418SJames Feist 
1721bd79bce8SPatrick Williams void queryParameterValueFormatError(
1722bd79bce8SPatrick Williams     crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
1723b5c07418SJames Feist {
1724b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1725b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1726b5c07418SJames Feist                           queryParameterValueFormatError(arg1, arg2));
1727f4c4dcf4SKowalski, Kamil }
1728f4c4dcf4SKowalski, Kamil 
1729f4c4dcf4SKowalski, Kamil /**
1730f4c4dcf4SKowalski, Kamil  * @internal
1731b5c07418SJames Feist  * @brief Formats PropertyMissing message into JSON for the specified
1732b5c07418SJames Feist  * property
1733f12894f8SJason M. Bills  *
1734f12894f8SJason M. Bills  * See header file for more information
1735f12894f8SJason M. Bills  * @endinternal
1736f12894f8SJason M. Bills  */
17371668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1)
1738f12894f8SJason M. Bills {
1739fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::propertyMissing,
17401668ce6dSEd Tanous                   std::to_array({arg1}));
1741b5c07418SJames Feist }
1742b5c07418SJames Feist 
17431668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1)
1744b5c07418SJames Feist {
1745b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1746b5c07418SJames Feist     addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
1747f4c4dcf4SKowalski, Kamil }
1748f4c4dcf4SKowalski, Kamil 
1749f4c4dcf4SKowalski, Kamil /**
1750f4c4dcf4SKowalski, Kamil  * @internal
1751f4c4dcf4SKowalski, Kamil  * @brief Formats ResourceExhaustion message into JSON
1752f4c4dcf4SKowalski, Kamil  *
1753f4c4dcf4SKowalski, Kamil  * See header file for more information
1754f4c4dcf4SKowalski, Kamil  * @endinternal
1755f4c4dcf4SKowalski, Kamil  */
17561668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1)
17571abe55efSEd Tanous {
1758fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::resourceExhaustion,
17591668ce6dSEd Tanous                   std::to_array({arg1}));
1760b5c07418SJames Feist }
1761b5c07418SJames Feist 
17621668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1)
1763b5c07418SJames Feist {
1764b5c07418SJames Feist     res.result(boost::beast::http::status::service_unavailable);
1765b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
1766f4c4dcf4SKowalski, Kamil }
1767f4c4dcf4SKowalski, Kamil 
1768f4c4dcf4SKowalski, Kamil /**
1769f4c4dcf4SKowalski, Kamil  * @internal
1770f4c4dcf4SKowalski, Kamil  * @brief Formats AccountModified message into JSON
1771f4c4dcf4SKowalski, Kamil  *
1772f4c4dcf4SKowalski, Kamil  * See header file for more information
1773f4c4dcf4SKowalski, Kamil  * @endinternal
1774f4c4dcf4SKowalski, Kamil  */
1775d9fcfcc1SEd Tanous nlohmann::json accountModified()
17761abe55efSEd Tanous {
1777fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::accountModified, {});
1778b5c07418SJames Feist }
1779b5c07418SJames Feist 
1780b5c07418SJames Feist void accountModified(crow::Response& res)
1781b5c07418SJames Feist {
1782b5c07418SJames Feist     res.result(boost::beast::http::status::ok);
1783b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue, accountModified());
1784f4c4dcf4SKowalski, Kamil }
1785f4c4dcf4SKowalski, Kamil 
1786f4c4dcf4SKowalski, Kamil /**
1787f4c4dcf4SKowalski, Kamil  * @internal
1788f4c4dcf4SKowalski, Kamil  * @brief Formats QueryParameterOutOfRange message into JSON
1789f4c4dcf4SKowalski, Kamil  *
1790f4c4dcf4SKowalski, Kamil  * See header file for more information
1791f4c4dcf4SKowalski, Kamil  * @endinternal
1792f4c4dcf4SKowalski, Kamil  */
1793bd79bce8SPatrick Williams nlohmann::json queryParameterOutOfRange(
1794bd79bce8SPatrick Williams     std::string_view arg1, std::string_view arg2, std::string_view arg3)
17951abe55efSEd Tanous {
1796fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::queryParameterOutOfRange,
17971668ce6dSEd Tanous                   std::to_array({arg1, arg2, arg3}));
1798b5c07418SJames Feist }
1799b5c07418SJames Feist 
18001668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
18011668ce6dSEd Tanous                               std::string_view arg2, std::string_view arg3)
1802b5c07418SJames Feist {
1803b5c07418SJames Feist     res.result(boost::beast::http::status::bad_request);
1804b5c07418SJames Feist     addMessageToErrorJson(res.jsonValue,
1805b5c07418SJames Feist                           queryParameterOutOfRange(arg1, arg2, arg3));
1806f4c4dcf4SKowalski, Kamil }
1807f4c4dcf4SKowalski, Kamil 
18084a7fbefdSEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1)
1809b6cd31e1SEd Tanous {
1810fffb8c1fSEd Tanous     return getLog(redfish::registries::base::Index::passwordChangeRequired,
1811079360aeSEd Tanous                   std::to_array<std::string_view>({arg1.buffer()}));
1812b6cd31e1SEd Tanous }
1813b6cd31e1SEd Tanous 
18143bf4e632SJoseph Reynolds /**
18153bf4e632SJoseph Reynolds  * @internal
18163bf4e632SJoseph Reynolds  * @brief Formats PasswordChangeRequired message into JSON
18173bf4e632SJoseph Reynolds  *
18183bf4e632SJoseph Reynolds  * See header file for more information
18193bf4e632SJoseph Reynolds  * @endinternal
18203bf4e632SJoseph Reynolds  */
18214a7fbefdSEd Tanous void passwordChangeRequired(crow::Response& res,
18224a7fbefdSEd Tanous                             const boost::urls::url_view_base& arg1)
18233bf4e632SJoseph Reynolds {
1824b6cd31e1SEd Tanous     messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1));
18253bf4e632SJoseph Reynolds }
18263bf4e632SJoseph Reynolds 
18274cde5d90SJames Feist /**
18284cde5d90SJames Feist  * @internal
1829ae688313SNan Zhou  * @brief Formats InsufficientStorage message into JSON
1830ae688313SNan Zhou  *
1831ae688313SNan Zhou  * See header file for more information
1832ae688313SNan Zhou  * @endinternal
1833ae688313SNan Zhou  */
1834ae688313SNan Zhou nlohmann::json insufficientStorage()
1835ae688313SNan Zhou {
1836ae688313SNan Zhou     return getLog(redfish::registries::base::Index::insufficientStorage, {});
1837ae688313SNan Zhou }
1838ae688313SNan Zhou 
1839ae688313SNan Zhou void insufficientStorage(crow::Response& res)
1840ae688313SNan Zhou {
1841ae688313SNan Zhou     res.result(boost::beast::http::status::insufficient_storage);
1842ae688313SNan Zhou     addMessageToErrorJson(res.jsonValue, insufficientStorage());
1843ae688313SNan Zhou }
1844ae688313SNan Zhou 
1845ae688313SNan Zhou /**
1846ae688313SNan Zhou  * @internal
184744c70412SEd Tanous  * @brief Formats OperationNotAllowed message into JSON
184844c70412SEd Tanous  *
184944c70412SEd Tanous  * See header file for more information
185044c70412SEd Tanous  * @endinternal
185144c70412SEd Tanous  */
185244c70412SEd Tanous nlohmann::json operationNotAllowed()
185344c70412SEd Tanous {
185444c70412SEd Tanous     return getLog(redfish::registries::base::Index::operationNotAllowed, {});
185544c70412SEd Tanous }
185644c70412SEd Tanous 
185744c70412SEd Tanous void operationNotAllowed(crow::Response& res)
185844c70412SEd Tanous {
185944c70412SEd Tanous     res.result(boost::beast::http::status::method_not_allowed);
186044c70412SEd Tanous     addMessageToErrorJson(res.jsonValue, operationNotAllowed());
186144c70412SEd Tanous }
186244c70412SEd Tanous 
1863600af5f1SAppaRao Puli /**
1864600af5f1SAppaRao Puli  * @internal
1865600af5f1SAppaRao Puli  * @brief Formats ArraySizeTooLong message into JSON
1866600af5f1SAppaRao Puli  *
1867600af5f1SAppaRao Puli  * See header file for more information
1868600af5f1SAppaRao Puli  * @endinternal
1869600af5f1SAppaRao Puli  */
1870aaebeaafSEd Tanous nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2)
1871600af5f1SAppaRao Puli {
1872aaebeaafSEd Tanous     std::string arg2Str = std::to_string(arg2);
1873600af5f1SAppaRao Puli     return getLog(redfish::registries::base::Index::arraySizeTooLong,
1874aaebeaafSEd Tanous                   std::to_array<std::string_view>({arg1, arg2Str}));
1875600af5f1SAppaRao Puli }
1876600af5f1SAppaRao Puli 
1877aaebeaafSEd Tanous void arraySizeTooLong(crow::Response& res, std::string_view arg1, uint64_t arg2)
1878600af5f1SAppaRao Puli {
187999bf0262SDivya Jyoti     res.result(boost::beast::http::status::bad_request);
1880aaebeaafSEd Tanous     addMessageToErrorJson(res.jsonValue, arraySizeTooLong(arg1, arg2));
1881600af5f1SAppaRao Puli }
1882600af5f1SAppaRao Puli 
188344c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1,
188444c70412SEd Tanous                    std::string_view arg2)
188544c70412SEd Tanous {
188644c70412SEd Tanous     res.result(boost::beast::http::status::bad_request);
188744c70412SEd Tanous     addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2));
188844c70412SEd Tanous }
188944c70412SEd Tanous 
189044c70412SEd Tanous /**
189144c70412SEd Tanous  * @internal
18924cde5d90SJames Feist  * @brief Formats Invalid File message into JSON
18934cde5d90SJames Feist  *
18944cde5d90SJames Feist  * See header file for more information
18954cde5d90SJames Feist  * @endinternal
18964cde5d90SJames Feist  */
18971668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2)
18984cde5d90SJames Feist {
18991668ce6dSEd Tanous     std::string msg = "Invalid file uploaded to ";
19001668ce6dSEd Tanous     msg += arg1;
19011668ce6dSEd Tanous     msg += ": ";
19021668ce6dSEd Tanous     msg += arg2;
19031668ce6dSEd Tanous     msg += ".";
1904613dabeaSEd Tanous 
1905613dabeaSEd Tanous     nlohmann::json::object_t ret;
1906613dabeaSEd Tanous     ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message";
1907613dabeaSEd Tanous     ret["MessageId"] = "OpenBMC.0.2.InvalidUpload";
1908613dabeaSEd Tanous     ret["Message"] = std::move(msg);
1909613dabeaSEd Tanous     nlohmann::json::array_t args;
1910ad539545SPatrick Williams     args.emplace_back(arg1);
1911ad539545SPatrick Williams     args.emplace_back(arg2);
1912613dabeaSEd Tanous     ret["MessageArgs"] = std::move(args);
1913613dabeaSEd Tanous     ret["MessageSeverity"] = "Warning";
1914613dabeaSEd Tanous     ret["Resolution"] = "None.";
1915613dabeaSEd Tanous     return ret;
19164cde5d90SJames Feist }
1917ae688313SNan Zhou 
19187585b760SJishnu CM nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1)
19197585b760SJishnu CM {
19207585b760SJishnu CM     return getLog(redfish::registries::base::Index::generateSecretKeyRequired,
19217585b760SJishnu CM                   std::to_array<std::string_view>({arg1.buffer()}));
19227585b760SJishnu CM }
19237585b760SJishnu CM 
19247585b760SJishnu CM /**
19257585b760SJishnu CM  * @internal
19267585b760SJishnu CM  * @brief Formats GenerateSecretKeyRequired message into JSON
19277585b760SJishnu CM  *
19287585b760SJishnu CM  * See header file for more information
19297585b760SJishnu CM  * @endinternal
19307585b760SJishnu CM  */
19317585b760SJishnu CM void generateSecretKeyRequired(crow::Response& res,
19327585b760SJishnu CM                                const boost::urls::url_view_base& arg1)
19337585b760SJishnu CM {
19347585b760SJishnu CM     messages::addMessageToJsonRoot(res.jsonValue,
19357585b760SJishnu CM                                    generateSecretKeyRequired(arg1));
19367585b760SJishnu CM }
19377585b760SJishnu CM 
1938f4c4dcf4SKowalski, Kamil } // namespace messages
1939f4c4dcf4SKowalski, Kamil 
1940d425c6f6SEd Tanous } // namespace redfish
1941