17ccfe684SEd Tanous /**************************************************************** 27ccfe684SEd Tanous * READ THIS WARNING FIRST 37ccfe684SEd Tanous * This is an auto-generated header which contains definitions 47ccfe684SEd Tanous * for Redfish DMTF defined messages. 57ccfe684SEd Tanous * DO NOT modify this registry outside of running the 67ccfe684SEd Tanous * parse_registries.py script. The definitions contained within 77ccfe684SEd Tanous * this file are owned by DMTF. Any modifications to these files 87ccfe684SEd Tanous * should be first pushed to the relevant registry in the DMTF 97ccfe684SEd Tanous * github organization. 107ccfe684SEd Tanous ***************************************************************/ 110442ef92SNan Zhou #include "error_messages.hpp" 129ea15c35SEd Tanous 130442ef92SNan Zhou #include "http_response.hpp" 140442ef92SNan Zhou #include "logging.hpp" 150442ef92SNan Zhou #include "registries.hpp" 160442ef92SNan Zhou #include "registries/base_message_registry.hpp" 170442ef92SNan Zhou 180442ef92SNan Zhou #include <boost/beast/http/field.hpp> 199ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 204a7fbefdSEd Tanous #include <boost/url/url_view_base.hpp> 21faf100f9SEd Tanous #include <nlohmann/json.hpp> 22f4c4dcf4SKowalski, Kamil 231668ce6dSEd Tanous #include <array> 240442ef92SNan Zhou #include <cstddef> 25f0b59af4SEd Tanous #include <cstdint> 26d85418e3SPatrick Williams #include <source_location> 270442ef92SNan Zhou #include <span> 280442ef92SNan Zhou #include <string> 29f0b59af4SEd Tanous #include <string_view> 300442ef92SNan Zhou 317ccfe684SEd Tanous // Clang can't seem to decide whether this header needs to be included or not, 327ccfe684SEd Tanous // and is inconsistent. Include it for now 337ccfe684SEd Tanous // NOLINTNEXTLINE(misc-include-cleaner) 347ccfe684SEd Tanous #include <utility> 357ccfe684SEd 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 { 5462598e31SEd Tanous BMCWEB_LOG_CRITICAL( 5562598e31SEd 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 { 6262598e31SEd Tanous BMCWEB_LOG_CRITICAL("Attempt to add error message without Message"); 63f4c4dcf4SKowalski, Kamil return; 64f4c4dcf4SKowalski, Kamil } 651476687dSEd Tanous error["code"] = *messageIdIterator; 661476687dSEd Tanous error["message"] = *messageFieldIterator; 671abe55efSEd Tanous } 681abe55efSEd Tanous else 691abe55efSEd Tanous { 70f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 7155c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 72cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 73cc9139ecSJason M. Bills "information on how to resolve the error."; 74f4c4dcf4SKowalski, Kamil } 75f4c4dcf4SKowalski, Kamil 763590bd1dSNan Zhou // This check could technically be done in the default construction 77f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 78f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 79c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 80c074230bSJason M. Bills if (!extendedInfo.is_array()) 811abe55efSEd Tanous { 82c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 83f4c4dcf4SKowalski, Kamil } 84f4c4dcf4SKowalski, Kamil 85c074230bSJason M. Bills extendedInfo.push_back(message); 86f4c4dcf4SKowalski, Kamil } 87f4c4dcf4SKowalski, Kamil 883590bd1dSNan Zhou void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source) 893590bd1dSNan Zhou { 903590bd1dSNan Zhou if (!source.is_object()) 913590bd1dSNan Zhou { 923590bd1dSNan Zhou return; 933590bd1dSNan Zhou } 943590bd1dSNan Zhou auto errorIt = source.find("error"); 953590bd1dSNan Zhou if (errorIt == source.end()) 963590bd1dSNan Zhou { 973590bd1dSNan Zhou // caller puts error message in root 983590bd1dSNan Zhou messages::addMessageToErrorJson(target, source); 993590bd1dSNan Zhou source.clear(); 1003590bd1dSNan Zhou return; 1013590bd1dSNan Zhou } 1023590bd1dSNan Zhou auto extendedInfoIt = errorIt->find(messages::messageAnnotation); 1033590bd1dSNan Zhou if (extendedInfoIt == errorIt->end()) 1043590bd1dSNan Zhou { 1053590bd1dSNan Zhou return; 1063590bd1dSNan Zhou } 1073590bd1dSNan Zhou const nlohmann::json::array_t* extendedInfo = 1083590bd1dSNan Zhou (*extendedInfoIt).get_ptr<const nlohmann::json::array_t*>(); 1093590bd1dSNan Zhou if (extendedInfo == nullptr) 1103590bd1dSNan Zhou { 1113590bd1dSNan Zhou source.erase(errorIt); 1123590bd1dSNan Zhou return; 1133590bd1dSNan Zhou } 1143590bd1dSNan Zhou for (const nlohmann::json& message : *extendedInfo) 1153590bd1dSNan Zhou { 1163590bd1dSNan Zhou addMessageToErrorJson(target, message); 1173590bd1dSNan Zhou } 1183590bd1dSNan Zhou source.erase(errorIt); 1193590bd1dSNan Zhou } 1203590bd1dSNan Zhou 121f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 122f12894f8SJason M. Bills const nlohmann::json& message) 1231abe55efSEd Tanous { 1241abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 1251abe55efSEd Tanous { 126f4c4dcf4SKowalski, Kamil // Force object to be an array 12755c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 128f4c4dcf4SKowalski, Kamil } 129f4c4dcf4SKowalski, Kamil 13055c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 131f4c4dcf4SKowalski, Kamil } 132f4c4dcf4SKowalski, Kamil 133f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 134f12894f8SJason M. Bills const nlohmann::json& message, 1351668ce6dSEd Tanous std::string_view fieldPath) 1361abe55efSEd Tanous { 1371668ce6dSEd Tanous std::string extendedInfo(fieldPath); 1381668ce6dSEd Tanous extendedInfo += messages::messageAnnotation; 139f4c4dcf4SKowalski, Kamil 1401668ce6dSEd Tanous nlohmann::json& field = target[extendedInfo]; 1411668ce6dSEd Tanous if (!field.is_array()) 1421abe55efSEd Tanous { 143f4c4dcf4SKowalski, Kamil // Force object to be an array 1441668ce6dSEd Tanous field = nlohmann::json::array(); 145f4c4dcf4SKowalski, Kamil } 146f4c4dcf4SKowalski, Kamil 147f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 1481668ce6dSEd Tanous field.push_back(message); 149f4c4dcf4SKowalski, Kamil } 150f4c4dcf4SKowalski, Kamil 151f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name, 152b6cd31e1SEd Tanous std::span<const std::string_view> args) 153b6cd31e1SEd Tanous { 154b6cd31e1SEd Tanous size_t index = static_cast<size_t>(name); 155fffb8c1fSEd Tanous if (index >= redfish::registries::base::registry.size()) 156b6cd31e1SEd Tanous { 157b6cd31e1SEd Tanous return {}; 158b6cd31e1SEd Tanous } 15965e4f1f7SEd Tanous return getLogFromRegistry(redfish::registries::base::header, 16065e4f1f7SEd Tanous redfish::registries::base::registry, index, args); 161b6cd31e1SEd Tanous } 162b6cd31e1SEd Tanous 163f4c4dcf4SKowalski, Kamil /** 164f4c4dcf4SKowalski, Kamil * @internal 165f8cca876SEd Tanous * @brief Formats Success message into JSON 166f4c4dcf4SKowalski, Kamil * 167f4c4dcf4SKowalski, Kamil * See header file for more information 168f4c4dcf4SKowalski, Kamil * @endinternal 169f4c4dcf4SKowalski, Kamil */ 170f8cca876SEd Tanous nlohmann::json success() 1711abe55efSEd Tanous { 172f8cca876SEd Tanous return getLog(redfish::registries::base::Index::success, {}); 173b5c07418SJames Feist } 174b5c07418SJames Feist 175f8cca876SEd Tanous void success(crow::Response& res) 176b5c07418SJames Feist { 177f8cca876SEd Tanous addMessageToJsonRoot(res.jsonValue, success()); 178f4c4dcf4SKowalski, Kamil } 179f4c4dcf4SKowalski, Kamil 180f4c4dcf4SKowalski, Kamil /** 181f4c4dcf4SKowalski, Kamil * @internal 182f8cca876SEd Tanous * @brief Formats GeneralError message into JSON 183f4c4dcf4SKowalski, Kamil * 184f4c4dcf4SKowalski, Kamil * See header file for more information 185f4c4dcf4SKowalski, Kamil * @endinternal 186f4c4dcf4SKowalski, Kamil */ 187f8cca876SEd Tanous nlohmann::json generalError() 1881abe55efSEd Tanous { 189f8cca876SEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 190b5c07418SJames Feist } 191b5c07418SJames Feist 192f8cca876SEd Tanous void generalError(crow::Response& res) 193b5c07418SJames Feist { 194b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 195f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, generalError()); 196f12894f8SJason M. Bills } 197f12894f8SJason M. Bills 198f12894f8SJason M. Bills /** 199f12894f8SJason M. Bills * @internal 200f8cca876SEd Tanous * @brief Formats Created message into JSON 201f4c4dcf4SKowalski, Kamil * 202f4c4dcf4SKowalski, Kamil * See header file for more information 203f4c4dcf4SKowalski, Kamil * @endinternal 204f4c4dcf4SKowalski, Kamil */ 205f8cca876SEd Tanous nlohmann::json created() 2061abe55efSEd Tanous { 207f8cca876SEd Tanous return getLog(redfish::registries::base::Index::created, {}); 208b5c07418SJames Feist } 209b5c07418SJames Feist 210f8cca876SEd Tanous void created(crow::Response& res) 211f8cca876SEd Tanous { 212f8cca876SEd Tanous res.result(boost::beast::http::status::created); 213f8cca876SEd Tanous addMessageToJsonRoot(res.jsonValue, created()); 214f8cca876SEd Tanous } 215f8cca876SEd Tanous 216f8cca876SEd Tanous /** 217f8cca876SEd Tanous * @internal 218f8cca876SEd Tanous * @brief Formats NoOperation message into JSON 219f8cca876SEd Tanous * 220f8cca876SEd Tanous * See header file for more information 221f8cca876SEd Tanous * @endinternal 222f8cca876SEd Tanous */ 223f8cca876SEd Tanous nlohmann::json noOperation() 224f8cca876SEd Tanous { 225f8cca876SEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 226f8cca876SEd Tanous } 227f8cca876SEd Tanous 228f8cca876SEd Tanous void noOperation(crow::Response& res) 229b5c07418SJames Feist { 230b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 231f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, noOperation()); 232f4c4dcf4SKowalski, Kamil } 233f4c4dcf4SKowalski, Kamil 234f4c4dcf4SKowalski, Kamil /** 235f4c4dcf4SKowalski, Kamil * @internal 236f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 237f4c4dcf4SKowalski, Kamil * 238f4c4dcf4SKowalski, Kamil * See header file for more information 239f4c4dcf4SKowalski, Kamil * @endinternal 240f4c4dcf4SKowalski, Kamil */ 2411668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 2421abe55efSEd Tanous { 243fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 2441668ce6dSEd Tanous std::to_array({arg1})); 245b5c07418SJames Feist } 246b5c07418SJames Feist 2471668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 248b5c07418SJames Feist { 249b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 250b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 251f4c4dcf4SKowalski, Kamil } 252f4c4dcf4SKowalski, Kamil 253f4c4dcf4SKowalski, Kamil /** 254f4c4dcf4SKowalski, Kamil * @internal 255f8cca876SEd Tanous * @brief Formats PropertyUnknown message into JSON 256f4c4dcf4SKowalski, Kamil * 257f4c4dcf4SKowalski, Kamil * See header file for more information 258f4c4dcf4SKowalski, Kamil * @endinternal 259f4c4dcf4SKowalski, Kamil */ 260f8cca876SEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 2611abe55efSEd Tanous { 262f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 2631668ce6dSEd Tanous std::to_array({arg1})); 264b5c07418SJames Feist } 265b5c07418SJames Feist 266f8cca876SEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 267b5c07418SJames Feist { 268b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 269f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 270f4c4dcf4SKowalski, Kamil } 271f4c4dcf4SKowalski, Kamil 272f4c4dcf4SKowalski, Kamil /** 273f4c4dcf4SKowalski, Kamil * @internal 274f8cca876SEd Tanous * @brief Formats PropertyValueTypeError message into JSON 275f4c4dcf4SKowalski, Kamil * 276f4c4dcf4SKowalski, Kamil * See header file for more information 277f4c4dcf4SKowalski, Kamil * @endinternal 278f4c4dcf4SKowalski, Kamil */ 279f8cca876SEd Tanous nlohmann::json propertyValueTypeError(const nlohmann::json& arg1, 280f8cca876SEd Tanous std::string_view arg2) 2811abe55efSEd Tanous { 282f8cca876SEd Tanous std::string arg1Str = 283f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 284f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 285f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 286b5c07418SJames Feist } 287b5c07418SJames Feist 288f8cca876SEd Tanous void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1, 289f8cca876SEd Tanous std::string_view arg2) 290b5c07418SJames Feist { 291b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 292f8cca876SEd Tanous addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 293f12894f8SJason M. Bills } 294f12894f8SJason M. Bills 295f12894f8SJason M. Bills /** 296f12894f8SJason M. Bills * @internal 2977ccfe684SEd Tanous * @brief Formats PropertyValueFormatError message into JSON 298f12894f8SJason M. Bills * 299f12894f8SJason M. Bills * See header file for more information 300f12894f8SJason M. Bills * @endinternal 301f12894f8SJason M. Bills */ 302f818b04dSEd Tanous nlohmann::json propertyValueFormatError(const nlohmann::json& arg1, 3031668ce6dSEd Tanous std::string_view arg2) 304f12894f8SJason M. Bills { 305bd79bce8SPatrick Williams std::string arg1Str = 306034e1259SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 307fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 308f818b04dSEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 309b5c07418SJames Feist } 310b5c07418SJames Feist 311f818b04dSEd Tanous void propertyValueFormatError(crow::Response& res, const nlohmann::json& arg1, 3121668ce6dSEd Tanous std::string_view arg2) 313b5c07418SJames Feist { 314b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 315b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 316f12894f8SJason M. Bills } 317f12894f8SJason M. Bills 318f12894f8SJason M. Bills /** 319f12894f8SJason M. Bills * @internal 3207ccfe684SEd Tanous * @brief Formats PropertyValueNotInList message into JSON 321f12894f8SJason M. Bills * 322f12894f8SJason M. Bills * See header file for more information 323f12894f8SJason M. Bills * @endinternal 324f12894f8SJason M. Bills */ 325e2616cc5SEd Tanous nlohmann::json propertyValueNotInList(const nlohmann::json& arg1, 3261668ce6dSEd Tanous std::string_view arg2) 327f12894f8SJason M. Bills { 328bd79bce8SPatrick Williams std::string arg1Str = 329bd79bce8SPatrick Williams arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 330fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 331e2616cc5SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 332b5c07418SJames Feist } 333b5c07418SJames Feist 334e2616cc5SEd Tanous void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1, 3351668ce6dSEd Tanous std::string_view arg2) 336b5c07418SJames Feist { 337b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 338b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 339f4c4dcf4SKowalski, Kamil } 340f4c4dcf4SKowalski, Kamil 341f4c4dcf4SKowalski, Kamil /** 342f4c4dcf4SKowalski, Kamil * @internal 343227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 344227a2b0aSJiaqing Zhao * 345227a2b0aSJiaqing Zhao * See header file for more information 346227a2b0aSJiaqing Zhao * @endinternal 347227a2b0aSJiaqing Zhao */ 34895b3ad73SEd Tanous nlohmann::json propertyValueOutOfRange(const nlohmann::json& arg1, 349227a2b0aSJiaqing Zhao std::string_view arg2) 350227a2b0aSJiaqing Zhao { 351bd79bce8SPatrick Williams std::string arg1Str = 352034e1259SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 353227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 35495b3ad73SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 355227a2b0aSJiaqing Zhao } 356227a2b0aSJiaqing Zhao 35795b3ad73SEd Tanous void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1, 358227a2b0aSJiaqing Zhao std::string_view arg2) 359227a2b0aSJiaqing Zhao { 360227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 361227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 362227a2b0aSJiaqing Zhao } 363227a2b0aSJiaqing Zhao 364227a2b0aSJiaqing Zhao /** 365227a2b0aSJiaqing Zhao * @internal 366f8cca876SEd Tanous * @brief Formats PropertyValueError message into JSON 367f4c4dcf4SKowalski, Kamil * 368f4c4dcf4SKowalski, Kamil * See header file for more information 369f4c4dcf4SKowalski, Kamil * @endinternal 370f4c4dcf4SKowalski, Kamil */ 371f8cca876SEd Tanous nlohmann::json propertyValueError(std::string_view arg1) 3721abe55efSEd Tanous { 373f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyValueError, 3741668ce6dSEd Tanous std::to_array({arg1})); 37581856681SAsmitha Karunanithi } 37681856681SAsmitha Karunanithi 377f8cca876SEd Tanous void propertyValueError(crow::Response& res, std::string_view arg1) 37881856681SAsmitha Karunanithi { 379f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 380f8cca876SEd Tanous addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1); 38181856681SAsmitha Karunanithi } 38281856681SAsmitha Karunanithi 38381856681SAsmitha Karunanithi /** 38481856681SAsmitha Karunanithi * @internal 385f8cca876SEd Tanous * @brief Formats PropertyNotWritable message into JSON 386f4c4dcf4SKowalski, Kamil * 387f4c4dcf4SKowalski, Kamil * See header file for more information 388f4c4dcf4SKowalski, Kamil * @endinternal 389f4c4dcf4SKowalski, Kamil */ 390f8cca876SEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 3911abe55efSEd Tanous { 392f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 393f8cca876SEd Tanous std::to_array({arg1})); 394b5c07418SJames Feist } 395b5c07418SJames Feist 396f8cca876SEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 397b5c07418SJames Feist { 398f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 399f8cca876SEd Tanous addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 400f4c4dcf4SKowalski, Kamil } 401f4c4dcf4SKowalski, Kamil 402f4c4dcf4SKowalski, Kamil /** 403f4c4dcf4SKowalski, Kamil * @internal 404f8cca876SEd Tanous * @brief Formats PropertyNotUpdated message into JSON 405f4c4dcf4SKowalski, Kamil * 406f4c4dcf4SKowalski, Kamil * See header file for more information 407f4c4dcf4SKowalski, Kamil * @endinternal 408f4c4dcf4SKowalski, Kamil */ 409f8cca876SEd Tanous nlohmann::json propertyNotUpdated(std::string_view arg1) 4101abe55efSEd Tanous { 411f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyNotUpdated, 412f8cca876SEd Tanous std::to_array({arg1})); 413b5c07418SJames Feist } 414b5c07418SJames Feist 415f8cca876SEd Tanous void propertyNotUpdated(crow::Response& res, std::string_view arg1) 416b5c07418SJames Feist { 417f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 418f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, propertyNotUpdated(arg1)); 419f8cca876SEd Tanous } 420f8cca876SEd Tanous 421f8cca876SEd Tanous /** 422f8cca876SEd Tanous * @internal 423f8cca876SEd Tanous * @brief Formats PropertyMissing message into JSON 424f8cca876SEd Tanous * 425f8cca876SEd Tanous * See header file for more information 426f8cca876SEd Tanous * @endinternal 427f8cca876SEd Tanous */ 428f8cca876SEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 429f8cca876SEd Tanous { 430f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 431f8cca876SEd Tanous std::to_array({arg1})); 432f8cca876SEd Tanous } 433f8cca876SEd Tanous 434f8cca876SEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 435f8cca876SEd Tanous { 436f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 437f8cca876SEd Tanous addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 438f8cca876SEd Tanous } 439f8cca876SEd Tanous 440f8cca876SEd Tanous /** 441f8cca876SEd Tanous * @internal 442f8cca876SEd Tanous * @brief Formats MalformedJSON message into JSON 443f8cca876SEd Tanous * 444f8cca876SEd Tanous * See header file for more information 445f8cca876SEd Tanous * @endinternal 446f8cca876SEd Tanous */ 447f8cca876SEd Tanous nlohmann::json malformedJSON() 448f8cca876SEd Tanous { 449f8cca876SEd Tanous return getLog(redfish::registries::base::Index::malformedJSON, {}); 450f8cca876SEd Tanous } 451f8cca876SEd Tanous 452f8cca876SEd Tanous void malformedJSON(crow::Response& res) 453f8cca876SEd Tanous { 454f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 455f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, malformedJSON()); 456f8cca876SEd Tanous } 457f8cca876SEd Tanous 458f8cca876SEd Tanous /** 459f8cca876SEd Tanous * @internal 460f8cca876SEd Tanous * @brief Formats InvalidJSON message into JSON 461f8cca876SEd Tanous * 462f8cca876SEd Tanous * See header file for more information 463f8cca876SEd Tanous * @endinternal 464f8cca876SEd Tanous */ 465f8cca876SEd Tanous nlohmann::json invalidJSON(std::string_view arg1) 466f8cca876SEd Tanous { 467f8cca876SEd Tanous return getLog(redfish::registries::base::Index::invalidJSON, 468f8cca876SEd Tanous std::to_array({arg1})); 469f8cca876SEd Tanous } 470f8cca876SEd Tanous 471f8cca876SEd Tanous void invalidJSON(crow::Response& res, std::string_view arg1) 472f8cca876SEd Tanous { 473f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 474f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, invalidJSON(arg1)); 475f8cca876SEd Tanous } 476f8cca876SEd Tanous 477f8cca876SEd Tanous /** 478f8cca876SEd Tanous * @internal 479f8cca876SEd Tanous * @brief Formats EmptyJSON message into JSON 480f8cca876SEd Tanous * 481f8cca876SEd Tanous * See header file for more information 482f8cca876SEd Tanous * @endinternal 483f8cca876SEd Tanous */ 484f8cca876SEd Tanous nlohmann::json emptyJSON() 485f8cca876SEd Tanous { 486f8cca876SEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 487f8cca876SEd Tanous } 488f8cca876SEd Tanous 489f8cca876SEd Tanous void emptyJSON(crow::Response& res) 490f8cca876SEd Tanous { 491f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 492f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, emptyJSON()); 493f8cca876SEd Tanous } 494f8cca876SEd Tanous 495f8cca876SEd Tanous /** 496f8cca876SEd Tanous * @internal 497f8cca876SEd Tanous * @brief Formats ActionNotSupported message into JSON 498f8cca876SEd Tanous * 499f8cca876SEd Tanous * See header file for more information 500f8cca876SEd Tanous * @endinternal 501f8cca876SEd Tanous */ 502f8cca876SEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 503f8cca876SEd Tanous { 504f8cca876SEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 505f8cca876SEd Tanous std::to_array({arg1})); 506f8cca876SEd Tanous } 507f8cca876SEd Tanous 508f8cca876SEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 509f8cca876SEd Tanous { 510f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 511f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 512f4c4dcf4SKowalski, Kamil } 513f4c4dcf4SKowalski, Kamil 514f4c4dcf4SKowalski, Kamil /** 515f4c4dcf4SKowalski, Kamil * @internal 516f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 517f4c4dcf4SKowalski, Kamil * 518f4c4dcf4SKowalski, Kamil * See header file for more information 519f4c4dcf4SKowalski, Kamil * @endinternal 520f4c4dcf4SKowalski, Kamil */ 5211668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 5221668ce6dSEd Tanous std::string_view arg2) 5231abe55efSEd Tanous { 524fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 5251668ce6dSEd Tanous std::to_array({arg1, arg2})); 526b5c07418SJames Feist } 527b5c07418SJames Feist 5281668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 5291668ce6dSEd Tanous std::string_view arg2) 530b5c07418SJames Feist { 531b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 532b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 533f4c4dcf4SKowalski, Kamil } 534f4c4dcf4SKowalski, Kamil 535f4c4dcf4SKowalski, Kamil /** 536f4c4dcf4SKowalski, Kamil * @internal 537f8cca876SEd Tanous * @brief Formats ActionParameterDuplicate message into JSON 538f8cca876SEd Tanous * 539f8cca876SEd Tanous * See header file for more information 540f8cca876SEd Tanous * @endinternal 541f8cca876SEd Tanous */ 542f8cca876SEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 543f8cca876SEd Tanous std::string_view arg2) 544f8cca876SEd Tanous { 545f8cca876SEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 546f8cca876SEd Tanous std::to_array({arg1, arg2})); 547f8cca876SEd Tanous } 548f8cca876SEd Tanous 549f8cca876SEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 550f8cca876SEd Tanous std::string_view arg2) 551f8cca876SEd Tanous { 552f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 553f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 554f8cca876SEd Tanous } 555f8cca876SEd Tanous 556f8cca876SEd Tanous /** 557f8cca876SEd Tanous * @internal 558f8cca876SEd Tanous * @brief Formats ActionParameterUnknown message into JSON 559f8cca876SEd Tanous * 560f8cca876SEd Tanous * See header file for more information 561f8cca876SEd Tanous * @endinternal 562f8cca876SEd Tanous */ 563f8cca876SEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 564f8cca876SEd Tanous std::string_view arg2) 565f8cca876SEd Tanous { 566f8cca876SEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 567f8cca876SEd Tanous std::to_array({arg1, arg2})); 568f8cca876SEd Tanous } 569f8cca876SEd Tanous 570f8cca876SEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 571f8cca876SEd Tanous std::string_view arg2) 572f8cca876SEd Tanous { 573f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 574f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 575f8cca876SEd Tanous } 576f8cca876SEd Tanous 577f8cca876SEd Tanous /** 578f8cca876SEd Tanous * @internal 579f8cca876SEd Tanous * @brief Formats ActionParameterValueTypeError message into JSON 580f8cca876SEd Tanous * 581f8cca876SEd Tanous * See header file for more information 582f8cca876SEd Tanous * @endinternal 583f8cca876SEd Tanous */ 584f8cca876SEd Tanous nlohmann::json actionParameterValueTypeError( 585f8cca876SEd Tanous const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3) 586f8cca876SEd Tanous { 587f8cca876SEd Tanous std::string arg1Str = 588f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 589f8cca876SEd Tanous return getLog( 590f8cca876SEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 591f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2, arg3})); 592f8cca876SEd Tanous } 593f8cca876SEd Tanous 594f8cca876SEd Tanous void actionParameterValueTypeError(crow::Response& res, 595f8cca876SEd Tanous const nlohmann::json& arg1, 596f8cca876SEd Tanous std::string_view arg2, std::string_view arg3) 597f8cca876SEd Tanous { 598f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 599f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 600f8cca876SEd Tanous actionParameterValueTypeError(arg1, arg2, arg3)); 601f8cca876SEd Tanous } 602f8cca876SEd Tanous 603f8cca876SEd Tanous /** 604f8cca876SEd Tanous * @internal 605f8cca876SEd Tanous * @brief Formats ActionParameterValueFormatError message into JSON 606f8cca876SEd Tanous * 607f8cca876SEd Tanous * See header file for more information 608f8cca876SEd Tanous * @endinternal 609f8cca876SEd Tanous */ 610f8cca876SEd Tanous nlohmann::json actionParameterValueFormatError( 611f8cca876SEd Tanous const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3) 612f8cca876SEd Tanous { 613f8cca876SEd Tanous std::string arg1Str = 614f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 615f8cca876SEd Tanous return getLog( 616f8cca876SEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 617f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2, arg3})); 618f8cca876SEd Tanous } 619f8cca876SEd Tanous 620f8cca876SEd Tanous void actionParameterValueFormatError( 621f8cca876SEd Tanous crow::Response& res, const nlohmann::json& arg1, std::string_view arg2, 622f8cca876SEd Tanous std::string_view arg3) 623f8cca876SEd Tanous { 624f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 625f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 626f8cca876SEd Tanous actionParameterValueFormatError(arg1, arg2, arg3)); 627f8cca876SEd Tanous } 628f8cca876SEd Tanous 629f8cca876SEd Tanous /** 630f8cca876SEd Tanous * @internal 631f8cca876SEd Tanous * @brief Formats ActionParameterValueNotInList message into JSON 632f8cca876SEd Tanous * 633f8cca876SEd Tanous * See header file for more information 634f8cca876SEd Tanous * @endinternal 635f8cca876SEd Tanous */ 636f8cca876SEd Tanous nlohmann::json actionParameterValueNotInList( 637f8cca876SEd Tanous std::string_view arg1, std::string_view arg2, std::string_view arg3) 638f8cca876SEd Tanous { 639f8cca876SEd Tanous return getLog( 640f8cca876SEd Tanous redfish::registries::base::Index::actionParameterValueNotInList, 641f8cca876SEd Tanous std::to_array({arg1, arg2, arg3})); 642f8cca876SEd Tanous } 643f8cca876SEd Tanous 644f8cca876SEd Tanous void actionParameterValueNotInList(crow::Response& res, std::string_view arg1, 645f8cca876SEd Tanous std::string_view arg2, std::string_view arg3) 646f8cca876SEd Tanous { 647f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 648f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 649f8cca876SEd Tanous actionParameterValueNotInList(arg1, arg2, arg3)); 650f8cca876SEd Tanous } 651f8cca876SEd Tanous 652f8cca876SEd Tanous /** 653f8cca876SEd Tanous * @internal 654f8cca876SEd Tanous * @brief Formats ActionParameterValueOutOfRange message into JSON 655f8cca876SEd Tanous * 656f8cca876SEd Tanous * See header file for more information 657f8cca876SEd Tanous * @endinternal 658f8cca876SEd Tanous */ 659f8cca876SEd Tanous nlohmann::json actionParameterValueOutOfRange( 660f8cca876SEd Tanous std::string_view arg1, std::string_view arg2, std::string_view arg3) 661f8cca876SEd Tanous { 662f8cca876SEd Tanous return getLog( 663f8cca876SEd Tanous redfish::registries::base::Index::actionParameterValueOutOfRange, 664f8cca876SEd Tanous std::to_array({arg1, arg2, arg3})); 665f8cca876SEd Tanous } 666f8cca876SEd Tanous 667f8cca876SEd Tanous void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1, 668f8cca876SEd Tanous std::string_view arg2, 669f8cca876SEd Tanous std::string_view arg3) 670f8cca876SEd Tanous { 671f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 672f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 673f8cca876SEd Tanous actionParameterValueOutOfRange(arg1, arg2, arg3)); 674f8cca876SEd Tanous } 675f8cca876SEd Tanous 676f8cca876SEd Tanous /** 677f8cca876SEd Tanous * @internal 678f8cca876SEd Tanous * @brief Formats ActionParameterValueError message into JSON 679f8cca876SEd Tanous * 680f8cca876SEd Tanous * See header file for more information 681f8cca876SEd Tanous * @endinternal 682f8cca876SEd Tanous */ 683f8cca876SEd Tanous nlohmann::json actionParameterValueError(const nlohmann::json& arg1, 684f8cca876SEd Tanous std::string_view arg2) 685f8cca876SEd Tanous { 686f8cca876SEd Tanous std::string arg1Str = 687f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 688f8cca876SEd Tanous return getLog(redfish::registries::base::Index::actionParameterValueError, 689f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 690f8cca876SEd Tanous } 691f8cca876SEd Tanous 692f8cca876SEd Tanous void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1, 693f8cca876SEd Tanous std::string_view arg2) 694f8cca876SEd Tanous { 695f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 696f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2)); 697f8cca876SEd Tanous } 698f8cca876SEd Tanous 699f8cca876SEd Tanous /** 700f8cca876SEd Tanous * @internal 701f8cca876SEd Tanous * @brief Formats ActionParameterNotSupported message into JSON 702f8cca876SEd Tanous * 703f8cca876SEd Tanous * See header file for more information 704f8cca876SEd Tanous * @endinternal 705f8cca876SEd Tanous */ 706f8cca876SEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 707f8cca876SEd Tanous std::string_view arg2) 708f8cca876SEd Tanous { 709f8cca876SEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 710f8cca876SEd Tanous std::to_array({arg1, arg2})); 711f8cca876SEd Tanous } 712f8cca876SEd Tanous 713f8cca876SEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 714f8cca876SEd Tanous std::string_view arg2) 715f8cca876SEd Tanous { 716f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 717f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 718f8cca876SEd Tanous actionParameterNotSupported(arg1, arg2)); 719f8cca876SEd Tanous } 720f8cca876SEd Tanous 721f8cca876SEd Tanous /** 722f8cca876SEd Tanous * @internal 723f8cca876SEd Tanous * @brief Formats ArraySizeTooLong message into JSON 724f8cca876SEd Tanous * 725f8cca876SEd Tanous * See header file for more information 726f8cca876SEd Tanous * @endinternal 727f8cca876SEd Tanous */ 728f8cca876SEd Tanous nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2) 729f8cca876SEd Tanous { 730f8cca876SEd Tanous std::string arg2Str = std::to_string(arg2); 731f8cca876SEd Tanous return getLog(redfish::registries::base::Index::arraySizeTooLong, 732f8cca876SEd Tanous std::to_array<std::string_view>({arg1, arg2Str})); 733f8cca876SEd Tanous } 734f8cca876SEd Tanous 735f8cca876SEd Tanous void arraySizeTooLong(crow::Response& res, std::string_view arg1, uint64_t arg2) 736f8cca876SEd Tanous { 737f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 738f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, arraySizeTooLong(arg1, arg2)); 739f8cca876SEd Tanous } 740f8cca876SEd Tanous 741f8cca876SEd Tanous /** 742f8cca876SEd Tanous * @internal 743f8cca876SEd Tanous * @brief Formats ArraySizeTooShort message into JSON 744f8cca876SEd Tanous * 745f8cca876SEd Tanous * See header file for more information 746f8cca876SEd Tanous * @endinternal 747f8cca876SEd Tanous */ 748f8cca876SEd Tanous nlohmann::json arraySizeTooShort(std::string_view arg1, std::string_view arg2) 749f8cca876SEd Tanous { 750f8cca876SEd Tanous return getLog(redfish::registries::base::Index::arraySizeTooShort, 751f8cca876SEd Tanous std::to_array({arg1, arg2})); 752f8cca876SEd Tanous } 753f8cca876SEd Tanous 754f8cca876SEd Tanous void arraySizeTooShort(crow::Response& res, std::string_view arg1, 755f8cca876SEd Tanous std::string_view arg2) 756f8cca876SEd Tanous { 757f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 758f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, arraySizeTooShort(arg1, arg2)); 759f8cca876SEd Tanous } 760f8cca876SEd Tanous 761f8cca876SEd Tanous /** 762f8cca876SEd Tanous * @internal 763f8cca876SEd Tanous * @brief Formats QueryParameterValueTypeError message into JSON 764f8cca876SEd Tanous * 765f8cca876SEd Tanous * See header file for more information 766f8cca876SEd Tanous * @endinternal 767f8cca876SEd Tanous */ 768f8cca876SEd Tanous nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1, 769f8cca876SEd Tanous std::string_view arg2) 770f8cca876SEd Tanous { 771f8cca876SEd Tanous std::string arg1Str = 772f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 773f8cca876SEd Tanous return getLog( 774f8cca876SEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 775f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 776f8cca876SEd Tanous } 777f8cca876SEd Tanous 778f8cca876SEd Tanous void queryParameterValueTypeError( 779f8cca876SEd Tanous crow::Response& res, const nlohmann::json& arg1, std::string_view arg2) 780f8cca876SEd Tanous { 781f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 782f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 783f8cca876SEd Tanous queryParameterValueTypeError(arg1, arg2)); 784f8cca876SEd Tanous } 785f8cca876SEd Tanous 786f8cca876SEd Tanous /** 787f8cca876SEd Tanous * @internal 788f8cca876SEd Tanous * @brief Formats QueryParameterValueFormatError message into JSON 789f8cca876SEd Tanous * 790f8cca876SEd Tanous * See header file for more information 791f8cca876SEd Tanous * @endinternal 792f8cca876SEd Tanous */ 793f8cca876SEd Tanous nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1, 794f8cca876SEd Tanous std::string_view arg2) 795f8cca876SEd Tanous { 796f8cca876SEd Tanous std::string arg1Str = 797f8cca876SEd Tanous arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 798f8cca876SEd Tanous return getLog( 799f8cca876SEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 800f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 801f8cca876SEd Tanous } 802f8cca876SEd Tanous 803f8cca876SEd Tanous void queryParameterValueFormatError( 804f8cca876SEd Tanous crow::Response& res, const nlohmann::json& arg1, std::string_view arg2) 805f8cca876SEd Tanous { 806f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 807f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 808f8cca876SEd Tanous queryParameterValueFormatError(arg1, arg2)); 809f8cca876SEd Tanous } 810f8cca876SEd Tanous 811f8cca876SEd Tanous /** 812f8cca876SEd Tanous * @internal 813f8cca876SEd Tanous * @brief Formats QueryParameterValueError message into JSON 814f8cca876SEd Tanous * 815f8cca876SEd Tanous * See header file for more information 816f8cca876SEd Tanous * @endinternal 817f8cca876SEd Tanous */ 818f8cca876SEd Tanous nlohmann::json queryParameterValueError(std::string_view arg1) 819f8cca876SEd Tanous { 820f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryParameterValueError, 821f8cca876SEd Tanous std::to_array({arg1})); 822f8cca876SEd Tanous } 823f8cca876SEd Tanous 824f8cca876SEd Tanous void queryParameterValueError(crow::Response& res, std::string_view arg1) 825f8cca876SEd Tanous { 826f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 827f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryParameterValueError(arg1)); 828f8cca876SEd Tanous } 829f8cca876SEd Tanous 830f8cca876SEd Tanous /** 831f8cca876SEd Tanous * @internal 832f8cca876SEd Tanous * @brief Formats QueryParameterOutOfRange message into JSON 833f8cca876SEd Tanous * 834f8cca876SEd Tanous * See header file for more information 835f8cca876SEd Tanous * @endinternal 836f8cca876SEd Tanous */ 837f8cca876SEd Tanous nlohmann::json queryParameterOutOfRange( 838f8cca876SEd Tanous std::string_view arg1, std::string_view arg2, std::string_view arg3) 839f8cca876SEd Tanous { 840f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 841f8cca876SEd Tanous std::to_array({arg1, arg2, arg3})); 842f8cca876SEd Tanous } 843f8cca876SEd Tanous 844f8cca876SEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 845f8cca876SEd Tanous std::string_view arg2, std::string_view arg3) 846f8cca876SEd Tanous { 847f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 848f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 849f8cca876SEd Tanous queryParameterOutOfRange(arg1, arg2, arg3)); 850f8cca876SEd Tanous } 851f8cca876SEd Tanous 852f8cca876SEd Tanous /** 853f8cca876SEd Tanous * @internal 854f8cca876SEd Tanous * @brief Formats QueryNotSupportedOnResource message into JSON 855f8cca876SEd Tanous * 856f8cca876SEd Tanous * See header file for more information 857f8cca876SEd Tanous * @endinternal 858f8cca876SEd Tanous */ 859f8cca876SEd Tanous nlohmann::json queryNotSupportedOnResource() 860f8cca876SEd Tanous { 861f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 862f8cca876SEd Tanous {}); 863f8cca876SEd Tanous } 864f8cca876SEd Tanous 865f8cca876SEd Tanous void queryNotSupportedOnResource(crow::Response& res) 866f8cca876SEd Tanous { 867f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 868f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 869f8cca876SEd Tanous } 870f8cca876SEd Tanous 871f8cca876SEd Tanous /** 872f8cca876SEd Tanous * @internal 873f8cca876SEd Tanous * @brief Formats QueryNotSupportedOnOperation message into JSON 874f8cca876SEd Tanous * 875f8cca876SEd Tanous * See header file for more information 876f8cca876SEd Tanous * @endinternal 877f8cca876SEd Tanous */ 878f8cca876SEd Tanous nlohmann::json queryNotSupportedOnOperation() 879f8cca876SEd Tanous { 880f8cca876SEd Tanous return getLog( 881f8cca876SEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 882f8cca876SEd Tanous } 883f8cca876SEd Tanous 884f8cca876SEd Tanous void queryNotSupportedOnOperation(crow::Response& res) 885f8cca876SEd Tanous { 886f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 887f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 888f8cca876SEd Tanous } 889f8cca876SEd Tanous 890f8cca876SEd Tanous /** 891f8cca876SEd Tanous * @internal 892f8cca876SEd Tanous * @brief Formats QueryNotSupported message into JSON 893f8cca876SEd Tanous * 894f8cca876SEd Tanous * See header file for more information 895f8cca876SEd Tanous * @endinternal 896f8cca876SEd Tanous */ 897f8cca876SEd Tanous nlohmann::json queryNotSupported() 898f8cca876SEd Tanous { 899f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 900f8cca876SEd Tanous } 901f8cca876SEd Tanous 902f8cca876SEd Tanous void queryNotSupported(crow::Response& res) 903f8cca876SEd Tanous { 904f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 905f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryNotSupported()); 906f8cca876SEd Tanous } 907f8cca876SEd Tanous 908f8cca876SEd Tanous /** 909f8cca876SEd Tanous * @internal 910f8cca876SEd Tanous * @brief Formats QueryCombinationInvalid message into JSON 911f8cca876SEd Tanous * 912f8cca876SEd Tanous * See header file for more information 913f8cca876SEd Tanous * @endinternal 914f8cca876SEd Tanous */ 915f8cca876SEd Tanous nlohmann::json queryCombinationInvalid() 916f8cca876SEd Tanous { 917f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 918f8cca876SEd Tanous {}); 919f8cca876SEd Tanous } 920f8cca876SEd Tanous 921f8cca876SEd Tanous void queryCombinationInvalid(crow::Response& res) 922f8cca876SEd Tanous { 923f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 924f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 925f8cca876SEd Tanous } 926f8cca876SEd Tanous 927f8cca876SEd Tanous /** 928f8cca876SEd Tanous * @internal 929f8cca876SEd Tanous * @brief Formats QueryParameterUnsupported message into JSON 930f8cca876SEd Tanous * 931f8cca876SEd Tanous * See header file for more information 932f8cca876SEd Tanous * @endinternal 933f8cca876SEd Tanous */ 934f8cca876SEd Tanous nlohmann::json queryParameterUnsupported(std::string_view arg1) 935f8cca876SEd Tanous { 936f8cca876SEd Tanous return getLog(redfish::registries::base::Index::queryParameterUnsupported, 937f8cca876SEd Tanous std::to_array({arg1})); 938f8cca876SEd Tanous } 939f8cca876SEd Tanous 940f8cca876SEd Tanous void queryParameterUnsupported(crow::Response& res, std::string_view arg1) 941f8cca876SEd Tanous { 942f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 943f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, queryParameterUnsupported(arg1)); 944f8cca876SEd Tanous } 945f8cca876SEd Tanous 946f8cca876SEd Tanous /** 947f8cca876SEd Tanous * @internal 948f8cca876SEd Tanous * @brief Formats SessionLimitExceeded message into JSON 949f8cca876SEd Tanous * 950f8cca876SEd Tanous * See header file for more information 951f8cca876SEd Tanous * @endinternal 952f8cca876SEd Tanous */ 953f8cca876SEd Tanous nlohmann::json sessionLimitExceeded() 954f8cca876SEd Tanous { 955f8cca876SEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 956f8cca876SEd Tanous } 957f8cca876SEd Tanous 958f8cca876SEd Tanous void sessionLimitExceeded(crow::Response& res) 959f8cca876SEd Tanous { 960f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 961f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 962f8cca876SEd Tanous } 963f8cca876SEd Tanous 964f8cca876SEd Tanous /** 965f8cca876SEd Tanous * @internal 966f8cca876SEd Tanous * @brief Formats EventSubscriptionLimitExceeded message into JSON 967f8cca876SEd Tanous * 968f8cca876SEd Tanous * See header file for more information 969f8cca876SEd Tanous * @endinternal 970f8cca876SEd Tanous */ 971f8cca876SEd Tanous nlohmann::json eventSubscriptionLimitExceeded() 972f8cca876SEd Tanous { 973f8cca876SEd Tanous return getLog( 974f8cca876SEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 975f8cca876SEd Tanous } 976f8cca876SEd Tanous 977f8cca876SEd Tanous void eventSubscriptionLimitExceeded(crow::Response& res) 978f8cca876SEd Tanous { 979f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 980f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 981f8cca876SEd Tanous } 982f8cca876SEd Tanous 983f8cca876SEd Tanous /** 984f8cca876SEd Tanous * @internal 985f8cca876SEd Tanous * @brief Formats ResourceCannotBeDeleted message into JSON 986f8cca876SEd Tanous * 987f8cca876SEd Tanous * See header file for more information 988f8cca876SEd Tanous * @endinternal 989f8cca876SEd Tanous */ 990f8cca876SEd Tanous nlohmann::json resourceCannotBeDeleted() 991f8cca876SEd Tanous { 992f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 993f8cca876SEd Tanous {}); 994f8cca876SEd Tanous } 995f8cca876SEd Tanous 996f8cca876SEd Tanous void resourceCannotBeDeleted(crow::Response& res) 997f8cca876SEd Tanous { 998f8cca876SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 999f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 1000f8cca876SEd Tanous } 1001f8cca876SEd Tanous 1002f8cca876SEd Tanous /** 1003f8cca876SEd Tanous * @internal 1004f8cca876SEd Tanous * @brief Formats ResourceInUse message into JSON 1005f8cca876SEd Tanous * 1006f8cca876SEd Tanous * See header file for more information 1007f8cca876SEd Tanous * @endinternal 1008f8cca876SEd Tanous */ 1009f8cca876SEd Tanous nlohmann::json resourceInUse() 1010f8cca876SEd Tanous { 1011f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceInUse, {}); 1012f8cca876SEd Tanous } 1013f8cca876SEd Tanous 1014f8cca876SEd Tanous void resourceInUse(crow::Response& res) 1015f8cca876SEd Tanous { 1016f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1017f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceInUse()); 1018f8cca876SEd Tanous } 1019f8cca876SEd Tanous 1020f8cca876SEd Tanous /** 1021f8cca876SEd Tanous * @internal 1022f8cca876SEd Tanous * @brief Formats ResourceAlreadyExists message into JSON 1023f8cca876SEd Tanous * 1024f8cca876SEd Tanous * See header file for more information 1025f8cca876SEd Tanous * @endinternal 1026f8cca876SEd Tanous */ 1027f8cca876SEd Tanous nlohmann::json resourceAlreadyExists( 1028f8cca876SEd Tanous std::string_view arg1, std::string_view arg2, std::string_view arg3) 1029f8cca876SEd Tanous { 1030f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 1031f8cca876SEd Tanous std::to_array({arg1, arg2, arg3})); 1032f8cca876SEd Tanous } 1033f8cca876SEd Tanous 1034f8cca876SEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 1035f8cca876SEd Tanous std::string_view arg2, std::string_view arg3) 1036f8cca876SEd Tanous { 1037f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1038f8cca876SEd Tanous addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 1039f8cca876SEd Tanous arg2); 1040f8cca876SEd Tanous } 1041f8cca876SEd Tanous 1042f8cca876SEd Tanous /** 1043f8cca876SEd Tanous * @internal 1044f8cca876SEd Tanous * @brief Formats ResourceNotFound message into JSON 1045f8cca876SEd Tanous * 1046f8cca876SEd Tanous * See header file for more information 1047f8cca876SEd Tanous * @endinternal 1048f8cca876SEd Tanous */ 1049f8cca876SEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 1050f8cca876SEd Tanous { 1051f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 1052f8cca876SEd Tanous std::to_array({arg1, arg2})); 1053f8cca876SEd Tanous } 1054f8cca876SEd Tanous 1055f8cca876SEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 1056f8cca876SEd Tanous std::string_view arg2) 1057f8cca876SEd Tanous { 1058f8cca876SEd Tanous res.result(boost::beast::http::status::not_found); 1059f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1060f8cca876SEd Tanous } 1061f8cca876SEd Tanous 1062f8cca876SEd Tanous /** 1063f8cca876SEd Tanous * @internal 1064f8cca876SEd Tanous * @brief Formats PayloadTooLarge message into JSON 1065f8cca876SEd Tanous * 1066f8cca876SEd Tanous * See header file for more information 1067f8cca876SEd Tanous * @endinternal 1068f8cca876SEd Tanous */ 1069f8cca876SEd Tanous nlohmann::json payloadTooLarge() 1070f8cca876SEd Tanous { 1071f8cca876SEd Tanous return getLog(redfish::registries::base::Index::payloadTooLarge, {}); 1072f8cca876SEd Tanous } 1073f8cca876SEd Tanous 1074f8cca876SEd Tanous void payloadTooLarge(crow::Response& res) 1075f8cca876SEd Tanous { 1076f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1077f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, payloadTooLarge()); 1078f8cca876SEd Tanous } 1079f8cca876SEd Tanous 1080f8cca876SEd Tanous /** 1081f8cca876SEd Tanous * @internal 1082f8cca876SEd Tanous * @brief Formats InsufficientStorage message into JSON 1083f8cca876SEd Tanous * 1084f8cca876SEd Tanous * See header file for more information 1085f8cca876SEd Tanous * @endinternal 1086f8cca876SEd Tanous */ 1087f8cca876SEd Tanous nlohmann::json insufficientStorage() 1088f8cca876SEd Tanous { 1089f8cca876SEd Tanous return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1090f8cca876SEd Tanous } 1091f8cca876SEd Tanous 1092f8cca876SEd Tanous void insufficientStorage(crow::Response& res) 1093f8cca876SEd Tanous { 1094f8cca876SEd Tanous res.result(boost::beast::http::status::insufficient_storage); 1095f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1096f8cca876SEd Tanous } 1097f8cca876SEd Tanous 1098f8cca876SEd Tanous /** 1099f8cca876SEd Tanous * @internal 1100f8cca876SEd Tanous * @brief Formats MissingOrMalformedPart message into JSON 1101f8cca876SEd Tanous * 1102f8cca876SEd Tanous * See header file for more information 1103f8cca876SEd Tanous * @endinternal 1104f8cca876SEd Tanous */ 1105f8cca876SEd Tanous nlohmann::json missingOrMalformedPart() 1106f8cca876SEd Tanous { 1107f8cca876SEd Tanous return getLog(redfish::registries::base::Index::missingOrMalformedPart, {}); 1108f8cca876SEd Tanous } 1109f8cca876SEd Tanous 1110f8cca876SEd Tanous void missingOrMalformedPart(crow::Response& res) 1111f8cca876SEd Tanous { 1112f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1113f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, missingOrMalformedPart()); 1114f8cca876SEd Tanous } 1115f8cca876SEd Tanous 1116f8cca876SEd Tanous /** 1117f8cca876SEd Tanous * @internal 1118f8cca876SEd Tanous * @brief Formats InvalidURI message into JSON 1119f8cca876SEd Tanous * 1120f8cca876SEd Tanous * See header file for more information 1121f8cca876SEd Tanous * @endinternal 1122f8cca876SEd Tanous */ 1123f8cca876SEd Tanous nlohmann::json invalidURI(std::string_view arg1) 1124f8cca876SEd Tanous { 1125f8cca876SEd Tanous return getLog(redfish::registries::base::Index::invalidURI, 1126f8cca876SEd Tanous std::to_array({arg1})); 1127f8cca876SEd Tanous } 1128f8cca876SEd Tanous 1129f8cca876SEd Tanous void invalidURI(crow::Response& res, std::string_view arg1) 1130f8cca876SEd Tanous { 1131f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1132f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, invalidURI(arg1)); 1133f8cca876SEd Tanous } 1134f8cca876SEd Tanous 1135f8cca876SEd Tanous /** 1136f8cca876SEd Tanous * @internal 1137f8cca876SEd Tanous * @brief Formats CreateFailedMissingReqProperties message into JSON 1138f8cca876SEd Tanous * 1139f8cca876SEd Tanous * See header file for more information 1140f8cca876SEd Tanous * @endinternal 1141f8cca876SEd Tanous */ 1142f8cca876SEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 1143f8cca876SEd Tanous { 1144f8cca876SEd Tanous return getLog( 1145f8cca876SEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 1146f8cca876SEd Tanous std::to_array({arg1})); 1147f8cca876SEd Tanous } 1148f8cca876SEd Tanous 1149f8cca876SEd Tanous void createFailedMissingReqProperties(crow::Response& res, 1150f8cca876SEd Tanous std::string_view arg1) 1151f8cca876SEd Tanous { 1152f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1153f8cca876SEd Tanous addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 1154f8cca876SEd Tanous arg1); 1155f8cca876SEd Tanous } 1156f8cca876SEd Tanous 1157f8cca876SEd Tanous /** 1158f8cca876SEd Tanous * @internal 1159f8cca876SEd Tanous * @brief Formats CreateLimitReachedForResource message into JSON 1160f8cca876SEd Tanous * 1161f8cca876SEd Tanous * See header file for more information 1162f8cca876SEd Tanous * @endinternal 1163f8cca876SEd Tanous */ 1164f8cca876SEd Tanous nlohmann::json createLimitReachedForResource() 1165f8cca876SEd Tanous { 1166f8cca876SEd Tanous return getLog( 1167f8cca876SEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1168f8cca876SEd Tanous } 1169f8cca876SEd Tanous 1170f8cca876SEd Tanous void createLimitReachedForResource(crow::Response& res) 1171f8cca876SEd Tanous { 1172f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1173f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1174f8cca876SEd Tanous } 1175f8cca876SEd Tanous 1176f8cca876SEd Tanous /** 1177f8cca876SEd Tanous * @internal 1178f8cca876SEd Tanous * @brief Formats ServiceShuttingDown message into JSON 1179f8cca876SEd Tanous * 1180f8cca876SEd Tanous * See header file for more information 1181f8cca876SEd Tanous * @endinternal 1182f8cca876SEd Tanous */ 1183f8cca876SEd Tanous nlohmann::json serviceShuttingDown() 1184f8cca876SEd Tanous { 1185f8cca876SEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1186f8cca876SEd Tanous } 1187f8cca876SEd Tanous 1188f8cca876SEd Tanous void serviceShuttingDown(crow::Response& res) 1189f8cca876SEd Tanous { 1190f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1191f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1192f8cca876SEd Tanous } 1193f8cca876SEd Tanous 1194f8cca876SEd Tanous /** 1195f8cca876SEd Tanous * @internal 1196f8cca876SEd Tanous * @brief Formats ServiceInUnknownState message into JSON 1197f8cca876SEd Tanous * 1198f8cca876SEd Tanous * See header file for more information 1199f8cca876SEd Tanous * @endinternal 1200f8cca876SEd Tanous */ 1201f8cca876SEd Tanous nlohmann::json serviceInUnknownState() 1202f8cca876SEd Tanous { 1203f8cca876SEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 1204f8cca876SEd Tanous } 1205f8cca876SEd Tanous 1206f8cca876SEd Tanous void serviceInUnknownState(crow::Response& res) 1207f8cca876SEd Tanous { 1208f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1209f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 1210f8cca876SEd Tanous } 1211f8cca876SEd Tanous 1212f8cca876SEd Tanous /** 1213f8cca876SEd Tanous * @internal 1214f8cca876SEd Tanous * @brief Formats NoValidSession message into JSON 1215f8cca876SEd Tanous * 1216f8cca876SEd Tanous * See header file for more information 1217f8cca876SEd Tanous * @endinternal 1218f8cca876SEd Tanous */ 1219f8cca876SEd Tanous nlohmann::json noValidSession() 1220f8cca876SEd Tanous { 1221f8cca876SEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1222f8cca876SEd Tanous } 1223f8cca876SEd Tanous 1224f8cca876SEd Tanous void noValidSession(crow::Response& res) 1225f8cca876SEd Tanous { 1226f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 1227f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, noValidSession()); 1228f8cca876SEd Tanous } 1229f8cca876SEd Tanous 1230f8cca876SEd Tanous /** 1231f8cca876SEd Tanous * @internal 1232f8cca876SEd Tanous * @brief Formats InsufficientPrivilege message into JSON 1233f8cca876SEd Tanous * 1234f8cca876SEd Tanous * See header file for more information 1235f8cca876SEd Tanous * @endinternal 1236f8cca876SEd Tanous */ 1237f8cca876SEd Tanous nlohmann::json insufficientPrivilege() 1238f8cca876SEd Tanous { 1239f8cca876SEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1240f8cca876SEd Tanous } 1241f8cca876SEd Tanous 1242f8cca876SEd Tanous void insufficientPrivilege(crow::Response& res) 1243f8cca876SEd Tanous { 1244f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 1245f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1246f8cca876SEd Tanous } 1247f8cca876SEd Tanous 1248f8cca876SEd Tanous /** 1249f8cca876SEd Tanous * @internal 1250f8cca876SEd Tanous * @brief Formats AccountModified message into JSON 1251f8cca876SEd Tanous * 1252f8cca876SEd Tanous * See header file for more information 1253f8cca876SEd Tanous * @endinternal 1254f8cca876SEd Tanous */ 1255f8cca876SEd Tanous nlohmann::json accountModified() 1256f8cca876SEd Tanous { 1257f8cca876SEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1258f8cca876SEd Tanous } 1259f8cca876SEd Tanous 1260f8cca876SEd Tanous void accountModified(crow::Response& res) 1261f8cca876SEd Tanous { 1262f8cca876SEd Tanous res.result(boost::beast::http::status::ok); 1263f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, accountModified()); 1264f8cca876SEd Tanous } 1265f8cca876SEd Tanous 1266f8cca876SEd Tanous /** 1267f8cca876SEd Tanous * @internal 1268f8cca876SEd Tanous * @brief Formats AccountNotModified message into JSON 1269f8cca876SEd Tanous * 1270f8cca876SEd Tanous * See header file for more information 1271f8cca876SEd Tanous * @endinternal 1272f8cca876SEd Tanous */ 1273f8cca876SEd Tanous nlohmann::json accountNotModified() 1274f8cca876SEd Tanous { 1275f8cca876SEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1276f8cca876SEd Tanous } 1277f8cca876SEd Tanous 1278f8cca876SEd Tanous void accountNotModified(crow::Response& res) 1279f8cca876SEd Tanous { 1280f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1281f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, accountNotModified()); 1282f8cca876SEd Tanous } 1283f8cca876SEd Tanous 1284f8cca876SEd Tanous /** 1285f8cca876SEd Tanous * @internal 1286f8cca876SEd Tanous * @brief Formats AccountRemoved message into JSON 1287f8cca876SEd Tanous * 1288f8cca876SEd Tanous * See header file for more information 1289f8cca876SEd Tanous * @endinternal 1290f8cca876SEd Tanous */ 1291f8cca876SEd Tanous nlohmann::json accountRemoved() 1292f8cca876SEd Tanous { 1293f8cca876SEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1294f8cca876SEd Tanous } 1295f8cca876SEd Tanous 1296f8cca876SEd Tanous void accountRemoved(crow::Response& res) 1297f8cca876SEd Tanous { 1298f8cca876SEd Tanous res.result(boost::beast::http::status::ok); 1299f8cca876SEd Tanous addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1300f8cca876SEd Tanous } 1301f8cca876SEd Tanous 1302f8cca876SEd Tanous /** 1303f8cca876SEd Tanous * @internal 1304f8cca876SEd Tanous * @brief Formats AccountForSessionNoLongerExists message into JSON 1305f8cca876SEd Tanous * 1306f8cca876SEd Tanous * See header file for more information 1307f8cca876SEd Tanous * @endinternal 1308f8cca876SEd Tanous */ 1309f8cca876SEd Tanous nlohmann::json accountForSessionNoLongerExists() 1310f8cca876SEd Tanous { 1311f8cca876SEd Tanous return getLog( 1312f8cca876SEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 1313f8cca876SEd Tanous } 1314f8cca876SEd Tanous 1315f8cca876SEd Tanous void accountForSessionNoLongerExists(crow::Response& res) 1316f8cca876SEd Tanous { 1317f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 1318f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 1319f8cca876SEd Tanous } 1320f8cca876SEd Tanous 1321f8cca876SEd Tanous /** 1322f8cca876SEd Tanous * @internal 1323f8cca876SEd Tanous * @brief Formats InvalidObject message into JSON 1324f8cca876SEd Tanous * 1325f8cca876SEd Tanous * See header file for more information 1326f8cca876SEd Tanous * @endinternal 1327f8cca876SEd Tanous */ 1328f8cca876SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view_base& arg1) 1329f8cca876SEd Tanous { 1330f8cca876SEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 1331f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1332f8cca876SEd Tanous } 1333f8cca876SEd Tanous 1334f8cca876SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1) 1335f8cca876SEd Tanous { 1336f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1337f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1338f8cca876SEd Tanous } 1339f8cca876SEd Tanous 1340f8cca876SEd Tanous /** 1341f8cca876SEd Tanous * @internal 1342f8cca876SEd Tanous * @brief Formats InternalError message into JSON 1343f8cca876SEd Tanous * 1344f8cca876SEd Tanous * See header file for more information 1345f8cca876SEd Tanous * @endinternal 1346f8cca876SEd Tanous */ 1347f8cca876SEd Tanous nlohmann::json internalError() 1348f8cca876SEd Tanous { 1349f8cca876SEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 1350f8cca876SEd Tanous } 1351f8cca876SEd Tanous 1352f8cca876SEd Tanous void internalError(crow::Response& res, const std::source_location location) 1353f8cca876SEd Tanous { 1354f8cca876SEd Tanous BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(), 1355f8cca876SEd Tanous location.line(), location.column(), 1356f8cca876SEd Tanous location.function_name()); 1357f8cca876SEd Tanous res.result(boost::beast::http::status::internal_server_error); 1358f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, internalError()); 1359f8cca876SEd Tanous } 1360f8cca876SEd Tanous 1361f8cca876SEd Tanous /** 1362f8cca876SEd Tanous * @internal 1363f8cca876SEd Tanous * @brief Formats UnrecognizedRequestBody message into JSON 1364f8cca876SEd Tanous * 1365f8cca876SEd Tanous * See header file for more information 1366f8cca876SEd Tanous * @endinternal 1367f8cca876SEd Tanous */ 1368f8cca876SEd Tanous nlohmann::json unrecognizedRequestBody() 1369f8cca876SEd Tanous { 1370f8cca876SEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 1371f8cca876SEd Tanous {}); 1372f8cca876SEd Tanous } 1373f8cca876SEd Tanous 1374f8cca876SEd Tanous void unrecognizedRequestBody(crow::Response& res) 1375f8cca876SEd Tanous { 1376f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1377f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 1378f8cca876SEd Tanous } 1379f8cca876SEd Tanous 1380f8cca876SEd Tanous /** 1381f8cca876SEd Tanous * @internal 1382f8cca876SEd Tanous * @brief Formats ResourceMissingAtURI message into JSON 1383f8cca876SEd Tanous * 1384f8cca876SEd Tanous * See header file for more information 1385f8cca876SEd Tanous * @endinternal 1386f8cca876SEd Tanous */ 1387f8cca876SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1) 1388f8cca876SEd Tanous { 1389f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, 1390f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1391f8cca876SEd Tanous } 1392f8cca876SEd Tanous 1393f8cca876SEd Tanous void resourceMissingAtURI(crow::Response& res, 1394f8cca876SEd Tanous const boost::urls::url_view_base& arg1) 1395f8cca876SEd Tanous { 1396f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1397f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 1398f8cca876SEd Tanous } 1399f8cca876SEd Tanous 1400f8cca876SEd Tanous /** 1401f8cca876SEd Tanous * @internal 1402f8cca876SEd Tanous * @brief Formats ResourceAtUriInUnknownFormat message into JSON 1403f8cca876SEd Tanous * 1404f8cca876SEd Tanous * See header file for more information 1405f8cca876SEd Tanous * @endinternal 1406f8cca876SEd Tanous */ 1407f8cca876SEd Tanous nlohmann::json 1408f8cca876SEd Tanous resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1) 1409f8cca876SEd Tanous { 1410f8cca876SEd Tanous return getLog( 1411f8cca876SEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 1412f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1413f8cca876SEd Tanous } 1414f8cca876SEd Tanous 1415f8cca876SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 1416f8cca876SEd Tanous const boost::urls::url_view_base& arg1) 1417f8cca876SEd Tanous { 1418f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1419f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 1420f8cca876SEd Tanous } 1421f8cca876SEd Tanous 1422f8cca876SEd Tanous /** 1423f8cca876SEd Tanous * @internal 1424f8cca876SEd Tanous * @brief Formats ResourceAtUriUnauthorized message into JSON 1425f8cca876SEd Tanous * 1426f8cca876SEd Tanous * See header file for more information 1427f8cca876SEd Tanous * @endinternal 1428f8cca876SEd Tanous */ 1429f8cca876SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1, 1430f8cca876SEd Tanous std::string_view arg2) 1431f8cca876SEd Tanous { 1432f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, 1433f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1434f8cca876SEd Tanous } 1435f8cca876SEd Tanous 1436f8cca876SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 1437f8cca876SEd Tanous const boost::urls::url_view_base& arg1, 1438f8cca876SEd Tanous std::string_view arg2) 1439f8cca876SEd Tanous { 1440f8cca876SEd Tanous res.result(boost::beast::http::status::unauthorized); 1441f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 1442f8cca876SEd Tanous } 1443f8cca876SEd Tanous 1444f8cca876SEd Tanous /** 1445f8cca876SEd Tanous * @internal 1446f8cca876SEd Tanous * @brief Formats CouldNotEstablishConnection message into JSON 1447f8cca876SEd Tanous * 1448f8cca876SEd Tanous * See header file for more information 1449f8cca876SEd Tanous * @endinternal 1450f8cca876SEd Tanous */ 1451f8cca876SEd Tanous nlohmann::json 1452f8cca876SEd Tanous couldNotEstablishConnection(const boost::urls::url_view_base& arg1) 1453f8cca876SEd Tanous { 1454f8cca876SEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 1455f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1456f8cca876SEd Tanous } 1457f8cca876SEd Tanous 1458f8cca876SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1459f8cca876SEd Tanous const boost::urls::url_view_base& arg1) 1460f8cca876SEd Tanous { 1461f8cca876SEd Tanous res.result(boost::beast::http::status::not_found); 1462f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1463f8cca876SEd Tanous } 1464f8cca876SEd Tanous 1465f8cca876SEd Tanous /** 1466f8cca876SEd Tanous * @internal 1467f8cca876SEd Tanous * @brief Formats SourceDoesNotSupportProtocol message into JSON 1468f8cca876SEd Tanous * 1469f8cca876SEd Tanous * See header file for more information 1470f8cca876SEd Tanous * @endinternal 1471f8cca876SEd Tanous */ 1472f8cca876SEd Tanous nlohmann::json sourceDoesNotSupportProtocol( 1473f8cca876SEd Tanous const boost::urls::url_view_base& arg1, std::string_view arg2) 1474f8cca876SEd Tanous { 1475f8cca876SEd Tanous return getLog( 1476f8cca876SEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 1477f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1478f8cca876SEd Tanous } 1479f8cca876SEd Tanous 1480f8cca876SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1481f8cca876SEd Tanous const boost::urls::url_view_base& arg1, 1482f8cca876SEd Tanous std::string_view arg2) 1483f8cca876SEd Tanous { 1484f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1485f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 1486f8cca876SEd Tanous sourceDoesNotSupportProtocol(arg1, arg2)); 1487f8cca876SEd Tanous } 1488f8cca876SEd Tanous 1489f8cca876SEd Tanous /** 1490f8cca876SEd Tanous * @internal 1491f8cca876SEd Tanous * @brief Formats AccessDenied message into JSON 1492f8cca876SEd Tanous * 1493f8cca876SEd Tanous * See header file for more information 1494f8cca876SEd Tanous * @endinternal 1495f8cca876SEd Tanous */ 1496f8cca876SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view_base& arg1) 1497f8cca876SEd Tanous { 1498f8cca876SEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 1499f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1500f8cca876SEd Tanous } 1501f8cca876SEd Tanous 1502f8cca876SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1) 1503f8cca876SEd Tanous { 1504f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 1505f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1506f8cca876SEd Tanous } 1507f8cca876SEd Tanous 1508f8cca876SEd Tanous /** 1509f8cca876SEd Tanous * @internal 1510f8cca876SEd Tanous * @brief Formats ServiceTemporarilyUnavailable message into JSON 1511f8cca876SEd Tanous * 1512f8cca876SEd Tanous * See header file for more information 1513f8cca876SEd Tanous * @endinternal 1514f8cca876SEd Tanous */ 1515f8cca876SEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 1516f8cca876SEd Tanous { 1517f8cca876SEd Tanous return getLog( 1518f8cca876SEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 1519f8cca876SEd Tanous std::to_array({arg1})); 1520f8cca876SEd Tanous } 1521f8cca876SEd Tanous 1522f8cca876SEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 1523f8cca876SEd Tanous { 1524f8cca876SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 1525f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1526f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 1527f8cca876SEd Tanous } 1528f8cca876SEd Tanous 1529f8cca876SEd Tanous /** 1530f8cca876SEd Tanous * @internal 1531f8cca876SEd Tanous * @brief Formats InvalidIndex message into JSON 1532f8cca876SEd Tanous * 1533f8cca876SEd Tanous * See header file for more information 1534f8cca876SEd Tanous * @endinternal 1535f8cca876SEd Tanous */ 1536*644cdcb8SEd Tanous nlohmann::json invalidIndex(uint64_t arg1) 1537f8cca876SEd Tanous { 1538f8cca876SEd Tanous std::string arg1Str = std::to_string(arg1); 1539f8cca876SEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 1540f8cca876SEd Tanous std::to_array<std::string_view>({arg1Str})); 1541f8cca876SEd Tanous } 1542f8cca876SEd Tanous 1543*644cdcb8SEd Tanous void invalidIndex(crow::Response& res, uint64_t arg1) 1544f8cca876SEd Tanous { 1545f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1546f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1547f8cca876SEd Tanous } 1548f8cca876SEd Tanous 1549f8cca876SEd Tanous /** 1550f8cca876SEd Tanous * @internal 1551f8cca876SEd Tanous * @brief Formats PropertyValueModified message into JSON 1552f8cca876SEd Tanous * 1553f8cca876SEd Tanous * See header file for more information 1554f8cca876SEd Tanous * @endinternal 1555f8cca876SEd Tanous */ 1556f8cca876SEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 1557f8cca876SEd Tanous const nlohmann::json& arg2) 1558f8cca876SEd Tanous { 1559f8cca876SEd Tanous std::string arg2Str = 1560f8cca876SEd Tanous arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1561f8cca876SEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 1562f8cca876SEd Tanous std::to_array<std::string_view>({arg1, arg2Str})); 1563f8cca876SEd Tanous } 1564f8cca876SEd Tanous 1565f8cca876SEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 1566f8cca876SEd Tanous const nlohmann::json& arg2) 1567f8cca876SEd Tanous { 1568f8cca876SEd Tanous res.result(boost::beast::http::status::ok); 1569f8cca876SEd Tanous addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1570f8cca876SEd Tanous } 1571f8cca876SEd Tanous 1572f8cca876SEd Tanous /** 1573f8cca876SEd Tanous * @internal 1574f8cca876SEd Tanous * @brief Formats ResourceInStandby message into JSON 1575f8cca876SEd Tanous * 1576f8cca876SEd Tanous * See header file for more information 1577f8cca876SEd Tanous * @endinternal 1578f8cca876SEd Tanous */ 1579f8cca876SEd Tanous nlohmann::json resourceInStandby() 1580f8cca876SEd Tanous { 1581f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1582f8cca876SEd Tanous } 1583f8cca876SEd Tanous 1584f8cca876SEd Tanous void resourceInStandby(crow::Response& res) 1585f8cca876SEd Tanous { 1586f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1587f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1588f8cca876SEd Tanous } 1589f8cca876SEd Tanous 1590f8cca876SEd Tanous /** 1591f8cca876SEd Tanous * @internal 1592f8cca876SEd Tanous * @brief Formats ResourceExhaustion message into JSON 1593f8cca876SEd Tanous * 1594f8cca876SEd Tanous * See header file for more information 1595f8cca876SEd Tanous * @endinternal 1596f8cca876SEd Tanous */ 1597f8cca876SEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 1598f8cca876SEd Tanous { 1599f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 1600f8cca876SEd Tanous std::to_array({arg1})); 1601f8cca876SEd Tanous } 1602f8cca876SEd Tanous 1603f8cca876SEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1604f8cca876SEd Tanous { 1605f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 1606f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1607f8cca876SEd Tanous } 1608f8cca876SEd Tanous 1609f8cca876SEd Tanous /** 1610f8cca876SEd Tanous * @internal 1611f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 1612f4c4dcf4SKowalski, Kamil * 1613f4c4dcf4SKowalski, Kamil * See header file for more information 1614f4c4dcf4SKowalski, Kamil * @endinternal 1615f4c4dcf4SKowalski, Kamil */ 1616*644cdcb8SEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, uint64_t arg2) 16171abe55efSEd Tanous { 16187ccfe684SEd Tanous std::string arg2Str = std::to_string(arg2); 1619fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 16207ccfe684SEd Tanous std::to_array<std::string_view>({arg1, arg2Str})); 1621b5c07418SJames Feist } 1622b5c07418SJames Feist 1623*644cdcb8SEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, 1624*644cdcb8SEd Tanous uint64_t arg2) 1625b5c07418SJames Feist { 1626b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1627b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 1628f4c4dcf4SKowalski, Kamil } 1629f4c4dcf4SKowalski, Kamil 1630f4c4dcf4SKowalski, Kamil /** 1631f4c4dcf4SKowalski, Kamil * @internal 1632f8cca876SEd Tanous * @brief Formats StringValueTooShort message into JSON 1633f8cca876SEd Tanous * 1634f8cca876SEd Tanous * See header file for more information 1635f8cca876SEd Tanous * @endinternal 1636f8cca876SEd Tanous */ 1637f8cca876SEd Tanous nlohmann::json stringValueTooShort(std::string_view arg1, std::string_view arg2) 1638f8cca876SEd Tanous { 1639f8cca876SEd Tanous return getLog(redfish::registries::base::Index::stringValueTooShort, 1640f8cca876SEd Tanous std::to_array({arg1, arg2})); 1641f8cca876SEd Tanous } 1642f8cca876SEd Tanous 1643f8cca876SEd Tanous void stringValueTooShort(crow::Response& res, std::string_view arg1, 1644f8cca876SEd Tanous std::string_view arg2) 1645f8cca876SEd Tanous { 1646f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1647f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2)); 1648f8cca876SEd Tanous } 1649f8cca876SEd Tanous 1650f8cca876SEd Tanous /** 1651f8cca876SEd Tanous * @internal 1652cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 1653cc9139ecSJason M. Bills * 1654cc9139ecSJason M. Bills * See header file for more information 1655cc9139ecSJason M. Bills * @endinternal 1656cc9139ecSJason M. Bills */ 1657d9fcfcc1SEd Tanous nlohmann::json sessionTerminated() 1658cc9139ecSJason M. Bills { 1659fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 1660b5c07418SJames Feist } 1661b5c07418SJames Feist 1662b5c07418SJames Feist void sessionTerminated(crow::Response& res) 1663b5c07418SJames Feist { 1664b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1665b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 1666cc9139ecSJason M. Bills } 1667cc9139ecSJason M. Bills 1668cc9139ecSJason M. Bills /** 1669cc9139ecSJason M. Bills * @internal 1670684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 1671684bb4b8SJason M. Bills * 1672684bb4b8SJason M. Bills * See header file for more information 1673684bb4b8SJason M. Bills * @endinternal 1674684bb4b8SJason M. Bills */ 1675d9fcfcc1SEd Tanous nlohmann::json subscriptionTerminated() 1676684bb4b8SJason M. Bills { 1677fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 1678684bb4b8SJason M. Bills } 1679684bb4b8SJason M. Bills 1680684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 1681684bb4b8SJason M. Bills { 1682684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 1683684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 1684684bb4b8SJason M. Bills } 1685684bb4b8SJason M. Bills 1686684bb4b8SJason M. Bills /** 1687684bb4b8SJason M. Bills * @internal 1688cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 1689cc9139ecSJason M. Bills * 1690cc9139ecSJason M. Bills * See header file for more information 1691cc9139ecSJason M. Bills * @endinternal 1692cc9139ecSJason M. Bills */ 16931668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 16941668ce6dSEd Tanous std::string_view arg2) 1695cc9139ecSJason M. Bills { 1696fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 16971668ce6dSEd Tanous std::to_array({arg1, arg2})); 1698b5c07418SJames Feist } 1699b5c07418SJames Feist 17001668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 17011668ce6dSEd Tanous std::string_view arg2) 1702b5c07418SJames Feist { 1703b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1704b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 1705cc9139ecSJason M. Bills } 1706cc9139ecSJason M. Bills 1707cc9139ecSJason M. Bills /** 1708cc9139ecSJason M. Bills * @internal 1709f8cca876SEd Tanous * @brief Formats PasswordChangeRequired message into JSON 1710f8cca876SEd Tanous * 1711f8cca876SEd Tanous * See header file for more information 1712f8cca876SEd Tanous * @endinternal 1713f8cca876SEd Tanous */ 1714f8cca876SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1) 1715f8cca876SEd Tanous { 1716f8cca876SEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 1717f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1718f8cca876SEd Tanous } 1719f8cca876SEd Tanous 1720f8cca876SEd Tanous void passwordChangeRequired(crow::Response& res, 1721f8cca876SEd Tanous const boost::urls::url_view_base& arg1) 1722f8cca876SEd Tanous { 1723f8cca876SEd Tanous addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 1724f8cca876SEd Tanous } 1725f8cca876SEd Tanous 1726f8cca876SEd Tanous /** 1727f8cca876SEd Tanous * @internal 1728684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 1729684bb4b8SJason M. Bills * 1730684bb4b8SJason M. Bills * See header file for more information 1731684bb4b8SJason M. Bills * @endinternal 1732684bb4b8SJason M. Bills */ 17334a7fbefdSEd Tanous nlohmann::json resetRequired(const boost::urls::url_view_base& arg1, 17344a7fbefdSEd Tanous std::string_view arg2) 1735684bb4b8SJason M. Bills { 1736fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 1737079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1738684bb4b8SJason M. Bills } 1739684bb4b8SJason M. Bills 17404a7fbefdSEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1, 17411668ce6dSEd Tanous std::string_view arg2) 1742684bb4b8SJason M. Bills { 1743684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1744684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 1745684bb4b8SJason M. Bills } 1746684bb4b8SJason M. Bills 1747684bb4b8SJason M. Bills /** 1748684bb4b8SJason M. Bills * @internal 1749f8cca876SEd Tanous * @brief Formats ResetRecommended message into JSON 1750f8cca876SEd Tanous * 1751f8cca876SEd Tanous * See header file for more information 1752f8cca876SEd Tanous * @endinternal 1753f8cca876SEd Tanous */ 1754f8cca876SEd Tanous nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2) 1755f8cca876SEd Tanous { 1756f8cca876SEd Tanous return getLog(redfish::registries::base::Index::resetRecommended, 1757f8cca876SEd Tanous std::to_array({arg1, arg2})); 1758f8cca876SEd Tanous } 1759f8cca876SEd Tanous 1760f8cca876SEd Tanous void resetRecommended(crow::Response& res, std::string_view arg1, 1761f8cca876SEd Tanous std::string_view arg2) 1762f8cca876SEd Tanous { 1763f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1764f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2)); 1765f8cca876SEd Tanous } 1766f8cca876SEd Tanous 1767f8cca876SEd Tanous /** 1768f8cca876SEd Tanous * @internal 1769684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 1770684bb4b8SJason M. Bills * 1771684bb4b8SJason M. Bills * See header file for more information 1772684bb4b8SJason M. Bills * @endinternal 1773684bb4b8SJason M. Bills */ 17741668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 1775684bb4b8SJason M. Bills { 17767ccfe684SEd Tanous return getLog(redfish::registries::base::Index::chassisPowerStateOnRequired, 17771668ce6dSEd Tanous std::to_array({arg1})); 1778684bb4b8SJason M. Bills } 1779684bb4b8SJason M. Bills 17801668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 1781684bb4b8SJason M. Bills { 1782684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1783684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 1784684bb4b8SJason M. Bills } 1785684bb4b8SJason M. Bills 1786684bb4b8SJason M. Bills /** 1787684bb4b8SJason M. Bills * @internal 1788684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 1789684bb4b8SJason M. Bills * 1790684bb4b8SJason M. Bills * See header file for more information 1791684bb4b8SJason M. Bills * @endinternal 1792684bb4b8SJason M. Bills */ 17931668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 1794684bb4b8SJason M. Bills { 1795b6cd31e1SEd Tanous return getLog( 1796fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 17971668ce6dSEd Tanous std::to_array({arg1})); 1798684bb4b8SJason M. Bills } 1799684bb4b8SJason M. Bills 18001668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 1801684bb4b8SJason M. Bills { 1802684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1803684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 1804684bb4b8SJason M. Bills } 1805684bb4b8SJason M. Bills 1806684bb4b8SJason M. Bills /** 1807684bb4b8SJason M. Bills * @internal 1808684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 1809684bb4b8SJason M. Bills * 1810684bb4b8SJason M. Bills * See header file for more information 1811684bb4b8SJason M. Bills * @endinternal 1812684bb4b8SJason M. Bills */ 18131668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 18141668ce6dSEd Tanous std::string_view arg2) 1815684bb4b8SJason M. Bills { 1816fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 18171668ce6dSEd Tanous std::to_array({arg1, arg2})); 1818684bb4b8SJason M. Bills } 1819684bb4b8SJason M. Bills 18201668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 18211668ce6dSEd Tanous std::string_view arg2) 1822684bb4b8SJason M. Bills { 1823684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1824684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 1825684bb4b8SJason M. Bills } 1826684bb4b8SJason M. Bills 1827684bb4b8SJason M. Bills /** 1828684bb4b8SJason M. Bills * @internal 18292a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 18302a6af81cSRamesh Iyyar * 18312a6af81cSRamesh Iyyar * See header file for more information 18322a6af81cSRamesh Iyyar * @endinternal 18332a6af81cSRamesh Iyyar */ 1834bd79bce8SPatrick Williams nlohmann::json propertyValueResourceConflict( 1835bd79bce8SPatrick Williams std::string_view arg1, const nlohmann::json& arg2, 18364a7fbefdSEd Tanous const boost::urls::url_view_base& arg3) 18372a6af81cSRamesh Iyyar { 1838bd79bce8SPatrick Williams std::string arg2Str = 1839034e1259SEd Tanous arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 18402a6af81cSRamesh Iyyar return getLog( 18412a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 184295b3ad73SEd Tanous std::to_array<std::string_view>({arg1, arg2Str, arg3.buffer()})); 18432a6af81cSRamesh Iyyar } 18442a6af81cSRamesh Iyyar 18452a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 184695b3ad73SEd Tanous const nlohmann::json& arg2, 18474a7fbefdSEd Tanous const boost::urls::url_view_base& arg3) 18482a6af81cSRamesh Iyyar { 18492a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 18502a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 18512a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 18522a6af81cSRamesh Iyyar } 18532a6af81cSRamesh Iyyar 18542a6af81cSRamesh Iyyar /** 18552a6af81cSRamesh Iyyar * @internal 185624861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 185724861a28SRamesh Iyyar * 185824861a28SRamesh Iyyar * See header file for more information 185924861a28SRamesh Iyyar * @endinternal 186024861a28SRamesh Iyyar */ 186124861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 186295b3ad73SEd Tanous const nlohmann::json& arg2) 186324861a28SRamesh Iyyar { 1864bd79bce8SPatrick Williams std::string arg2Str = 1865034e1259SEd Tanous arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 186624861a28SRamesh Iyyar return getLog( 186724861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 186895b3ad73SEd Tanous std::to_array<std::string_view>({arg1, arg2Str})); 186924861a28SRamesh Iyyar } 187024861a28SRamesh Iyyar 187124861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 187295b3ad73SEd Tanous const nlohmann::json& arg2) 187324861a28SRamesh Iyyar { 187424861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 187524861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 187624861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 187724861a28SRamesh Iyyar } 187824861a28SRamesh Iyyar 187924861a28SRamesh Iyyar /** 188024861a28SRamesh Iyyar * @internal 1881684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 1882684bb4b8SJason M. Bills * 1883684bb4b8SJason M. Bills * See header file for more information 1884684bb4b8SJason M. Bills * @endinternal 1885684bb4b8SJason M. Bills */ 1886367b3dceSGinu George nlohmann::json propertyValueIncorrect(std::string_view arg1, 1887367b3dceSGinu George const nlohmann::json& arg2) 1888684bb4b8SJason M. Bills { 1889bd79bce8SPatrick Williams std::string arg2Str = 1890034e1259SEd Tanous arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace); 1891fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 1892367b3dceSGinu George std::to_array<std::string_view>({arg1, arg2Str})); 1893684bb4b8SJason M. Bills } 1894684bb4b8SJason M. Bills 1895367b3dceSGinu George void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 1896367b3dceSGinu George const nlohmann::json& arg2) 1897684bb4b8SJason M. Bills { 1898684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1899684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 1900684bb4b8SJason M. Bills } 1901684bb4b8SJason M. Bills 1902684bb4b8SJason M. Bills /** 1903684bb4b8SJason M. Bills * @internal 1904684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 1905684bb4b8SJason M. Bills * 1906684bb4b8SJason M. Bills * See header file for more information 1907684bb4b8SJason M. Bills * @endinternal 1908684bb4b8SJason M. Bills */ 19094a7fbefdSEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view_base& arg1) 1910684bb4b8SJason M. Bills { 1911fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 1912079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1913684bb4b8SJason M. Bills } 1914684bb4b8SJason M. Bills 19154a7fbefdSEd Tanous void resourceCreationConflict(crow::Response& res, 19164a7fbefdSEd Tanous const boost::urls::url_view_base& arg1) 1917684bb4b8SJason M. Bills { 1918684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1919684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 1920684bb4b8SJason M. Bills } 1921684bb4b8SJason M. Bills 1922684bb4b8SJason M. Bills /** 1923684bb4b8SJason M. Bills * @internal 1924f8cca876SEd Tanous * @brief Formats ActionParameterValueConflict message into JSON 1925f8cca876SEd Tanous * 1926f8cca876SEd Tanous * See header file for more information 1927f8cca876SEd Tanous * @endinternal 1928f8cca876SEd Tanous */ 1929f8cca876SEd Tanous nlohmann::json 1930f8cca876SEd Tanous actionParameterValueConflict(std::string_view arg1, std::string_view arg2) 1931f8cca876SEd Tanous { 1932f8cca876SEd Tanous return getLog( 1933f8cca876SEd Tanous redfish::registries::base::Index::actionParameterValueConflict, 1934f8cca876SEd Tanous std::to_array({arg1, arg2})); 1935f8cca876SEd Tanous } 1936f8cca876SEd Tanous 1937f8cca876SEd Tanous void actionParameterValueConflict(crow::Response& res, std::string_view arg1, 1938f8cca876SEd Tanous std::string_view arg2) 1939f8cca876SEd Tanous { 1940f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 1941f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, 1942f8cca876SEd Tanous actionParameterValueConflict(arg1, arg2)); 1943f8cca876SEd Tanous } 1944f8cca876SEd Tanous 1945f8cca876SEd Tanous /** 1946f8cca876SEd Tanous * @internal 1947684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 1948684bb4b8SJason M. Bills * 1949684bb4b8SJason M. Bills * See header file for more information 1950684bb4b8SJason M. Bills * @endinternal 1951684bb4b8SJason M. Bills */ 1952d9fcfcc1SEd Tanous nlohmann::json maximumErrorsExceeded() 1953684bb4b8SJason M. Bills { 1954fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 1955684bb4b8SJason M. Bills } 1956684bb4b8SJason M. Bills 1957684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 1958684bb4b8SJason M. Bills { 1959684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1960684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 1961684bb4b8SJason M. Bills } 1962684bb4b8SJason M. Bills 1963684bb4b8SJason M. Bills /** 1964684bb4b8SJason M. Bills * @internal 1965684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 1966684bb4b8SJason M. Bills * 1967684bb4b8SJason M. Bills * See header file for more information 1968684bb4b8SJason M. Bills * @endinternal 1969684bb4b8SJason M. Bills */ 1970d9fcfcc1SEd Tanous nlohmann::json preconditionFailed() 1971684bb4b8SJason M. Bills { 1972fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 1973684bb4b8SJason M. Bills } 1974684bb4b8SJason M. Bills 1975684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 1976684bb4b8SJason M. Bills { 19774df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 1978684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1979684bb4b8SJason M. Bills } 1980684bb4b8SJason M. Bills 1981684bb4b8SJason M. Bills /** 1982684bb4b8SJason M. Bills * @internal 1983684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 1984684bb4b8SJason M. Bills * 1985684bb4b8SJason M. Bills * See header file for more information 1986684bb4b8SJason M. Bills * @endinternal 1987684bb4b8SJason M. Bills */ 1988d9fcfcc1SEd Tanous nlohmann::json preconditionRequired() 1989684bb4b8SJason M. Bills { 1990fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 1991684bb4b8SJason M. Bills } 1992684bb4b8SJason M. Bills 1993684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 1994684bb4b8SJason M. Bills { 1995684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1996684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1997684bb4b8SJason M. Bills } 1998684bb4b8SJason M. Bills 1999684bb4b8SJason M. Bills /** 2000684bb4b8SJason M. Bills * @internal 2001f8cca876SEd Tanous * @brief Formats HeaderMissing message into JSON 2002f8cca876SEd Tanous * 2003f8cca876SEd Tanous * See header file for more information 2004f8cca876SEd Tanous * @endinternal 2005f8cca876SEd Tanous */ 2006f8cca876SEd Tanous nlohmann::json headerMissing(std::string_view arg1) 2007f8cca876SEd Tanous { 2008f8cca876SEd Tanous return getLog(redfish::registries::base::Index::headerMissing, 2009f8cca876SEd Tanous std::to_array({arg1})); 2010f8cca876SEd Tanous } 2011f8cca876SEd Tanous 2012f8cca876SEd Tanous void headerMissing(crow::Response& res, std::string_view arg1) 2013f8cca876SEd Tanous { 2014f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 2015f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, headerMissing(arg1)); 2016f8cca876SEd Tanous } 2017f8cca876SEd Tanous 2018f8cca876SEd Tanous /** 2019f8cca876SEd Tanous * @internal 2020f8cca876SEd Tanous * @brief Formats HeaderInvalid message into JSON 2021f8cca876SEd Tanous * 2022f8cca876SEd Tanous * See header file for more information 2023f8cca876SEd Tanous * @endinternal 2024f8cca876SEd Tanous */ 2025f8cca876SEd Tanous nlohmann::json headerInvalid(std::string_view arg1) 2026f8cca876SEd Tanous { 2027f8cca876SEd Tanous return getLog(redfish::registries::base::Index::headerInvalid, 2028f8cca876SEd Tanous std::to_array({arg1})); 2029f8cca876SEd Tanous } 2030f8cca876SEd Tanous 2031f8cca876SEd Tanous void headerInvalid(crow::Response& res, std::string_view arg1) 2032f8cca876SEd Tanous { 2033f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 2034f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, headerInvalid(arg1)); 2035f8cca876SEd Tanous } 2036f8cca876SEd Tanous 2037f8cca876SEd Tanous /** 2038f8cca876SEd Tanous * @internal 2039684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 2040684bb4b8SJason M. Bills * 2041684bb4b8SJason M. Bills * See header file for more information 2042684bb4b8SJason M. Bills * @endinternal 2043684bb4b8SJason M. Bills */ 2044d9fcfcc1SEd Tanous nlohmann::json operationFailed() 2045684bb4b8SJason M. Bills { 2046fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 2047684bb4b8SJason M. Bills } 2048684bb4b8SJason M. Bills 2049684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 2050684bb4b8SJason M. Bills { 20518868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 2052684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 2053684bb4b8SJason M. Bills } 2054684bb4b8SJason M. Bills 2055684bb4b8SJason M. Bills /** 2056684bb4b8SJason M. Bills * @internal 2057684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 2058684bb4b8SJason M. Bills * 2059684bb4b8SJason M. Bills * See header file for more information 2060684bb4b8SJason M. Bills * @endinternal 2061684bb4b8SJason M. Bills */ 2062d9fcfcc1SEd Tanous nlohmann::json operationTimeout() 2063684bb4b8SJason M. Bills { 2064fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 2065684bb4b8SJason M. Bills } 2066684bb4b8SJason M. Bills 2067684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 2068684bb4b8SJason M. Bills { 2069684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 2070684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 2071684bb4b8SJason M. Bills } 2072684bb4b8SJason M. Bills 2073684bb4b8SJason M. Bills /** 2074684bb4b8SJason M. Bills * @internal 207544c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 207644c70412SEd Tanous * 207744c70412SEd Tanous * See header file for more information 207844c70412SEd Tanous * @endinternal 207944c70412SEd Tanous */ 208044c70412SEd Tanous nlohmann::json operationNotAllowed() 208144c70412SEd Tanous { 208244c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 208344c70412SEd Tanous } 208444c70412SEd Tanous 208544c70412SEd Tanous void operationNotAllowed(crow::Response& res) 208644c70412SEd Tanous { 208744c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 208844c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 208944c70412SEd Tanous } 209044c70412SEd Tanous 2091600af5f1SAppaRao Puli /** 2092600af5f1SAppaRao Puli * @internal 20937ccfe684SEd Tanous * @brief Formats UndeterminedFault message into JSON 20947ccfe684SEd Tanous * 20957ccfe684SEd Tanous * See header file for more information 20967ccfe684SEd Tanous * @endinternal 20977ccfe684SEd Tanous */ 20987ccfe684SEd Tanous nlohmann::json undeterminedFault(std::string_view arg1) 20997ccfe684SEd Tanous { 21007ccfe684SEd Tanous return getLog(redfish::registries::base::Index::undeterminedFault, 21017ccfe684SEd Tanous std::to_array({arg1})); 21027ccfe684SEd Tanous } 21037ccfe684SEd Tanous 21047ccfe684SEd Tanous void undeterminedFault(crow::Response& res, std::string_view arg1) 21057ccfe684SEd Tanous { 21067ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 21077ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, undeterminedFault(arg1)); 21087ccfe684SEd Tanous } 21097ccfe684SEd Tanous 21107ccfe684SEd Tanous /** 21117ccfe684SEd Tanous * @internal 21127ccfe684SEd Tanous * @brief Formats ConditionInRelatedResource message into JSON 21137ccfe684SEd Tanous * 21147ccfe684SEd Tanous * See header file for more information 21157ccfe684SEd Tanous * @endinternal 21167ccfe684SEd Tanous */ 21177ccfe684SEd Tanous nlohmann::json conditionInRelatedResource() 21187ccfe684SEd Tanous { 21197ccfe684SEd Tanous return getLog(redfish::registries::base::Index::conditionInRelatedResource, 21207ccfe684SEd Tanous {}); 21217ccfe684SEd Tanous } 21227ccfe684SEd Tanous 21237ccfe684SEd Tanous void conditionInRelatedResource(crow::Response& res) 21247ccfe684SEd Tanous { 21257ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 21267ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, conditionInRelatedResource()); 21277ccfe684SEd Tanous } 21287ccfe684SEd Tanous 21297ccfe684SEd Tanous /** 21307ccfe684SEd Tanous * @internal 21317ccfe684SEd Tanous * @brief Formats RestrictedRole message into JSON 21327ccfe684SEd Tanous * 21337ccfe684SEd Tanous * See header file for more information 21347ccfe684SEd Tanous * @endinternal 21357ccfe684SEd Tanous */ 21367ccfe684SEd Tanous nlohmann::json restrictedRole(std::string_view arg1) 21377ccfe684SEd Tanous { 21387ccfe684SEd Tanous return getLog(redfish::registries::base::Index::restrictedRole, 21397ccfe684SEd Tanous std::to_array({arg1})); 21407ccfe684SEd Tanous } 21417ccfe684SEd Tanous 21427ccfe684SEd Tanous void restrictedRole(crow::Response& res, std::string_view arg1) 21437ccfe684SEd Tanous { 21447ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 21457ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, restrictedRole(arg1)); 21467ccfe684SEd Tanous } 21477ccfe684SEd Tanous 21487ccfe684SEd Tanous /** 21497ccfe684SEd Tanous * @internal 21507ccfe684SEd Tanous * @brief Formats RestrictedPrivilege message into JSON 21517ccfe684SEd Tanous * 21527ccfe684SEd Tanous * See header file for more information 21537ccfe684SEd Tanous * @endinternal 21547ccfe684SEd Tanous */ 21557ccfe684SEd Tanous nlohmann::json restrictedPrivilege(std::string_view arg1) 21567ccfe684SEd Tanous { 21577ccfe684SEd Tanous return getLog(redfish::registries::base::Index::restrictedPrivilege, 21587ccfe684SEd Tanous std::to_array({arg1})); 21597ccfe684SEd Tanous } 21607ccfe684SEd Tanous 21617ccfe684SEd Tanous void restrictedPrivilege(crow::Response& res, std::string_view arg1) 21627ccfe684SEd Tanous { 21637ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 21647ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, restrictedPrivilege(arg1)); 21657ccfe684SEd Tanous } 21667ccfe684SEd Tanous 21677ccfe684SEd Tanous /** 21687ccfe684SEd Tanous * @internal 2169f8cca876SEd Tanous * @brief Formats StrictAccountTypes message into JSON 2170f8cca876SEd Tanous * 2171f8cca876SEd Tanous * See header file for more information 2172f8cca876SEd Tanous * @endinternal 2173f8cca876SEd Tanous */ 2174f8cca876SEd Tanous nlohmann::json strictAccountTypes(std::string_view arg1) 2175f8cca876SEd Tanous { 2176f8cca876SEd Tanous return getLog(redfish::registries::base::Index::strictAccountTypes, 2177f8cca876SEd Tanous std::to_array({arg1})); 2178f8cca876SEd Tanous } 2179f8cca876SEd Tanous 2180f8cca876SEd Tanous void strictAccountTypes(crow::Response& res, std::string_view arg1) 2181f8cca876SEd Tanous { 2182f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 2183f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 2184f8cca876SEd Tanous } 2185f8cca876SEd Tanous 2186f8cca876SEd Tanous /** 2187f8cca876SEd Tanous * @internal 21887ccfe684SEd Tanous * @brief Formats PropertyDeprecated message into JSON 21897ccfe684SEd Tanous * 21907ccfe684SEd Tanous * See header file for more information 21917ccfe684SEd Tanous * @endinternal 21927ccfe684SEd Tanous */ 21937ccfe684SEd Tanous nlohmann::json propertyDeprecated(std::string_view arg1) 21947ccfe684SEd Tanous { 21957ccfe684SEd Tanous return getLog(redfish::registries::base::Index::propertyDeprecated, 21967ccfe684SEd Tanous std::to_array({arg1})); 21977ccfe684SEd Tanous } 21987ccfe684SEd Tanous 21997ccfe684SEd Tanous void propertyDeprecated(crow::Response& res, std::string_view arg1) 22007ccfe684SEd Tanous { 22017ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 22027ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, propertyDeprecated(arg1)); 22037ccfe684SEd Tanous } 22047ccfe684SEd Tanous 22057ccfe684SEd Tanous /** 22067ccfe684SEd Tanous * @internal 22077ccfe684SEd Tanous * @brief Formats ResourceDeprecated message into JSON 22087ccfe684SEd Tanous * 22097ccfe684SEd Tanous * See header file for more information 22107ccfe684SEd Tanous * @endinternal 22117ccfe684SEd Tanous */ 22127ccfe684SEd Tanous nlohmann::json resourceDeprecated(std::string_view arg1) 22137ccfe684SEd Tanous { 22147ccfe684SEd Tanous return getLog(redfish::registries::base::Index::resourceDeprecated, 22157ccfe684SEd Tanous std::to_array({arg1})); 22167ccfe684SEd Tanous } 22177ccfe684SEd Tanous 22187ccfe684SEd Tanous void resourceDeprecated(crow::Response& res, std::string_view arg1) 22197ccfe684SEd Tanous { 22207ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 22217ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, resourceDeprecated(arg1)); 22227ccfe684SEd Tanous } 22237ccfe684SEd Tanous 22247ccfe684SEd Tanous /** 22257ccfe684SEd Tanous * @internal 22267ccfe684SEd Tanous * @brief Formats PropertyValueDeprecated message into JSON 22277ccfe684SEd Tanous * 22287ccfe684SEd Tanous * See header file for more information 22297ccfe684SEd Tanous * @endinternal 22307ccfe684SEd Tanous */ 22317ccfe684SEd Tanous nlohmann::json propertyValueDeprecated(std::string_view arg1, 22327ccfe684SEd Tanous std::string_view arg2) 22337ccfe684SEd Tanous { 22347ccfe684SEd Tanous return getLog(redfish::registries::base::Index::propertyValueDeprecated, 22357ccfe684SEd Tanous std::to_array({arg1, arg2})); 22367ccfe684SEd Tanous } 22377ccfe684SEd Tanous 22387ccfe684SEd Tanous void propertyValueDeprecated(crow::Response& res, std::string_view arg1, 22397ccfe684SEd Tanous std::string_view arg2) 22407ccfe684SEd Tanous { 22417ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 22427ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, propertyValueDeprecated(arg1, arg2)); 22437ccfe684SEd Tanous } 22447ccfe684SEd Tanous 22457ccfe684SEd Tanous /** 22467ccfe684SEd Tanous * @internal 22477ccfe684SEd Tanous * @brief Formats ActionDeprecated message into JSON 22487ccfe684SEd Tanous * 22497ccfe684SEd Tanous * See header file for more information 22507ccfe684SEd Tanous * @endinternal 22517ccfe684SEd Tanous */ 22527ccfe684SEd Tanous nlohmann::json actionDeprecated(std::string_view arg1) 22537ccfe684SEd Tanous { 22547ccfe684SEd Tanous return getLog(redfish::registries::base::Index::actionDeprecated, 22557ccfe684SEd Tanous std::to_array({arg1})); 22567ccfe684SEd Tanous } 22577ccfe684SEd Tanous 22587ccfe684SEd Tanous void actionDeprecated(crow::Response& res, std::string_view arg1) 22597ccfe684SEd Tanous { 22607ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 22617ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, actionDeprecated(arg1)); 22627ccfe684SEd Tanous } 22637ccfe684SEd Tanous 22647ccfe684SEd Tanous /** 22657ccfe684SEd Tanous * @internal 22667ccfe684SEd Tanous * @brief Formats NetworkNameResolutionNotConfigured message into JSON 22677ccfe684SEd Tanous * 22687ccfe684SEd Tanous * See header file for more information 22697ccfe684SEd Tanous * @endinternal 22707ccfe684SEd Tanous */ 22717ccfe684SEd Tanous nlohmann::json networkNameResolutionNotConfigured() 22727ccfe684SEd Tanous { 22737ccfe684SEd Tanous return getLog( 22747ccfe684SEd Tanous redfish::registries::base::Index::networkNameResolutionNotConfigured, 22757ccfe684SEd Tanous {}); 22767ccfe684SEd Tanous } 22777ccfe684SEd Tanous 22787ccfe684SEd Tanous void networkNameResolutionNotConfigured(crow::Response& res) 22797ccfe684SEd Tanous { 22807ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 22817ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, networkNameResolutionNotConfigured()); 22827ccfe684SEd Tanous } 22837ccfe684SEd Tanous 22847ccfe684SEd Tanous /** 22857ccfe684SEd Tanous * @internal 22867ccfe684SEd Tanous * @brief Formats NetworkNameResolutionNotSupported message into JSON 22877ccfe684SEd Tanous * 22887ccfe684SEd Tanous * See header file for more information 22897ccfe684SEd Tanous * @endinternal 22907ccfe684SEd Tanous */ 22917ccfe684SEd Tanous nlohmann::json networkNameResolutionNotSupported() 22927ccfe684SEd Tanous { 22937ccfe684SEd Tanous return getLog( 22947ccfe684SEd Tanous redfish::registries::base::Index::networkNameResolutionNotSupported, 22957ccfe684SEd Tanous {}); 22967ccfe684SEd Tanous } 22977ccfe684SEd Tanous 22987ccfe684SEd Tanous void networkNameResolutionNotSupported(crow::Response& res) 22997ccfe684SEd Tanous { 23007ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 23017ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, networkNameResolutionNotSupported()); 23027ccfe684SEd Tanous } 23037ccfe684SEd Tanous 23047ccfe684SEd Tanous /** 23057ccfe684SEd Tanous * @internal 2306f8cca876SEd Tanous * @brief Formats ServiceDisabled message into JSON 2307f8cca876SEd Tanous * 2308f8cca876SEd Tanous * See header file for more information 2309f8cca876SEd Tanous * @endinternal 2310f8cca876SEd Tanous */ 2311f8cca876SEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 2312f8cca876SEd Tanous { 2313f8cca876SEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 2314f8cca876SEd Tanous std::to_array({arg1})); 2315f8cca876SEd Tanous } 2316f8cca876SEd Tanous 2317f8cca876SEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 2318f8cca876SEd Tanous { 2319f8cca876SEd Tanous res.result(boost::beast::http::status::service_unavailable); 2320f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 2321f8cca876SEd Tanous } 2322f8cca876SEd Tanous 2323f8cca876SEd Tanous /** 2324f8cca876SEd Tanous * @internal 2325f8cca876SEd Tanous * @brief Formats EventBufferExceeded message into JSON 2326f8cca876SEd Tanous * 2327f8cca876SEd Tanous * See header file for more information 2328f8cca876SEd Tanous * @endinternal 2329f8cca876SEd Tanous */ 2330f8cca876SEd Tanous nlohmann::json eventBufferExceeded() 2331f8cca876SEd Tanous { 2332f8cca876SEd Tanous return getLog(redfish::registries::base::Index::eventBufferExceeded, {}); 2333f8cca876SEd Tanous } 2334f8cca876SEd Tanous 2335f8cca876SEd Tanous void eventBufferExceeded(crow::Response& res) 2336f8cca876SEd Tanous { 2337f8cca876SEd Tanous res.result(boost::beast::http::status::bad_request); 2338f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, eventBufferExceeded()); 2339f8cca876SEd Tanous } 2340f8cca876SEd Tanous 2341f8cca876SEd Tanous /** 2342f8cca876SEd Tanous * @internal 23437ccfe684SEd Tanous * @brief Formats AuthenticationTokenRequired message into JSON 23447ccfe684SEd Tanous * 23457ccfe684SEd Tanous * See header file for more information 23467ccfe684SEd Tanous * @endinternal 23477ccfe684SEd Tanous */ 23487ccfe684SEd Tanous nlohmann::json authenticationTokenRequired() 23497ccfe684SEd Tanous { 23507ccfe684SEd Tanous return getLog(redfish::registries::base::Index::authenticationTokenRequired, 23517ccfe684SEd Tanous {}); 23527ccfe684SEd Tanous } 23537ccfe684SEd Tanous 23547ccfe684SEd Tanous void authenticationTokenRequired(crow::Response& res) 23557ccfe684SEd Tanous { 23567ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 23577ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, authenticationTokenRequired()); 23587ccfe684SEd Tanous } 23597ccfe684SEd Tanous 23607ccfe684SEd Tanous /** 23617ccfe684SEd Tanous * @internal 23627ccfe684SEd Tanous * @brief Formats OneTimePasscodeSent message into JSON 23637ccfe684SEd Tanous * 23647ccfe684SEd Tanous * See header file for more information 23657ccfe684SEd Tanous * @endinternal 23667ccfe684SEd Tanous */ 23677ccfe684SEd Tanous nlohmann::json oneTimePasscodeSent(std::string_view arg1) 23687ccfe684SEd Tanous { 23697ccfe684SEd Tanous return getLog(redfish::registries::base::Index::oneTimePasscodeSent, 23707ccfe684SEd Tanous std::to_array({arg1})); 23717ccfe684SEd Tanous } 23727ccfe684SEd Tanous 23737ccfe684SEd Tanous void oneTimePasscodeSent(crow::Response& res, std::string_view arg1) 23747ccfe684SEd Tanous { 23757ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 23767ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, oneTimePasscodeSent(arg1)); 23777ccfe684SEd Tanous } 23787ccfe684SEd Tanous 23797ccfe684SEd Tanous /** 23807ccfe684SEd Tanous * @internal 23817ccfe684SEd Tanous * @brief Formats LicenseRequired message into JSON 23827ccfe684SEd Tanous * 23837ccfe684SEd Tanous * See header file for more information 23847ccfe684SEd Tanous * @endinternal 23857ccfe684SEd Tanous */ 23867ccfe684SEd Tanous nlohmann::json licenseRequired(std::string_view arg1) 23877ccfe684SEd Tanous { 23887ccfe684SEd Tanous return getLog(redfish::registries::base::Index::licenseRequired, 23897ccfe684SEd Tanous std::to_array({arg1})); 23907ccfe684SEd Tanous } 23917ccfe684SEd Tanous 23927ccfe684SEd Tanous void licenseRequired(crow::Response& res, std::string_view arg1) 23937ccfe684SEd Tanous { 23947ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 23957ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, licenseRequired(arg1)); 23967ccfe684SEd Tanous } 23977ccfe684SEd Tanous 23987ccfe684SEd Tanous /** 23997ccfe684SEd Tanous * @internal 24007ccfe684SEd Tanous * @brief Formats PropertyModified message into JSON 24017ccfe684SEd Tanous * 24027ccfe684SEd Tanous * See header file for more information 24037ccfe684SEd Tanous * @endinternal 24047ccfe684SEd Tanous */ 24057ccfe684SEd Tanous nlohmann::json propertyModified() 24067ccfe684SEd Tanous { 24077ccfe684SEd Tanous return getLog(redfish::registries::base::Index::propertyModified, {}); 24087ccfe684SEd Tanous } 24097ccfe684SEd Tanous 24107ccfe684SEd Tanous void propertyModified(crow::Response& res) 24117ccfe684SEd Tanous { 24127ccfe684SEd Tanous res.result(boost::beast::http::status::bad_request); 24137ccfe684SEd Tanous addMessageToErrorJson(res.jsonValue, propertyModified()); 24147585b760SJishnu CM } 24157585b760SJishnu CM 2416f8cca876SEd Tanous /** 2417f8cca876SEd Tanous * @internal 2418f8cca876SEd Tanous * @brief Formats GenerateSecretKeyRequired message into JSON 2419f8cca876SEd Tanous * 2420f8cca876SEd Tanous * See header file for more information 2421f8cca876SEd Tanous * @endinternal 2422f8cca876SEd Tanous */ 2423f8cca876SEd Tanous nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1) 2424f8cca876SEd Tanous { 2425f8cca876SEd Tanous return getLog(redfish::registries::base::Index::generateSecretKeyRequired, 2426f8cca876SEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 2427f8cca876SEd Tanous } 2428f8cca876SEd Tanous 2429f8cca876SEd Tanous void generateSecretKeyRequired(crow::Response& res, 2430f8cca876SEd Tanous const boost::urls::url_view_base& arg1) 2431f8cca876SEd Tanous { 2432f8cca876SEd Tanous res.result(boost::beast::http::status::forbidden); 2433f8cca876SEd Tanous addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1)); 2434f8cca876SEd Tanous } 2435f8cca876SEd Tanous 2436f4c4dcf4SKowalski, Kamil } // namespace messages 2437d425c6f6SEd Tanous } // namespace redfish 2438