1f4c4dcf4SKowalski, Kamil /* 2f4c4dcf4SKowalski, Kamil // Copyright (c) 2018 Intel Corporation 3f4c4dcf4SKowalski, Kamil // 4f4c4dcf4SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License"); 5f4c4dcf4SKowalski, Kamil // you may not use this file except in compliance with the License. 6f4c4dcf4SKowalski, Kamil // You may obtain a copy of the License at 7f4c4dcf4SKowalski, Kamil // 8f4c4dcf4SKowalski, Kamil // http://www.apache.org/licenses/LICENSE-2.0 9f4c4dcf4SKowalski, Kamil // 10f4c4dcf4SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software 11f4c4dcf4SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS, 12f4c4dcf4SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f4c4dcf4SKowalski, Kamil // See the License for the specific language governing permissions and 14f4c4dcf4SKowalski, Kamil // limitations under the License. 15f4c4dcf4SKowalski, Kamil */ 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 #include "source_location.hpp" 230442ef92SNan Zhou 240442ef92SNan Zhou #include <boost/beast/http/field.hpp> 259ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 26faf100f9SEd Tanous #include <nlohmann/json.hpp> 27f4c4dcf4SKowalski, Kamil 281668ce6dSEd Tanous #include <array> 290442ef92SNan Zhou #include <cstddef> 300442ef92SNan Zhou #include <span> 310442ef92SNan Zhou #include <string> 320442ef92SNan Zhou #include <utility> 330442ef92SNan Zhou 340442ef92SNan Zhou // IWYU pragma: no_include <stddef.h> 351668ce6dSEd Tanous 361abe55efSEd Tanous namespace redfish 371abe55efSEd Tanous { 381abe55efSEd Tanous 391abe55efSEd Tanous namespace messages 401abe55efSEd Tanous { 41f4c4dcf4SKowalski, Kamil 42f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 431abe55efSEd Tanous const nlohmann::json& message) 441abe55efSEd Tanous { 45f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 46f4c4dcf4SKowalski, Kamil 471abe55efSEd Tanous // If this is the first error message, fill in the information from the 481abe55efSEd Tanous // first error message to the top level struct 491abe55efSEd Tanous if (!error.is_object()) 501abe55efSEd Tanous { 51c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 52c074230bSJason M. Bills if (messageIdIterator == message.end()) 531abe55efSEd Tanous { 541abe55efSEd Tanous BMCWEB_LOG_CRITICAL 551abe55efSEd Tanous << "Attempt to add error message without MessageId"; 56f4c4dcf4SKowalski, Kamil return; 57f4c4dcf4SKowalski, Kamil } 58f4c4dcf4SKowalski, Kamil 59c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 60c074230bSJason M. Bills if (messageFieldIterator == message.end()) 611abe55efSEd Tanous { 621abe55efSEd Tanous BMCWEB_LOG_CRITICAL 631abe55efSEd Tanous << "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 */ 171b5c07418SJames Feist nlohmann::json resourceInUse(void) 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 */ 189b5c07418SJames Feist nlohmann::json malformedJSON(void) 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 */ 207d9f466b3SEd Tanous nlohmann::json resourceMissingAtURI(boost::urls::url_view 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 213d9f466b3SEd Tanous void resourceMissingAtURI(crow::Response& res, boost::urls::url_view arg1) 214b5c07418SJames Feist { 215b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 216b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 217f4c4dcf4SKowalski, Kamil } 218f4c4dcf4SKowalski, Kamil 219f4c4dcf4SKowalski, Kamil /** 220f4c4dcf4SKowalski, Kamil * @internal 221f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 222f4c4dcf4SKowalski, Kamil * 223f4c4dcf4SKowalski, Kamil * See header file for more information 224f4c4dcf4SKowalski, Kamil * @endinternal 225f4c4dcf4SKowalski, Kamil */ 2261668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2271668ce6dSEd Tanous std::string_view arg2, 2281668ce6dSEd Tanous std::string_view arg3) 2291abe55efSEd Tanous { 230fffb8c1fSEd Tanous return getLog( 231fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2321668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 233b5c07418SJames Feist } 234b5c07418SJames Feist 2351668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2361668ce6dSEd Tanous std::string_view arg2, 2371668ce6dSEd Tanous std::string_view arg3) 238b5c07418SJames Feist { 239b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 240b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 241b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 242f4c4dcf4SKowalski, Kamil } 243f4c4dcf4SKowalski, Kamil 244f4c4dcf4SKowalski, Kamil /** 245f4c4dcf4SKowalski, Kamil * @internal 2464ef82a15SAlex Schendel * @brief Formats ActionParameterValueNotInList message into JSON 2474ef82a15SAlex Schendel * 2484ef82a15SAlex Schendel * See header file for more information 2494ef82a15SAlex Schendel * @endinternal 2504ef82a15SAlex Schendel */ 2514ef82a15SAlex Schendel nlohmann::json actionParameterValueNotInList(std::string_view arg1, 2524ef82a15SAlex Schendel std::string_view arg2, 2534ef82a15SAlex Schendel std::string_view arg3) 2544ef82a15SAlex Schendel { 2554ef82a15SAlex Schendel return getLog( 2564ef82a15SAlex Schendel redfish::registries::base::Index::actionParameterValueNotInList, 2574ef82a15SAlex Schendel std::to_array({arg1, arg2, arg3})); 2584ef82a15SAlex Schendel } 2594ef82a15SAlex Schendel 2604ef82a15SAlex Schendel void actionParameterValueNotInList(crow::Response& res, std::string_view arg1, 2614ef82a15SAlex Schendel std::string_view arg2, std::string_view arg3) 2624ef82a15SAlex Schendel { 2634ef82a15SAlex Schendel res.result(boost::beast::http::status::bad_request); 2644ef82a15SAlex Schendel addMessageToErrorJson(res.jsonValue, 2654ef82a15SAlex Schendel actionParameterValueNotInList(arg1, arg2, arg3)); 2664ef82a15SAlex Schendel } 2674ef82a15SAlex Schendel 2684ef82a15SAlex Schendel /** 2694ef82a15SAlex Schendel * @internal 270f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 271f4c4dcf4SKowalski, Kamil * 272f4c4dcf4SKowalski, Kamil * See header file for more information 273f4c4dcf4SKowalski, Kamil * @endinternal 274f4c4dcf4SKowalski, Kamil */ 275b5c07418SJames Feist nlohmann::json internalError(void) 2761abe55efSEd Tanous { 277fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 278b5c07418SJames Feist } 279b5c07418SJames Feist 280df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 281b5c07418SJames Feist { 282df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 283df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 284df5415fcSEd Tanous << location.function_name() << "`: "; 285b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 286b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 287f12894f8SJason M. Bills } 288f12894f8SJason M. Bills 289f12894f8SJason M. Bills /** 290f12894f8SJason M. Bills * @internal 291f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 292f4c4dcf4SKowalski, Kamil * 293f4c4dcf4SKowalski, Kamil * See header file for more information 294f4c4dcf4SKowalski, Kamil * @endinternal 295f4c4dcf4SKowalski, Kamil */ 296b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2971abe55efSEd Tanous { 298fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 299fffb8c1fSEd Tanous {}); 300b5c07418SJames Feist } 301b5c07418SJames Feist 302b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 303b5c07418SJames Feist { 304b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 305b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 306f4c4dcf4SKowalski, Kamil } 307f4c4dcf4SKowalski, Kamil 308f4c4dcf4SKowalski, Kamil /** 309f4c4dcf4SKowalski, Kamil * @internal 310f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 311f4c4dcf4SKowalski, Kamil * 312f4c4dcf4SKowalski, Kamil * See header file for more information 313f4c4dcf4SKowalski, Kamil * @endinternal 314f4c4dcf4SKowalski, Kamil */ 315d9f466b3SEd Tanous nlohmann::json resourceAtUriUnauthorized(boost::urls::url_view arg1, 3161668ce6dSEd Tanous std::string_view arg2) 3171abe55efSEd Tanous { 318079360aeSEd Tanous return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, 319079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 320b5c07418SJames Feist } 321b5c07418SJames Feist 322d9f466b3SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, boost::urls::url_view arg1, 3231668ce6dSEd Tanous std::string_view arg2) 324b5c07418SJames Feist { 325b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 326b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 327f4c4dcf4SKowalski, Kamil } 328f4c4dcf4SKowalski, Kamil 329f4c4dcf4SKowalski, Kamil /** 330f4c4dcf4SKowalski, Kamil * @internal 331f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 332f4c4dcf4SKowalski, Kamil * 333f4c4dcf4SKowalski, Kamil * See header file for more information 334f4c4dcf4SKowalski, Kamil * @endinternal 335f4c4dcf4SKowalski, Kamil */ 3361668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 3371668ce6dSEd Tanous std::string_view arg2) 338b5c07418SJames Feist { 339fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 3401668ce6dSEd Tanous std::to_array({arg1, arg2})); 341b5c07418SJames Feist } 342b5c07418SJames Feist 3431668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3441668ce6dSEd Tanous std::string_view arg2) 3451abe55efSEd Tanous { 346f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 347b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 348f4c4dcf4SKowalski, Kamil } 349f4c4dcf4SKowalski, Kamil 350f4c4dcf4SKowalski, Kamil /** 351f4c4dcf4SKowalski, Kamil * @internal 352f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 353f4c4dcf4SKowalski, Kamil * 354f4c4dcf4SKowalski, Kamil * See header file for more information 355f4c4dcf4SKowalski, Kamil * @endinternal 356f4c4dcf4SKowalski, Kamil */ 357b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3581abe55efSEd Tanous { 359fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 360fffb8c1fSEd Tanous {}); 361b5c07418SJames Feist } 362b5c07418SJames Feist 363b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 364b5c07418SJames Feist { 36544c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 366b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 367f4c4dcf4SKowalski, Kamil } 368f4c4dcf4SKowalski, Kamil 369f4c4dcf4SKowalski, Kamil /** 370f4c4dcf4SKowalski, Kamil * @internal 371f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 372f4c4dcf4SKowalski, Kamil * 373f4c4dcf4SKowalski, Kamil * See header file for more information 374f4c4dcf4SKowalski, Kamil * @endinternal 375f4c4dcf4SKowalski, Kamil */ 3761668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3771abe55efSEd Tanous { 378fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3791668ce6dSEd Tanous std::to_array({arg1})); 380b5c07418SJames Feist } 381b5c07418SJames Feist 3821668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 383b5c07418SJames Feist { 384b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 385b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 386f4c4dcf4SKowalski, Kamil } 387f4c4dcf4SKowalski, Kamil 388f4c4dcf4SKowalski, Kamil /** 389f4c4dcf4SKowalski, Kamil * @internal 390f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 391f4c4dcf4SKowalski, Kamil * 392f4c4dcf4SKowalski, Kamil * See header file for more information 393f4c4dcf4SKowalski, Kamil * @endinternal 394f4c4dcf4SKowalski, Kamil */ 3951668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3961abe55efSEd Tanous { 397b6cd31e1SEd Tanous return getLog( 398fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3991668ce6dSEd Tanous std::to_array({arg1})); 400b5c07418SJames Feist } 401b5c07418SJames Feist 4021668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 403b5c07418SJames Feist { 404d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 405b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 406b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 407f4c4dcf4SKowalski, Kamil } 408f4c4dcf4SKowalski, Kamil 409f4c4dcf4SKowalski, Kamil /** 410f4c4dcf4SKowalski, Kamil * @internal 411f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 412f4c4dcf4SKowalski, Kamil * 413f4c4dcf4SKowalski, Kamil * See header file for more information 414f4c4dcf4SKowalski, Kamil * @endinternal 415f4c4dcf4SKowalski, Kamil */ 4161668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 4171668ce6dSEd Tanous std::string_view arg2, 4181668ce6dSEd Tanous std::string_view arg3) 4191abe55efSEd Tanous { 420fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 4211668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 422b5c07418SJames Feist } 423b5c07418SJames Feist 4241668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 4251668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 426b5c07418SJames Feist { 427b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 428b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 429a08b46ccSJason M. Bills arg2); 430f4c4dcf4SKowalski, Kamil } 431f4c4dcf4SKowalski, Kamil 432f4c4dcf4SKowalski, Kamil /** 433f4c4dcf4SKowalski, Kamil * @internal 434f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 435f4c4dcf4SKowalski, Kamil * 436f4c4dcf4SKowalski, Kamil * See header file for more information 437f4c4dcf4SKowalski, Kamil * @endinternal 438f4c4dcf4SKowalski, Kamil */ 439b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4401abe55efSEd Tanous { 441fffb8c1fSEd Tanous return getLog( 442fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 443b5c07418SJames Feist } 444b5c07418SJames Feist 445b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 446b5c07418SJames Feist { 447b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 448b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 449f4c4dcf4SKowalski, Kamil } 450f4c4dcf4SKowalski, Kamil 451f4c4dcf4SKowalski, Kamil /** 452f4c4dcf4SKowalski, Kamil * @internal 453f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 454f4c4dcf4SKowalski, Kamil * 455f4c4dcf4SKowalski, Kamil * See header file for more information 456f4c4dcf4SKowalski, Kamil * @endinternal 457f4c4dcf4SKowalski, Kamil */ 4581668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4591abe55efSEd Tanous { 460fffb8c1fSEd Tanous return getLog( 461fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4621668ce6dSEd Tanous std::to_array({arg1})); 463b5c07418SJames Feist } 464b5c07418SJames Feist 465b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4661668ce6dSEd Tanous std::string_view arg1) 467b5c07418SJames Feist { 468b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 469b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 470a08b46ccSJason M. Bills arg1); 471f12894f8SJason M. Bills } 472f12894f8SJason M. Bills 473f12894f8SJason M. Bills /** 474f12894f8SJason M. Bills * @internal 475f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 476f12894f8SJason M. Bills * property 477f12894f8SJason M. Bills * 478f12894f8SJason M. Bills * See header file for more information 479f12894f8SJason M. Bills * @endinternal 480f12894f8SJason M. Bills */ 4811668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4821668ce6dSEd Tanous std::string_view arg2) 483f12894f8SJason M. Bills { 484fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4851668ce6dSEd Tanous std::to_array({arg1, arg2})); 486b5c07418SJames Feist } 487b5c07418SJames Feist 4881668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4891668ce6dSEd Tanous std::string_view arg2) 490b5c07418SJames Feist { 491b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 492b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 493f12894f8SJason M. Bills } 494f12894f8SJason M. Bills 495f12894f8SJason M. Bills /** 496f12894f8SJason M. Bills * @internal 497f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 498f12894f8SJason M. Bills * property 499f12894f8SJason M. Bills * 500f12894f8SJason M. Bills * See header file for more information 501f12894f8SJason M. Bills * @endinternal 502f12894f8SJason M. Bills */ 503e2616cc5SEd Tanous 504e2616cc5SEd Tanous nlohmann::json propertyValueNotInList(const nlohmann::json& arg1, 5051668ce6dSEd Tanous std::string_view arg2) 506f12894f8SJason M. Bills { 507e2616cc5SEd Tanous std::string arg1Str = arg1.dump(-1, ' ', true, 508e2616cc5SEd Tanous nlohmann::json::error_handler_t::replace); 509fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 510e2616cc5SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 511b5c07418SJames Feist } 512b5c07418SJames Feist 513e2616cc5SEd Tanous void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1, 5141668ce6dSEd Tanous std::string_view arg2) 515b5c07418SJames Feist { 516b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 517b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 518f4c4dcf4SKowalski, Kamil } 519f4c4dcf4SKowalski, Kamil 520f4c4dcf4SKowalski, Kamil /** 521f4c4dcf4SKowalski, Kamil * @internal 522227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 523227a2b0aSJiaqing Zhao * 524227a2b0aSJiaqing Zhao * See header file for more information 525227a2b0aSJiaqing Zhao * @endinternal 526227a2b0aSJiaqing Zhao */ 527227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 528227a2b0aSJiaqing Zhao std::string_view arg2) 529227a2b0aSJiaqing Zhao { 530227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 531227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 532227a2b0aSJiaqing Zhao } 533227a2b0aSJiaqing Zhao 534227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 535227a2b0aSJiaqing Zhao std::string_view arg2) 536227a2b0aSJiaqing Zhao { 537227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 538227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 539227a2b0aSJiaqing Zhao } 540227a2b0aSJiaqing Zhao 541227a2b0aSJiaqing Zhao /** 542227a2b0aSJiaqing Zhao * @internal 543f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 544f4c4dcf4SKowalski, Kamil * 545f4c4dcf4SKowalski, Kamil * See header file for more information 546f4c4dcf4SKowalski, Kamil * @endinternal 547f4c4dcf4SKowalski, Kamil */ 548d9f466b3SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(boost::urls::url_view arg1) 5491abe55efSEd Tanous { 550b6cd31e1SEd Tanous return getLog( 551fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 552079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 553b5c07418SJames Feist } 554b5c07418SJames Feist 555ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 556d9f466b3SEd Tanous boost::urls::url_view arg1) 557b5c07418SJames Feist { 558b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 559b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 560f4c4dcf4SKowalski, Kamil } 561f4c4dcf4SKowalski, Kamil 562f4c4dcf4SKowalski, Kamil /** 563f4c4dcf4SKowalski, Kamil * @internal 56481856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 56581856681SAsmitha Karunanithi * 56681856681SAsmitha Karunanithi * See header file for more information 56781856681SAsmitha Karunanithi * @endinternal 56881856681SAsmitha Karunanithi */ 5691668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 57081856681SAsmitha Karunanithi { 571fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5721668ce6dSEd Tanous std::to_array({arg1})); 57381856681SAsmitha Karunanithi } 57481856681SAsmitha Karunanithi 5751668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 57681856681SAsmitha Karunanithi { 57781856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 57881856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 57981856681SAsmitha Karunanithi } 58081856681SAsmitha Karunanithi 58181856681SAsmitha Karunanithi /** 58281856681SAsmitha Karunanithi * @internal 583f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 584f4c4dcf4SKowalski, Kamil * 585f4c4dcf4SKowalski, Kamil * See header file for more information 586f4c4dcf4SKowalski, Kamil * @endinternal 587f4c4dcf4SKowalski, Kamil */ 588b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5891abe55efSEd Tanous { 590fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 591b5c07418SJames Feist } 592b5c07418SJames Feist 593b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 594b5c07418SJames Feist { 595b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 596b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 597f4c4dcf4SKowalski, Kamil } 598f4c4dcf4SKowalski, Kamil 599f4c4dcf4SKowalski, Kamil /** 600f4c4dcf4SKowalski, Kamil * @internal 601f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 602f4c4dcf4SKowalski, Kamil * 603f4c4dcf4SKowalski, Kamil * See header file for more information 604f4c4dcf4SKowalski, Kamil * @endinternal 605f4c4dcf4SKowalski, Kamil */ 606b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 6071abe55efSEd Tanous { 608fffb8c1fSEd Tanous return getLog( 609fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 610b5c07418SJames Feist } 611b5c07418SJames Feist 612b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 613b5c07418SJames Feist { 614789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 615b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 616f4c4dcf4SKowalski, Kamil } 617f4c4dcf4SKowalski, Kamil 618f4c4dcf4SKowalski, Kamil /** 619f4c4dcf4SKowalski, Kamil * @internal 620f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 621f4c4dcf4SKowalski, Kamil * 622f4c4dcf4SKowalski, Kamil * See header file for more information 623f4c4dcf4SKowalski, Kamil * @endinternal 624f4c4dcf4SKowalski, Kamil */ 6251668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 6261668ce6dSEd Tanous std::string_view arg2) 6271abe55efSEd Tanous { 628fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 6291668ce6dSEd Tanous std::to_array({arg1, arg2})); 630b5c07418SJames Feist } 631b5c07418SJames Feist 6321668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 6331668ce6dSEd Tanous std::string_view arg2) 634b5c07418SJames Feist { 635b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 636b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 637f4c4dcf4SKowalski, Kamil } 638f4c4dcf4SKowalski, Kamil 639f4c4dcf4SKowalski, Kamil /** 640f4c4dcf4SKowalski, Kamil * @internal 641f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 642f4c4dcf4SKowalski, Kamil * 643f4c4dcf4SKowalski, Kamil * See header file for more information 644f4c4dcf4SKowalski, Kamil * @endinternal 645f4c4dcf4SKowalski, Kamil */ 6461668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 6471abe55efSEd Tanous { 648b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 649fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 6501668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 651b5c07418SJames Feist } 652b5c07418SJames Feist 6531668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 654b5c07418SJames Feist { 655b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 656b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 657f4c4dcf4SKowalski, Kamil } 658f4c4dcf4SKowalski, Kamil 659f4c4dcf4SKowalski, Kamil /** 660f4c4dcf4SKowalski, Kamil * @internal 661cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 662cc9139ecSJason M. Bills * 663cc9139ecSJason M. Bills * See header file for more information 664cc9139ecSJason M. Bills * @endinternal 665cc9139ecSJason M. Bills */ 666b5c07418SJames Feist nlohmann::json sessionTerminated(void) 667cc9139ecSJason M. Bills { 668fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 669b5c07418SJames Feist } 670b5c07418SJames Feist 671b5c07418SJames Feist void sessionTerminated(crow::Response& res) 672b5c07418SJames Feist { 673b5c07418SJames Feist res.result(boost::beast::http::status::ok); 674b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 675cc9139ecSJason M. Bills } 676cc9139ecSJason M. Bills 677cc9139ecSJason M. Bills /** 678cc9139ecSJason M. Bills * @internal 679684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 680684bb4b8SJason M. Bills * 681684bb4b8SJason M. Bills * See header file for more information 682684bb4b8SJason M. Bills * @endinternal 683684bb4b8SJason M. Bills */ 684684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 685684bb4b8SJason M. Bills { 686fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 687684bb4b8SJason M. Bills } 688684bb4b8SJason M. Bills 689684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 690684bb4b8SJason M. Bills { 691684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 692684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 693684bb4b8SJason M. Bills } 694684bb4b8SJason M. Bills 695684bb4b8SJason M. Bills /** 696684bb4b8SJason M. Bills * @internal 697cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 698cc9139ecSJason M. Bills * 699cc9139ecSJason M. Bills * See header file for more information 700cc9139ecSJason M. Bills * @endinternal 701cc9139ecSJason M. Bills */ 7021668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 7031668ce6dSEd Tanous std::string_view arg2) 704cc9139ecSJason M. Bills { 705fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 7061668ce6dSEd Tanous std::to_array({arg1, arg2})); 707b5c07418SJames Feist } 708b5c07418SJames Feist 7091668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 7101668ce6dSEd Tanous std::string_view arg2) 711b5c07418SJames Feist { 712b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 713b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 714cc9139ecSJason M. Bills } 715cc9139ecSJason M. Bills 716cc9139ecSJason M. Bills /** 717cc9139ecSJason M. Bills * @internal 718684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 719684bb4b8SJason M. Bills * 720684bb4b8SJason M. Bills * See header file for more information 721684bb4b8SJason M. Bills * @endinternal 722684bb4b8SJason M. Bills */ 723d9f466b3SEd Tanous nlohmann::json resetRequired(boost::urls::url_view arg1, std::string_view arg2) 724684bb4b8SJason M. Bills { 725fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 726079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 727684bb4b8SJason M. Bills } 728684bb4b8SJason M. Bills 729d9f466b3SEd Tanous void resetRequired(crow::Response& res, boost::urls::url_view arg1, 7301668ce6dSEd Tanous std::string_view arg2) 731684bb4b8SJason M. Bills { 732684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 733684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 734684bb4b8SJason M. Bills } 735684bb4b8SJason M. Bills 736684bb4b8SJason M. Bills /** 737684bb4b8SJason M. Bills * @internal 738684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 739684bb4b8SJason M. Bills * 740684bb4b8SJason M. Bills * See header file for more information 741684bb4b8SJason M. Bills * @endinternal 742684bb4b8SJason M. Bills */ 7431668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 744684bb4b8SJason M. Bills { 745fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7461668ce6dSEd Tanous std::to_array({arg1})); 747684bb4b8SJason M. Bills } 748684bb4b8SJason M. Bills 7491668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 750684bb4b8SJason M. Bills { 751684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 752684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 753684bb4b8SJason M. Bills } 754684bb4b8SJason M. Bills 755684bb4b8SJason M. Bills /** 756684bb4b8SJason M. Bills * @internal 757684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 758684bb4b8SJason M. Bills * 759684bb4b8SJason M. Bills * See header file for more information 760684bb4b8SJason M. Bills * @endinternal 761684bb4b8SJason M. Bills */ 7621668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 763684bb4b8SJason M. Bills { 764b6cd31e1SEd Tanous return getLog( 765fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7661668ce6dSEd Tanous std::to_array({arg1})); 767684bb4b8SJason M. Bills } 768684bb4b8SJason M. Bills 7691668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 770684bb4b8SJason M. Bills { 771684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 772684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 773684bb4b8SJason M. Bills } 774684bb4b8SJason M. Bills 775684bb4b8SJason M. Bills /** 776684bb4b8SJason M. Bills * @internal 777684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 778684bb4b8SJason M. Bills * 779684bb4b8SJason M. Bills * See header file for more information 780684bb4b8SJason M. Bills * @endinternal 781684bb4b8SJason M. Bills */ 7821668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7831668ce6dSEd Tanous std::string_view arg2) 784684bb4b8SJason M. Bills { 785fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7861668ce6dSEd Tanous std::to_array({arg1, arg2})); 787684bb4b8SJason M. Bills } 788684bb4b8SJason M. Bills 7891668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7901668ce6dSEd Tanous std::string_view arg2) 791684bb4b8SJason M. Bills { 792684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 793684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 794684bb4b8SJason M. Bills } 795684bb4b8SJason M. Bills 796684bb4b8SJason M. Bills /** 797684bb4b8SJason M. Bills * @internal 7982a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7992a6af81cSRamesh Iyyar * 8002a6af81cSRamesh Iyyar * See header file for more information 8012a6af81cSRamesh Iyyar * @endinternal 8022a6af81cSRamesh Iyyar */ 8032a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 8042a6af81cSRamesh Iyyar std::string_view arg2, 805d9f466b3SEd Tanous boost::urls::url_view arg3) 8062a6af81cSRamesh Iyyar { 8072a6af81cSRamesh Iyyar return getLog( 8082a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 809079360aeSEd Tanous std::to_array<std::string_view>({arg1, arg2, arg3.buffer()})); 8102a6af81cSRamesh Iyyar } 8112a6af81cSRamesh Iyyar 8122a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 8132a6af81cSRamesh Iyyar std::string_view arg2, 814d9f466b3SEd Tanous boost::urls::url_view arg3) 8152a6af81cSRamesh Iyyar { 8162a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 8172a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 8182a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 8192a6af81cSRamesh Iyyar } 8202a6af81cSRamesh Iyyar 8212a6af81cSRamesh Iyyar /** 8222a6af81cSRamesh Iyyar * @internal 82324861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 82424861a28SRamesh Iyyar * 82524861a28SRamesh Iyyar * See header file for more information 82624861a28SRamesh Iyyar * @endinternal 82724861a28SRamesh Iyyar */ 82824861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 82924861a28SRamesh Iyyar std::string_view arg2) 83024861a28SRamesh Iyyar { 83124861a28SRamesh Iyyar return getLog( 83224861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 83324861a28SRamesh Iyyar std::to_array({arg1, arg2})); 83424861a28SRamesh Iyyar } 83524861a28SRamesh Iyyar 83624861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 83724861a28SRamesh Iyyar std::string_view arg2) 83824861a28SRamesh Iyyar { 83924861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 84024861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 84124861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 84224861a28SRamesh Iyyar } 84324861a28SRamesh Iyyar 84424861a28SRamesh Iyyar /** 84524861a28SRamesh Iyyar * @internal 846684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 847684bb4b8SJason M. Bills * 848684bb4b8SJason M. Bills * See header file for more information 849684bb4b8SJason M. Bills * @endinternal 850684bb4b8SJason M. Bills */ 8511668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8521668ce6dSEd Tanous std::string_view arg2) 853684bb4b8SJason M. Bills { 854fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8551668ce6dSEd Tanous std::to_array({arg1, arg2})); 856684bb4b8SJason M. Bills } 857684bb4b8SJason M. Bills 8581668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8591668ce6dSEd Tanous std::string_view arg2) 860684bb4b8SJason M. Bills { 861684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 862684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 863684bb4b8SJason M. Bills } 864684bb4b8SJason M. Bills 865684bb4b8SJason M. Bills /** 866684bb4b8SJason M. Bills * @internal 867684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 868684bb4b8SJason M. Bills * 869684bb4b8SJason M. Bills * See header file for more information 870684bb4b8SJason M. Bills * @endinternal 871684bb4b8SJason M. Bills */ 872d9f466b3SEd Tanous nlohmann::json resourceCreationConflict(boost::urls::url_view arg1) 873684bb4b8SJason M. Bills { 874fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 875079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 876684bb4b8SJason M. Bills } 877684bb4b8SJason M. Bills 878d9f466b3SEd Tanous void resourceCreationConflict(crow::Response& res, boost::urls::url_view arg1) 879684bb4b8SJason M. Bills { 880684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 881684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 882684bb4b8SJason M. Bills } 883684bb4b8SJason M. Bills 884684bb4b8SJason M. Bills /** 885684bb4b8SJason M. Bills * @internal 886684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 887684bb4b8SJason M. Bills * 888684bb4b8SJason M. Bills * See header file for more information 889684bb4b8SJason M. Bills * @endinternal 890684bb4b8SJason M. Bills */ 891684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 892684bb4b8SJason M. Bills { 893fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 894684bb4b8SJason M. Bills } 895684bb4b8SJason M. Bills 896684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 897684bb4b8SJason M. Bills { 898684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 899684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 900684bb4b8SJason M. Bills } 901684bb4b8SJason M. Bills 902684bb4b8SJason M. Bills /** 903684bb4b8SJason M. Bills * @internal 904684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 905684bb4b8SJason M. Bills * 906684bb4b8SJason M. Bills * See header file for more information 907684bb4b8SJason M. Bills * @endinternal 908684bb4b8SJason M. Bills */ 909684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 910684bb4b8SJason M. Bills { 911fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 912684bb4b8SJason M. Bills } 913684bb4b8SJason M. Bills 914684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 915684bb4b8SJason M. Bills { 9164df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 917684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 918684bb4b8SJason M. Bills } 919684bb4b8SJason M. Bills 920684bb4b8SJason M. Bills /** 921684bb4b8SJason M. Bills * @internal 922684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 923684bb4b8SJason M. Bills * 924684bb4b8SJason M. Bills * See header file for more information 925684bb4b8SJason M. Bills * @endinternal 926684bb4b8SJason M. Bills */ 927684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 928684bb4b8SJason M. Bills { 929fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 930684bb4b8SJason M. Bills } 931684bb4b8SJason M. Bills 932684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 933684bb4b8SJason M. Bills { 934684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 935684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 936684bb4b8SJason M. Bills } 937684bb4b8SJason M. Bills 938684bb4b8SJason M. Bills /** 939684bb4b8SJason M. Bills * @internal 940684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 941684bb4b8SJason M. Bills * 942684bb4b8SJason M. Bills * See header file for more information 943684bb4b8SJason M. Bills * @endinternal 944684bb4b8SJason M. Bills */ 945684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 946684bb4b8SJason M. Bills { 947fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 948684bb4b8SJason M. Bills } 949684bb4b8SJason M. Bills 950684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 951684bb4b8SJason M. Bills { 9528868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 953684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 954684bb4b8SJason M. Bills } 955684bb4b8SJason M. Bills 956684bb4b8SJason M. Bills /** 957684bb4b8SJason M. Bills * @internal 958684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 959684bb4b8SJason M. Bills * 960684bb4b8SJason M. Bills * See header file for more information 961684bb4b8SJason M. Bills * @endinternal 962684bb4b8SJason M. Bills */ 963684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 964684bb4b8SJason M. Bills { 965fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 966684bb4b8SJason M. Bills } 967684bb4b8SJason M. Bills 968684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 969684bb4b8SJason M. Bills { 970684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 971684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 972684bb4b8SJason M. Bills } 973684bb4b8SJason M. Bills 974684bb4b8SJason M. Bills /** 975684bb4b8SJason M. Bills * @internal 976f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 977f12894f8SJason M. Bills * property 978f12894f8SJason M. Bills * 979f12894f8SJason M. Bills * See header file for more information 980f12894f8SJason M. Bills * @endinternal 981f12894f8SJason M. Bills */ 982*2e8c4bdaSEd Tanous nlohmann::json propertyValueTypeError(const nlohmann::json& arg1, 9831668ce6dSEd Tanous std::string_view arg2) 984f12894f8SJason M. Bills { 985*2e8c4bdaSEd Tanous std::string arg1Str = arg1.dump(2, ' ', true, 986*2e8c4bdaSEd Tanous nlohmann::json::error_handler_t::replace); 987fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 988*2e8c4bdaSEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 989b5c07418SJames Feist } 990b5c07418SJames Feist 991*2e8c4bdaSEd Tanous void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1, 9921668ce6dSEd Tanous std::string_view arg2) 993b5c07418SJames Feist { 994b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 995b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 996f4c4dcf4SKowalski, Kamil } 997f4c4dcf4SKowalski, Kamil 998f4c4dcf4SKowalski, Kamil /** 999f4c4dcf4SKowalski, Kamil * @internal 1000b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 1001f4c4dcf4SKowalski, Kamil * 1002f4c4dcf4SKowalski, Kamil * See header file for more information 1003f4c4dcf4SKowalski, Kamil * @endinternal 1004f4c4dcf4SKowalski, Kamil */ 10051668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 10061abe55efSEd Tanous { 1007fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 10081668ce6dSEd Tanous std::to_array({arg1, arg2})); 1009b5c07418SJames Feist } 1010b5c07418SJames Feist 10111668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 10121668ce6dSEd Tanous std::string_view arg2) 1013b5c07418SJames Feist { 1014b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1015b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1016f4c4dcf4SKowalski, Kamil } 1017f4c4dcf4SKowalski, Kamil 1018f4c4dcf4SKowalski, Kamil /** 1019f4c4dcf4SKowalski, Kamil * @internal 1020f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1021f4c4dcf4SKowalski, Kamil * 1022f4c4dcf4SKowalski, Kamil * See header file for more information 1023f4c4dcf4SKowalski, Kamil * @endinternal 1024f4c4dcf4SKowalski, Kamil */ 1025d9f466b3SEd Tanous nlohmann::json couldNotEstablishConnection(boost::urls::url_view arg1) 10261abe55efSEd Tanous { 1027fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 1028079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1029b5c07418SJames Feist } 1030b5c07418SJames Feist 1031ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1032d9f466b3SEd Tanous boost::urls::url_view arg1) 1033b5c07418SJames Feist { 1034b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1035b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1036f4c4dcf4SKowalski, Kamil } 1037f4c4dcf4SKowalski, Kamil 1038f4c4dcf4SKowalski, Kamil /** 1039f4c4dcf4SKowalski, Kamil * @internal 1040f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1041f12894f8SJason M. Bills * property 1042f12894f8SJason M. Bills * 1043f12894f8SJason M. Bills * See header file for more information 1044f12894f8SJason M. Bills * @endinternal 1045f12894f8SJason M. Bills */ 10461668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 1047f12894f8SJason M. Bills { 1048fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 10491668ce6dSEd Tanous std::to_array({arg1})); 1050b5c07418SJames Feist } 1051b5c07418SJames Feist 10521668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1053b5c07418SJames Feist { 1054b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1055b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1056f4c4dcf4SKowalski, Kamil } 1057f4c4dcf4SKowalski, Kamil 1058f4c4dcf4SKowalski, Kamil /** 1059f4c4dcf4SKowalski, Kamil * @internal 1060f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1061f4c4dcf4SKowalski, Kamil * 1062f4c4dcf4SKowalski, Kamil * See header file for more information 1063f4c4dcf4SKowalski, Kamil * @endinternal 1064f4c4dcf4SKowalski, Kamil */ 10651668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10661668ce6dSEd Tanous std::string_view arg2) 10671abe55efSEd Tanous { 1068b6cd31e1SEd Tanous return getLog( 1069fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10701668ce6dSEd Tanous std::to_array({arg1, arg2})); 1071b5c07418SJames Feist } 1072b5c07418SJames Feist 10731668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10741668ce6dSEd Tanous std::string_view arg2) 1075b5c07418SJames Feist { 1076b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1077b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1078b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1079f4c4dcf4SKowalski, Kamil } 1080f4c4dcf4SKowalski, Kamil 1081f4c4dcf4SKowalski, Kamil /** 1082f4c4dcf4SKowalski, Kamil * @internal 1083f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1084f4c4dcf4SKowalski, Kamil * 1085f4c4dcf4SKowalski, Kamil * See header file for more information 1086f4c4dcf4SKowalski, Kamil * @endinternal 1087f4c4dcf4SKowalski, Kamil */ 1088b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10891abe55efSEd Tanous { 1090fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1091b5c07418SJames Feist } 1092b5c07418SJames Feist 1093b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1094b5c07418SJames Feist { 1095b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1096b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1097f4c4dcf4SKowalski, Kamil } 1098f4c4dcf4SKowalski, Kamil 1099f4c4dcf4SKowalski, Kamil /** 1100f4c4dcf4SKowalski, Kamil * @internal 1101f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1102f4c4dcf4SKowalski, Kamil * 1103f4c4dcf4SKowalski, Kamil * See header file for more information 1104f4c4dcf4SKowalski, Kamil * @endinternal 1105f4c4dcf4SKowalski, Kamil */ 11061668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 11071668ce6dSEd Tanous std::string_view arg2) 11081abe55efSEd Tanous { 1109fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 11101668ce6dSEd Tanous std::to_array({arg1, arg2})); 1111b5c07418SJames Feist } 1112b5c07418SJames Feist 11131668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 11141668ce6dSEd Tanous std::string_view arg2) 1115b5c07418SJames Feist { 1116b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1117b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1118f4c4dcf4SKowalski, Kamil } 1119f4c4dcf4SKowalski, Kamil 1120f4c4dcf4SKowalski, Kamil /** 1121f4c4dcf4SKowalski, Kamil * @internal 1122f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1123f4c4dcf4SKowalski, Kamil * 1124f4c4dcf4SKowalski, Kamil * See header file for more information 1125f4c4dcf4SKowalski, Kamil * @endinternal 1126f4c4dcf4SKowalski, Kamil */ 11271668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 11281668ce6dSEd Tanous std::string_view arg2) 11291abe55efSEd Tanous { 1130fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 11311668ce6dSEd Tanous std::to_array({arg1, arg2})); 1132b5c07418SJames Feist } 1133b5c07418SJames Feist 11341668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 11351668ce6dSEd Tanous std::string_view arg2) 1136b5c07418SJames Feist { 1137b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1138b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1139b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1140f4c4dcf4SKowalski, Kamil } 1141f4c4dcf4SKowalski, Kamil 1142f4c4dcf4SKowalski, Kamil /** 1143f4c4dcf4SKowalski, Kamil * @internal 1144f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1145f4c4dcf4SKowalski, Kamil * 1146f4c4dcf4SKowalski, Kamil * See header file for more information 1147f4c4dcf4SKowalski, Kamil * @endinternal 1148f4c4dcf4SKowalski, Kamil */ 1149d9f466b3SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(boost::urls::url_view arg1, 11501668ce6dSEd Tanous std::string_view arg2) 11511abe55efSEd Tanous { 1152b6cd31e1SEd Tanous return getLog( 1153fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 1154079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1155b5c07418SJames Feist } 1156b5c07418SJames Feist 1157ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1158d9f466b3SEd Tanous boost::urls::url_view arg1, 11591668ce6dSEd Tanous std::string_view arg2) 1160b5c07418SJames Feist { 1161b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1162b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1163b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1164f4c4dcf4SKowalski, Kamil } 1165f4c4dcf4SKowalski, Kamil 1166f4c4dcf4SKowalski, Kamil /** 1167f4c4dcf4SKowalski, Kamil * @internal 1168b4ad4c05SShantappa Teekappanavar * @brief Formats StrictAccountTypes message into JSON 1169b4ad4c05SShantappa Teekappanavar * 1170b4ad4c05SShantappa Teekappanavar * See header file for more information 1171b4ad4c05SShantappa Teekappanavar * @endinternal 1172b4ad4c05SShantappa Teekappanavar */ 1173b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1) 1174b4ad4c05SShantappa Teekappanavar { 1175b4ad4c05SShantappa Teekappanavar return getLog(redfish::registries::base::Index::strictAccountTypes, 1176b4ad4c05SShantappa Teekappanavar std::to_array({arg1})); 1177b4ad4c05SShantappa Teekappanavar } 1178b4ad4c05SShantappa Teekappanavar 1179b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1) 1180b4ad4c05SShantappa Teekappanavar { 1181b4ad4c05SShantappa Teekappanavar res.result(boost::beast::http::status::bad_request); 1182b4ad4c05SShantappa Teekappanavar addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 1183b4ad4c05SShantappa Teekappanavar } 1184b4ad4c05SShantappa Teekappanavar 1185b4ad4c05SShantappa Teekappanavar /** 1186b4ad4c05SShantappa Teekappanavar * @internal 1187f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1188f4c4dcf4SKowalski, Kamil * 1189f4c4dcf4SKowalski, Kamil * See header file for more information 1190f4c4dcf4SKowalski, Kamil * @endinternal 1191f4c4dcf4SKowalski, Kamil */ 1192b5c07418SJames Feist nlohmann::json accountRemoved(void) 11931abe55efSEd Tanous { 1194fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1195b5c07418SJames Feist } 1196b5c07418SJames Feist 1197b5c07418SJames Feist void accountRemoved(crow::Response& res) 1198b5c07418SJames Feist { 1199b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1200b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1201f4c4dcf4SKowalski, Kamil } 1202f4c4dcf4SKowalski, Kamil 1203f4c4dcf4SKowalski, Kamil /** 1204f4c4dcf4SKowalski, Kamil * @internal 1205f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1206f4c4dcf4SKowalski, Kamil * 1207f4c4dcf4SKowalski, Kamil * See header file for more information 1208f4c4dcf4SKowalski, Kamil * @endinternal 1209f4c4dcf4SKowalski, Kamil */ 1210d9f466b3SEd Tanous nlohmann::json accessDenied(boost::urls::url_view arg1) 12111abe55efSEd Tanous { 1212fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 1213079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1214b5c07418SJames Feist } 1215b5c07418SJames Feist 1216d9f466b3SEd Tanous void accessDenied(crow::Response& res, boost::urls::url_view arg1) 1217b5c07418SJames Feist { 1218b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1219b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1220f4c4dcf4SKowalski, Kamil } 1221f4c4dcf4SKowalski, Kamil 1222f4c4dcf4SKowalski, Kamil /** 1223f4c4dcf4SKowalski, Kamil * @internal 1224f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1225f4c4dcf4SKowalski, Kamil * 1226f4c4dcf4SKowalski, Kamil * See header file for more information 1227f4c4dcf4SKowalski, Kamil * @endinternal 1228f4c4dcf4SKowalski, Kamil */ 1229b5c07418SJames Feist nlohmann::json queryNotSupported(void) 12301abe55efSEd Tanous { 1231fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1232b5c07418SJames Feist } 1233b5c07418SJames Feist 1234b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1235b5c07418SJames Feist { 1236b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1237b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1238f4c4dcf4SKowalski, Kamil } 1239f4c4dcf4SKowalski, Kamil 1240f4c4dcf4SKowalski, Kamil /** 1241f4c4dcf4SKowalski, Kamil * @internal 1242f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1243f4c4dcf4SKowalski, Kamil * 1244f4c4dcf4SKowalski, Kamil * See header file for more information 1245f4c4dcf4SKowalski, Kamil * @endinternal 1246f4c4dcf4SKowalski, Kamil */ 1247b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 12481abe55efSEd Tanous { 1249b6cd31e1SEd Tanous return getLog( 1250fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1251b5c07418SJames Feist } 1252b5c07418SJames Feist 1253b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1254b5c07418SJames Feist { 1255b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1256b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1257f4c4dcf4SKowalski, Kamil } 1258f4c4dcf4SKowalski, Kamil 1259f4c4dcf4SKowalski, Kamil /** 1260f4c4dcf4SKowalski, Kamil * @internal 1261f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1262f4c4dcf4SKowalski, Kamil * 1263f4c4dcf4SKowalski, Kamil * See header file for more information 1264f4c4dcf4SKowalski, Kamil * @endinternal 1265f4c4dcf4SKowalski, Kamil */ 1266b5c07418SJames Feist nlohmann::json generalError(void) 12671abe55efSEd Tanous { 1268fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1269b5c07418SJames Feist } 1270b5c07418SJames Feist 1271b5c07418SJames Feist void generalError(crow::Response& res) 1272b5c07418SJames Feist { 1273b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1274b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1275f4c4dcf4SKowalski, Kamil } 1276f4c4dcf4SKowalski, Kamil 1277f4c4dcf4SKowalski, Kamil /** 1278f4c4dcf4SKowalski, Kamil * @internal 1279f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1280f4c4dcf4SKowalski, Kamil * 1281f4c4dcf4SKowalski, Kamil * See header file for more information 1282f4c4dcf4SKowalski, Kamil * @endinternal 1283f4c4dcf4SKowalski, Kamil */ 1284b5c07418SJames Feist nlohmann::json success(void) 12851abe55efSEd Tanous { 1286fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1287b5c07418SJames Feist } 1288b5c07418SJames Feist 1289b5c07418SJames Feist void success(crow::Response& res) 1290b5c07418SJames Feist { 1291b5c07418SJames Feist // don't set res.result here because success is the default and any 1292b5c07418SJames Feist // error should overwrite the default 1293b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1294f12894f8SJason M. Bills } 1295f12894f8SJason M. Bills 1296f12894f8SJason M. Bills /** 1297f12894f8SJason M. Bills * @internal 1298f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1299f4c4dcf4SKowalski, Kamil * 1300f4c4dcf4SKowalski, Kamil * See header file for more information 1301f4c4dcf4SKowalski, Kamil * @endinternal 1302f4c4dcf4SKowalski, Kamil */ 1303b5c07418SJames Feist nlohmann::json created(void) 13041abe55efSEd Tanous { 1305fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1306b5c07418SJames Feist } 1307b5c07418SJames Feist 1308b5c07418SJames Feist void created(crow::Response& res) 1309b5c07418SJames Feist { 1310b5c07418SJames Feist res.result(boost::beast::http::status::created); 1311b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1312f4c4dcf4SKowalski, Kamil } 1313f4c4dcf4SKowalski, Kamil 1314f4c4dcf4SKowalski, Kamil /** 1315f4c4dcf4SKowalski, Kamil * @internal 1316cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1317cc9139ecSJason M. Bills * 1318cc9139ecSJason M. Bills * See header file for more information 1319cc9139ecSJason M. Bills * @endinternal 1320cc9139ecSJason M. Bills */ 1321b5c07418SJames Feist nlohmann::json noOperation(void) 1322cc9139ecSJason M. Bills { 1323fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1324b5c07418SJames Feist } 1325b5c07418SJames Feist 1326b5c07418SJames Feist void noOperation(crow::Response& res) 1327b5c07418SJames Feist { 1328b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1329b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1330cc9139ecSJason M. Bills } 1331cc9139ecSJason M. Bills 1332cc9139ecSJason M. Bills /** 1333cc9139ecSJason M. Bills * @internal 1334b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1335b5c07418SJames Feist * property 1336f12894f8SJason M. Bills * 1337f12894f8SJason M. Bills * See header file for more information 1338f12894f8SJason M. Bills * @endinternal 1339f12894f8SJason M. Bills */ 13401668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1341b5c07418SJames Feist { 1342fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 13431668ce6dSEd Tanous std::to_array({arg1})); 1344b5c07418SJames Feist } 1345b5c07418SJames Feist 13461668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1347f12894f8SJason M. Bills { 1348f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 13497b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1350f4c4dcf4SKowalski, Kamil } 1351f4c4dcf4SKowalski, Kamil 1352f4c4dcf4SKowalski, Kamil /** 1353f4c4dcf4SKowalski, Kamil * @internal 1354f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1355f4c4dcf4SKowalski, Kamil * 1356f4c4dcf4SKowalski, Kamil * See header file for more information 1357f4c4dcf4SKowalski, Kamil * @endinternal 1358f4c4dcf4SKowalski, Kamil */ 1359b5c07418SJames Feist nlohmann::json noValidSession(void) 13601abe55efSEd Tanous { 1361fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1362b5c07418SJames Feist } 1363b5c07418SJames Feist 1364b5c07418SJames Feist void noValidSession(crow::Response& res) 1365b5c07418SJames Feist { 1366b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1367b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1368f4c4dcf4SKowalski, Kamil } 1369f4c4dcf4SKowalski, Kamil 1370f4c4dcf4SKowalski, Kamil /** 1371f4c4dcf4SKowalski, Kamil * @internal 1372f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1373f4c4dcf4SKowalski, Kamil * 1374f4c4dcf4SKowalski, Kamil * See header file for more information 1375f4c4dcf4SKowalski, Kamil * @endinternal 1376f4c4dcf4SKowalski, Kamil */ 1377d9f466b3SEd Tanous nlohmann::json invalidObject(boost::urls::url_view arg1) 13781abe55efSEd Tanous { 1379fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 1380079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1381b5c07418SJames Feist } 1382b5c07418SJames Feist 1383d9f466b3SEd Tanous void invalidObject(crow::Response& res, boost::urls::url_view arg1) 1384b5c07418SJames Feist { 1385b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1386b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1387f4c4dcf4SKowalski, Kamil } 1388f4c4dcf4SKowalski, Kamil 1389f4c4dcf4SKowalski, Kamil /** 1390f4c4dcf4SKowalski, Kamil * @internal 1391f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1392f4c4dcf4SKowalski, Kamil * 1393f4c4dcf4SKowalski, Kamil * See header file for more information 1394f4c4dcf4SKowalski, Kamil * @endinternal 1395f4c4dcf4SKowalski, Kamil */ 1396b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13971abe55efSEd Tanous { 1398fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1399b5c07418SJames Feist } 1400b5c07418SJames Feist 1401b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1402b5c07418SJames Feist { 1403b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1404b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1405f4c4dcf4SKowalski, Kamil } 1406f4c4dcf4SKowalski, Kamil 1407f4c4dcf4SKowalski, Kamil /** 1408f4c4dcf4SKowalski, Kamil * @internal 1409f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1410f4c4dcf4SKowalski, Kamil * 1411f4c4dcf4SKowalski, Kamil * See header file for more information 1412f4c4dcf4SKowalski, Kamil * @endinternal 1413f4c4dcf4SKowalski, Kamil */ 14141668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 14151668ce6dSEd Tanous std::string_view arg2, 14161668ce6dSEd Tanous std::string_view arg3) 14171abe55efSEd Tanous { 1418b6cd31e1SEd Tanous return getLog( 1419fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 14201668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1421b5c07418SJames Feist } 1422b5c07418SJames Feist 14231668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 14241668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1425b5c07418SJames Feist { 1426b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1427b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1428b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1429f4c4dcf4SKowalski, Kamil } 1430f4c4dcf4SKowalski, Kamil 1431f4c4dcf4SKowalski, Kamil /** 1432f4c4dcf4SKowalski, Kamil * @internal 1433f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1434f4c4dcf4SKowalski, Kamil * 1435f4c4dcf4SKowalski, Kamil * See header file for more information 1436f4c4dcf4SKowalski, Kamil * @endinternal 1437f4c4dcf4SKowalski, Kamil */ 1438b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 14391abe55efSEd Tanous { 1440fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1441b5c07418SJames Feist } 1442b5c07418SJames Feist 1443b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1444b5c07418SJames Feist { 1445b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1446b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1447f4c4dcf4SKowalski, Kamil } 1448f4c4dcf4SKowalski, Kamil 1449f4c4dcf4SKowalski, Kamil /** 1450f4c4dcf4SKowalski, Kamil * @internal 1451f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1452f4c4dcf4SKowalski, Kamil * 1453f4c4dcf4SKowalski, Kamil * See header file for more information 1454f4c4dcf4SKowalski, Kamil * @endinternal 1455f4c4dcf4SKowalski, Kamil */ 14561668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 14571abe55efSEd Tanous { 1458fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 14591668ce6dSEd Tanous std::to_array({arg1})); 1460b5c07418SJames Feist } 1461b5c07418SJames Feist 14621668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1463b5c07418SJames Feist { 1464b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1465b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1466f4c4dcf4SKowalski, Kamil } 1467f4c4dcf4SKowalski, Kamil 1468f4c4dcf4SKowalski, Kamil /** 1469f4c4dcf4SKowalski, Kamil * @internal 1470f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1471f4c4dcf4SKowalski, Kamil * 1472f4c4dcf4SKowalski, Kamil * See header file for more information 1473f4c4dcf4SKowalski, Kamil * @endinternal 1474f4c4dcf4SKowalski, Kamil */ 14755187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14761abe55efSEd Tanous { 1477b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1478fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14791668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1480b5c07418SJames Feist } 1481b5c07418SJames Feist 14825187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1483b5c07418SJames Feist { 1484b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1485b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1486f4c4dcf4SKowalski, Kamil } 1487f4c4dcf4SKowalski, Kamil 1488f4c4dcf4SKowalski, Kamil /** 1489f4c4dcf4SKowalski, Kamil * @internal 1490f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1491f4c4dcf4SKowalski, Kamil * 1492f4c4dcf4SKowalski, Kamil * See header file for more information 1493f4c4dcf4SKowalski, Kamil * @endinternal 1494f4c4dcf4SKowalski, Kamil */ 1495b5c07418SJames Feist nlohmann::json emptyJSON(void) 14961abe55efSEd Tanous { 1497fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1498b5c07418SJames Feist } 1499b5c07418SJames Feist 1500b5c07418SJames Feist void emptyJSON(crow::Response& res) 1501b5c07418SJames Feist { 1502b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1503b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1504f4c4dcf4SKowalski, Kamil } 1505f4c4dcf4SKowalski, Kamil 1506f4c4dcf4SKowalski, Kamil /** 1507f4c4dcf4SKowalski, Kamil * @internal 1508f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1509f4c4dcf4SKowalski, Kamil * 1510f4c4dcf4SKowalski, Kamil * See header file for more information 1511f4c4dcf4SKowalski, Kamil * @endinternal 1512f4c4dcf4SKowalski, Kamil */ 1513b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 15141abe55efSEd Tanous { 1515fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1516b6cd31e1SEd Tanous {}); 1517b5c07418SJames Feist } 1518b5c07418SJames Feist 1519b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1520b5c07418SJames Feist { 15216a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1522b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1523f4c4dcf4SKowalski, Kamil } 1524f4c4dcf4SKowalski, Kamil 1525f4c4dcf4SKowalski, Kamil /** 1526f4c4dcf4SKowalski, Kamil * @internal 1527684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1528684bb4b8SJason M. Bills * 1529684bb4b8SJason M. Bills * See header file for more information 1530684bb4b8SJason M. Bills * @endinternal 1531684bb4b8SJason M. Bills */ 1532684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1533684bb4b8SJason M. Bills { 1534b6cd31e1SEd Tanous return getLog( 1535fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1536684bb4b8SJason M. Bills } 1537684bb4b8SJason M. Bills 1538684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1539684bb4b8SJason M. Bills { 15406a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1541684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1542684bb4b8SJason M. Bills } 1543684bb4b8SJason M. Bills 1544684bb4b8SJason M. Bills /** 1545684bb4b8SJason M. Bills * @internal 1546684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1547684bb4b8SJason M. Bills * 1548684bb4b8SJason M. Bills * See header file for more information 1549684bb4b8SJason M. Bills * @endinternal 1550684bb4b8SJason M. Bills */ 1551684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1552684bb4b8SJason M. Bills { 1553fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1554fffb8c1fSEd Tanous {}); 1555684bb4b8SJason M. Bills } 1556684bb4b8SJason M. Bills 1557684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1558684bb4b8SJason M. Bills { 1559684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1560684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1561684bb4b8SJason M. Bills } 1562684bb4b8SJason M. Bills 1563684bb4b8SJason M. Bills /** 1564684bb4b8SJason M. Bills * @internal 1565f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1566f4c4dcf4SKowalski, Kamil * 1567f4c4dcf4SKowalski, Kamil * See header file for more information 1568f4c4dcf4SKowalski, Kamil * @endinternal 1569f4c4dcf4SKowalski, Kamil */ 1570b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15711abe55efSEd Tanous { 1572fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1573b5c07418SJames Feist } 1574b5c07418SJames Feist 1575b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1576b5c07418SJames Feist { 1577b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1578b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1579f4c4dcf4SKowalski, Kamil } 1580f4c4dcf4SKowalski, Kamil 1581f4c4dcf4SKowalski, Kamil /** 1582f4c4dcf4SKowalski, Kamil * @internal 1583f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1584f4c4dcf4SKowalski, Kamil * 1585f4c4dcf4SKowalski, Kamil * See header file for more information 1586f4c4dcf4SKowalski, Kamil * @endinternal 1587f4c4dcf4SKowalski, Kamil */ 15881668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15891668ce6dSEd Tanous std::string_view arg2) 1590b5c07418SJames Feist { 1591fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15921668ce6dSEd Tanous std::to_array({arg1, arg2})); 1593b5c07418SJames Feist } 1594b5c07418SJames Feist 15951668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15961668ce6dSEd Tanous std::string_view arg2) 15971abe55efSEd Tanous { 1598f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1599b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1600f4c4dcf4SKowalski, Kamil } 1601f4c4dcf4SKowalski, Kamil 1602f4c4dcf4SKowalski, Kamil /** 1603f4c4dcf4SKowalski, Kamil * @internal 1604f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1605f4c4dcf4SKowalski, Kamil * 1606f4c4dcf4SKowalski, Kamil * See header file for more information 1607f4c4dcf4SKowalski, Kamil * @endinternal 1608f4c4dcf4SKowalski, Kamil */ 1609b5c07418SJames Feist nlohmann::json accountNotModified(void) 16101abe55efSEd Tanous { 1611fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1612b5c07418SJames Feist } 1613b5c07418SJames Feist 1614b5c07418SJames Feist void accountNotModified(crow::Response& res) 1615b5c07418SJames Feist { 1616b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1617b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1618f4c4dcf4SKowalski, Kamil } 1619f4c4dcf4SKowalski, Kamil 1620f4c4dcf4SKowalski, Kamil /** 1621f4c4dcf4SKowalski, Kamil * @internal 1622f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1623f4c4dcf4SKowalski, Kamil * 1624f4c4dcf4SKowalski, Kamil * See header file for more information 1625f4c4dcf4SKowalski, Kamil * @endinternal 1626f4c4dcf4SKowalski, Kamil */ 16271668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 16281668ce6dSEd Tanous std::string_view arg2) 16291abe55efSEd Tanous { 1630fffb8c1fSEd Tanous return getLog( 1631fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 16321668ce6dSEd Tanous std::to_array({arg1, arg2})); 1633b5c07418SJames Feist } 1634b5c07418SJames Feist 16351668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 16361668ce6dSEd Tanous std::string_view arg2) 1637b5c07418SJames Feist { 1638b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1639b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1640b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1641f4c4dcf4SKowalski, Kamil } 1642f4c4dcf4SKowalski, Kamil 1643f4c4dcf4SKowalski, Kamil /** 1644f4c4dcf4SKowalski, Kamil * @internal 1645b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1646b5c07418SJames Feist * property 1647f12894f8SJason M. Bills * 1648f12894f8SJason M. Bills * See header file for more information 1649f12894f8SJason M. Bills * @endinternal 1650f12894f8SJason M. Bills */ 16511668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1652f12894f8SJason M. Bills { 1653fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 16541668ce6dSEd Tanous std::to_array({arg1})); 1655b5c07418SJames Feist } 1656b5c07418SJames Feist 16571668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1658b5c07418SJames Feist { 1659b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1660b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1661f4c4dcf4SKowalski, Kamil } 1662f4c4dcf4SKowalski, Kamil 1663f4c4dcf4SKowalski, Kamil /** 1664f4c4dcf4SKowalski, Kamil * @internal 1665f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1666f4c4dcf4SKowalski, Kamil * 1667f4c4dcf4SKowalski, Kamil * See header file for more information 1668f4c4dcf4SKowalski, Kamil * @endinternal 1669f4c4dcf4SKowalski, Kamil */ 16701668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16711abe55efSEd Tanous { 1672fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16731668ce6dSEd Tanous std::to_array({arg1})); 1674b5c07418SJames Feist } 1675b5c07418SJames Feist 16761668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1677b5c07418SJames Feist { 1678b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1679b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1680f4c4dcf4SKowalski, Kamil } 1681f4c4dcf4SKowalski, Kamil 1682f4c4dcf4SKowalski, Kamil /** 1683f4c4dcf4SKowalski, Kamil * @internal 1684f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1685f4c4dcf4SKowalski, Kamil * 1686f4c4dcf4SKowalski, Kamil * See header file for more information 1687f4c4dcf4SKowalski, Kamil * @endinternal 1688f4c4dcf4SKowalski, Kamil */ 1689b5c07418SJames Feist nlohmann::json accountModified(void) 16901abe55efSEd Tanous { 1691fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1692b5c07418SJames Feist } 1693b5c07418SJames Feist 1694b5c07418SJames Feist void accountModified(crow::Response& res) 1695b5c07418SJames Feist { 1696b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1697b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1698f4c4dcf4SKowalski, Kamil } 1699f4c4dcf4SKowalski, Kamil 1700f4c4dcf4SKowalski, Kamil /** 1701f4c4dcf4SKowalski, Kamil * @internal 1702f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1703f4c4dcf4SKowalski, Kamil * 1704f4c4dcf4SKowalski, Kamil * See header file for more information 1705f4c4dcf4SKowalski, Kamil * @endinternal 1706f4c4dcf4SKowalski, Kamil */ 17071668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 17081668ce6dSEd Tanous std::string_view arg2, 17091668ce6dSEd Tanous std::string_view arg3) 17101abe55efSEd Tanous { 1711fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 17121668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1713b5c07418SJames Feist } 1714b5c07418SJames Feist 17151668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 17161668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1717b5c07418SJames Feist { 1718b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1719b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1720b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1721f4c4dcf4SKowalski, Kamil } 1722f4c4dcf4SKowalski, Kamil 1723d9f466b3SEd Tanous nlohmann::json passwordChangeRequired(boost::urls::url_view arg1) 1724b6cd31e1SEd Tanous { 1725fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 1726079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1727b6cd31e1SEd Tanous } 1728b6cd31e1SEd Tanous 17293bf4e632SJoseph Reynolds /** 17303bf4e632SJoseph Reynolds * @internal 17313bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 17323bf4e632SJoseph Reynolds * 17333bf4e632SJoseph Reynolds * See header file for more information 17343bf4e632SJoseph Reynolds * @endinternal 17353bf4e632SJoseph Reynolds */ 1736d9f466b3SEd Tanous void passwordChangeRequired(crow::Response& res, boost::urls::url_view arg1) 17373bf4e632SJoseph Reynolds { 1738b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 17393bf4e632SJoseph Reynolds } 17403bf4e632SJoseph Reynolds 17414cde5d90SJames Feist /** 17424cde5d90SJames Feist * @internal 1743ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1744ae688313SNan Zhou * 1745ae688313SNan Zhou * See header file for more information 1746ae688313SNan Zhou * @endinternal 1747ae688313SNan Zhou */ 1748ae688313SNan Zhou nlohmann::json insufficientStorage() 1749ae688313SNan Zhou { 1750ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1751ae688313SNan Zhou } 1752ae688313SNan Zhou 1753ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1754ae688313SNan Zhou { 1755ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1756ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1757ae688313SNan Zhou } 1758ae688313SNan Zhou 1759ae688313SNan Zhou /** 1760ae688313SNan Zhou * @internal 176144c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 176244c70412SEd Tanous * 176344c70412SEd Tanous * See header file for more information 176444c70412SEd Tanous * @endinternal 176544c70412SEd Tanous */ 176644c70412SEd Tanous nlohmann::json operationNotAllowed() 176744c70412SEd Tanous { 176844c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 176944c70412SEd Tanous } 177044c70412SEd Tanous 177144c70412SEd Tanous void operationNotAllowed(crow::Response& res) 177244c70412SEd Tanous { 177344c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 177444c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 177544c70412SEd Tanous } 177644c70412SEd Tanous 1777600af5f1SAppaRao Puli /** 1778600af5f1SAppaRao Puli * @internal 1779600af5f1SAppaRao Puli * @brief Formats ArraySizeTooLong message into JSON 1780600af5f1SAppaRao Puli * 1781600af5f1SAppaRao Puli * See header file for more information 1782600af5f1SAppaRao Puli * @endinternal 1783600af5f1SAppaRao Puli */ 1784600af5f1SAppaRao Puli nlohmann::json arraySizeTooLong(std::string_view property, uint64_t length) 1785600af5f1SAppaRao Puli { 1786600af5f1SAppaRao Puli std::string valStr = std::to_string(length); 1787600af5f1SAppaRao Puli return getLog(redfish::registries::base::Index::arraySizeTooLong, 1788600af5f1SAppaRao Puli std::to_array<std::string_view>({property, valStr})); 1789600af5f1SAppaRao Puli } 1790600af5f1SAppaRao Puli 1791600af5f1SAppaRao Puli void arraySizeTooLong(crow::Response& res, std::string_view property, 1792600af5f1SAppaRao Puli uint64_t length) 1793600af5f1SAppaRao Puli { 1794600af5f1SAppaRao Puli res.result(boost::beast::http::status::method_not_allowed); 1795600af5f1SAppaRao Puli addMessageToErrorJson(res.jsonValue, arraySizeTooLong(property, length)); 1796600af5f1SAppaRao Puli } 1797600af5f1SAppaRao Puli 179844c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 179944c70412SEd Tanous std::string_view arg2) 180044c70412SEd Tanous { 180144c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 180244c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 180344c70412SEd Tanous } 180444c70412SEd Tanous 180544c70412SEd Tanous /** 180644c70412SEd Tanous * @internal 18074cde5d90SJames Feist * @brief Formats Invalid File message into JSON 18084cde5d90SJames Feist * 18094cde5d90SJames Feist * See header file for more information 18104cde5d90SJames Feist * @endinternal 18114cde5d90SJames Feist */ 18121668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 18134cde5d90SJames Feist { 18141668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 18151668ce6dSEd Tanous msg += arg1; 18161668ce6dSEd Tanous msg += ": "; 18171668ce6dSEd Tanous msg += arg2; 18181668ce6dSEd Tanous msg += "."; 1819613dabeaSEd Tanous 1820613dabeaSEd Tanous nlohmann::json::object_t ret; 1821613dabeaSEd Tanous ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message"; 1822613dabeaSEd Tanous ret["MessageId"] = "OpenBMC.0.2.InvalidUpload"; 1823613dabeaSEd Tanous ret["Message"] = std::move(msg); 1824613dabeaSEd Tanous nlohmann::json::array_t args; 1825ad539545SPatrick Williams args.emplace_back(arg1); 1826ad539545SPatrick Williams args.emplace_back(arg2); 1827613dabeaSEd Tanous ret["MessageArgs"] = std::move(args); 1828613dabeaSEd Tanous ret["MessageSeverity"] = "Warning"; 1829613dabeaSEd Tanous ret["Resolution"] = "None."; 1830613dabeaSEd Tanous return ret; 18314cde5d90SJames Feist } 1832ae688313SNan Zhou 1833f4c4dcf4SKowalski, Kamil } // namespace messages 1834f4c4dcf4SKowalski, Kamil 1835d425c6f6SEd Tanous } // namespace redfish 1836