1f4c4dcf4SKowalski, Kamil /* 2f4c4dcf4SKowalski, Kamil // Copyright (c) 2018 Intel Corporation 3f4c4dcf4SKowalski, Kamil // 4f4c4dcf4SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License"); 5f4c4dcf4SKowalski, Kamil // you may not use this file except in compliance with the License. 6f4c4dcf4SKowalski, Kamil // You may obtain a copy of the License at 7f4c4dcf4SKowalski, Kamil // 8f4c4dcf4SKowalski, Kamil // http://www.apache.org/licenses/LICENSE-2.0 9f4c4dcf4SKowalski, Kamil // 10f4c4dcf4SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software 11f4c4dcf4SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS, 12f4c4dcf4SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f4c4dcf4SKowalski, Kamil // See the License for the specific language governing permissions and 14f4c4dcf4SKowalski, Kamil // limitations under the License. 15f4c4dcf4SKowalski, Kamil */ 160442ef92SNan Zhou #include "error_messages.hpp" 179ea15c35SEd Tanous 180442ef92SNan Zhou #include "http_response.hpp" 190442ef92SNan Zhou #include "logging.hpp" 200442ef92SNan Zhou #include "registries.hpp" 210442ef92SNan Zhou #include "registries/base_message_registry.hpp" 220442ef92SNan Zhou #include "source_location.hpp" 230442ef92SNan Zhou 240442ef92SNan Zhou #include <boost/beast/http/field.hpp> 259ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 26faf100f9SEd Tanous #include <nlohmann/json.hpp> 27f4c4dcf4SKowalski, Kamil 281668ce6dSEd Tanous #include <array> 290442ef92SNan Zhou #include <cstddef> 300442ef92SNan Zhou #include <span> 310442ef92SNan Zhou #include <string> 320442ef92SNan Zhou #include <utility> 330442ef92SNan Zhou 340442ef92SNan Zhou // IWYU pragma: no_include <stddef.h> 351668ce6dSEd Tanous 361abe55efSEd Tanous namespace redfish 371abe55efSEd Tanous { 381abe55efSEd Tanous 391abe55efSEd Tanous namespace messages 401abe55efSEd Tanous { 41f4c4dcf4SKowalski, Kamil 42f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 431abe55efSEd Tanous const nlohmann::json& message) 441abe55efSEd Tanous { 45f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 46f4c4dcf4SKowalski, Kamil 471abe55efSEd Tanous // If this is the first error message, fill in the information from the 481abe55efSEd Tanous // first error message to the top level struct 491abe55efSEd Tanous if (!error.is_object()) 501abe55efSEd Tanous { 51c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 52c074230bSJason M. Bills if (messageIdIterator == message.end()) 531abe55efSEd Tanous { 541abe55efSEd Tanous BMCWEB_LOG_CRITICAL 551abe55efSEd Tanous << "Attempt to add error message without MessageId"; 56f4c4dcf4SKowalski, Kamil return; 57f4c4dcf4SKowalski, Kamil } 58f4c4dcf4SKowalski, Kamil 59c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 60c074230bSJason M. Bills if (messageFieldIterator == message.end()) 611abe55efSEd Tanous { 621abe55efSEd Tanous BMCWEB_LOG_CRITICAL 631abe55efSEd Tanous << "Attempt to add error message without Message"; 64f4c4dcf4SKowalski, Kamil return; 65f4c4dcf4SKowalski, Kamil } 661476687dSEd Tanous error["code"] = *messageIdIterator; 671476687dSEd Tanous error["message"] = *messageFieldIterator; 681abe55efSEd Tanous } 691abe55efSEd Tanous else 701abe55efSEd Tanous { 71f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 7255c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 73cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 74cc9139ecSJason M. Bills "information on how to resolve the error."; 75f4c4dcf4SKowalski, Kamil } 76f4c4dcf4SKowalski, Kamil 773590bd1dSNan Zhou // This check could technically be done in the default construction 78f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 79f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 80c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 81c074230bSJason M. Bills if (!extendedInfo.is_array()) 821abe55efSEd Tanous { 83c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 84f4c4dcf4SKowalski, Kamil } 85f4c4dcf4SKowalski, Kamil 86c074230bSJason M. Bills extendedInfo.push_back(message); 87f4c4dcf4SKowalski, Kamil } 88f4c4dcf4SKowalski, Kamil 893590bd1dSNan Zhou void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source) 903590bd1dSNan Zhou { 913590bd1dSNan Zhou if (!source.is_object()) 923590bd1dSNan Zhou { 933590bd1dSNan Zhou return; 943590bd1dSNan Zhou } 953590bd1dSNan Zhou auto errorIt = source.find("error"); 963590bd1dSNan Zhou if (errorIt == source.end()) 973590bd1dSNan Zhou { 983590bd1dSNan Zhou // caller puts error message in root 993590bd1dSNan Zhou messages::addMessageToErrorJson(target, source); 1003590bd1dSNan Zhou source.clear(); 1013590bd1dSNan Zhou return; 1023590bd1dSNan Zhou } 1033590bd1dSNan Zhou auto extendedInfoIt = errorIt->find(messages::messageAnnotation); 1043590bd1dSNan Zhou if (extendedInfoIt == errorIt->end()) 1053590bd1dSNan Zhou { 1063590bd1dSNan Zhou return; 1073590bd1dSNan Zhou } 1083590bd1dSNan Zhou const nlohmann::json::array_t* extendedInfo = 1093590bd1dSNan Zhou (*extendedInfoIt).get_ptr<const nlohmann::json::array_t*>(); 1103590bd1dSNan Zhou if (extendedInfo == nullptr) 1113590bd1dSNan Zhou { 1123590bd1dSNan Zhou source.erase(errorIt); 1133590bd1dSNan Zhou return; 1143590bd1dSNan Zhou } 1153590bd1dSNan Zhou for (const nlohmann::json& message : *extendedInfo) 1163590bd1dSNan Zhou { 1173590bd1dSNan Zhou addMessageToErrorJson(target, message); 1183590bd1dSNan Zhou } 1193590bd1dSNan Zhou source.erase(errorIt); 1203590bd1dSNan Zhou } 1213590bd1dSNan Zhou 122f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 123f12894f8SJason M. Bills const nlohmann::json& message) 1241abe55efSEd Tanous { 1251abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 1261abe55efSEd Tanous { 127f4c4dcf4SKowalski, Kamil // Force object to be an array 12855c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 129f4c4dcf4SKowalski, Kamil } 130f4c4dcf4SKowalski, Kamil 13155c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 132f4c4dcf4SKowalski, Kamil } 133f4c4dcf4SKowalski, Kamil 134f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 135f12894f8SJason M. Bills const nlohmann::json& message, 1361668ce6dSEd Tanous std::string_view fieldPath) 1371abe55efSEd Tanous { 1381668ce6dSEd Tanous std::string extendedInfo(fieldPath); 1391668ce6dSEd Tanous extendedInfo += messages::messageAnnotation; 140f4c4dcf4SKowalski, Kamil 1411668ce6dSEd Tanous nlohmann::json& field = target[extendedInfo]; 1421668ce6dSEd Tanous if (!field.is_array()) 1431abe55efSEd Tanous { 144f4c4dcf4SKowalski, Kamil // Force object to be an array 1451668ce6dSEd Tanous field = nlohmann::json::array(); 146f4c4dcf4SKowalski, Kamil } 147f4c4dcf4SKowalski, Kamil 148f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 1491668ce6dSEd Tanous field.push_back(message); 150f4c4dcf4SKowalski, Kamil } 151f4c4dcf4SKowalski, Kamil 152f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name, 153b6cd31e1SEd Tanous std::span<const std::string_view> args) 154b6cd31e1SEd Tanous { 155b6cd31e1SEd Tanous size_t index = static_cast<size_t>(name); 156fffb8c1fSEd Tanous if (index >= redfish::registries::base::registry.size()) 157b6cd31e1SEd Tanous { 158b6cd31e1SEd Tanous return {}; 159b6cd31e1SEd Tanous } 16065e4f1f7SEd Tanous return getLogFromRegistry(redfish::registries::base::header, 16165e4f1f7SEd Tanous redfish::registries::base::registry, index, args); 162b6cd31e1SEd Tanous } 163b6cd31e1SEd Tanous 164f4c4dcf4SKowalski, Kamil /** 165f4c4dcf4SKowalski, Kamil * @internal 166f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 167f4c4dcf4SKowalski, Kamil * 168f4c4dcf4SKowalski, Kamil * See header file for more information 169f4c4dcf4SKowalski, Kamil * @endinternal 170f4c4dcf4SKowalski, Kamil */ 171b5c07418SJames Feist nlohmann::json resourceInUse(void) 1721abe55efSEd Tanous { 173fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInUse, {}); 174b5c07418SJames Feist } 175b5c07418SJames Feist 176b5c07418SJames Feist void resourceInUse(crow::Response& res) 177b5c07418SJames Feist { 178b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 179b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 180f4c4dcf4SKowalski, Kamil } 181f4c4dcf4SKowalski, Kamil 182f4c4dcf4SKowalski, Kamil /** 183f4c4dcf4SKowalski, Kamil * @internal 184f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 185f4c4dcf4SKowalski, Kamil * 186f4c4dcf4SKowalski, Kamil * See header file for more information 187f4c4dcf4SKowalski, Kamil * @endinternal 188f4c4dcf4SKowalski, Kamil */ 189b5c07418SJames Feist nlohmann::json malformedJSON(void) 1901abe55efSEd Tanous { 191fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::malformedJSON, {}); 192b5c07418SJames Feist } 193b5c07418SJames Feist 194b5c07418SJames Feist void malformedJSON(crow::Response& res) 195b5c07418SJames Feist { 196b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 197b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 198f4c4dcf4SKowalski, Kamil } 199f4c4dcf4SKowalski, Kamil 200f4c4dcf4SKowalski, Kamil /** 201f4c4dcf4SKowalski, Kamil * @internal 202f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 203f4c4dcf4SKowalski, Kamil * 204f4c4dcf4SKowalski, Kamil * See header file for more information 205f4c4dcf4SKowalski, Kamil * @endinternal 206f4c4dcf4SKowalski, Kamil */ 207d9f466b3SEd Tanous nlohmann::json resourceMissingAtURI(boost::urls::url_view arg1) 2081abe55efSEd Tanous { 209079360aeSEd Tanous std::array<std::string_view, 1> args{arg1.buffer()}; 210fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 211b5c07418SJames Feist } 212b5c07418SJames Feist 213d9f466b3SEd Tanous void resourceMissingAtURI(crow::Response& res, boost::urls::url_view arg1) 214b5c07418SJames Feist { 215b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 216b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 217f4c4dcf4SKowalski, Kamil } 218f4c4dcf4SKowalski, Kamil 219f4c4dcf4SKowalski, Kamil /** 220f4c4dcf4SKowalski, Kamil * @internal 221f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 222f4c4dcf4SKowalski, Kamil * 223f4c4dcf4SKowalski, Kamil * See header file for more information 224f4c4dcf4SKowalski, Kamil * @endinternal 225f4c4dcf4SKowalski, Kamil */ 2261668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2271668ce6dSEd Tanous std::string_view arg2, 2281668ce6dSEd Tanous std::string_view arg3) 2291abe55efSEd Tanous { 230fffb8c1fSEd Tanous return getLog( 231fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2321668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 233b5c07418SJames Feist } 234b5c07418SJames Feist 2351668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2361668ce6dSEd Tanous std::string_view arg2, 2371668ce6dSEd Tanous std::string_view arg3) 238b5c07418SJames Feist { 239b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 240b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 241b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 242f4c4dcf4SKowalski, Kamil } 243f4c4dcf4SKowalski, Kamil 244f4c4dcf4SKowalski, Kamil /** 245f4c4dcf4SKowalski, Kamil * @internal 2464ef82a15SAlex Schendel * @brief Formats ActionParameterValueNotInList message into JSON 2474ef82a15SAlex Schendel * 2484ef82a15SAlex Schendel * See header file for more information 2494ef82a15SAlex Schendel * @endinternal 2504ef82a15SAlex Schendel */ 2514ef82a15SAlex Schendel nlohmann::json actionParameterValueNotInList(std::string_view arg1, 2524ef82a15SAlex Schendel std::string_view arg2, 2534ef82a15SAlex Schendel std::string_view arg3) 2544ef82a15SAlex Schendel { 2554ef82a15SAlex Schendel return getLog( 2564ef82a15SAlex Schendel redfish::registries::base::Index::actionParameterValueNotInList, 2574ef82a15SAlex Schendel std::to_array({arg1, arg2, arg3})); 2584ef82a15SAlex Schendel } 2594ef82a15SAlex Schendel 2604ef82a15SAlex Schendel void actionParameterValueNotInList(crow::Response& res, std::string_view arg1, 2614ef82a15SAlex Schendel std::string_view arg2, std::string_view arg3) 2624ef82a15SAlex Schendel { 2634ef82a15SAlex Schendel res.result(boost::beast::http::status::bad_request); 2644ef82a15SAlex Schendel addMessageToErrorJson(res.jsonValue, 2654ef82a15SAlex Schendel actionParameterValueNotInList(arg1, arg2, arg3)); 2664ef82a15SAlex Schendel } 2674ef82a15SAlex Schendel 2684ef82a15SAlex Schendel /** 2694ef82a15SAlex Schendel * @internal 270f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 271f4c4dcf4SKowalski, Kamil * 272f4c4dcf4SKowalski, Kamil * See header file for more information 273f4c4dcf4SKowalski, Kamil * @endinternal 274f4c4dcf4SKowalski, Kamil */ 275b5c07418SJames Feist nlohmann::json internalError(void) 2761abe55efSEd Tanous { 277fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 278b5c07418SJames Feist } 279b5c07418SJames Feist 280df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 281b5c07418SJames Feist { 282df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 283df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 284df5415fcSEd Tanous << location.function_name() << "`: "; 285b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 286b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 287f12894f8SJason M. Bills } 288f12894f8SJason M. Bills 289f12894f8SJason M. Bills /** 290f12894f8SJason M. Bills * @internal 291f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 292f4c4dcf4SKowalski, Kamil * 293f4c4dcf4SKowalski, Kamil * See header file for more information 294f4c4dcf4SKowalski, Kamil * @endinternal 295f4c4dcf4SKowalski, Kamil */ 296b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2971abe55efSEd Tanous { 298fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 299fffb8c1fSEd Tanous {}); 300b5c07418SJames Feist } 301b5c07418SJames Feist 302b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 303b5c07418SJames Feist { 304b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 305b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 306f4c4dcf4SKowalski, Kamil } 307f4c4dcf4SKowalski, Kamil 308f4c4dcf4SKowalski, Kamil /** 309f4c4dcf4SKowalski, Kamil * @internal 310f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 311f4c4dcf4SKowalski, Kamil * 312f4c4dcf4SKowalski, Kamil * See header file for more information 313f4c4dcf4SKowalski, Kamil * @endinternal 314f4c4dcf4SKowalski, Kamil */ 315d9f466b3SEd Tanous nlohmann::json resourceAtUriUnauthorized(boost::urls::url_view arg1, 3161668ce6dSEd Tanous std::string_view arg2) 3171abe55efSEd Tanous { 318079360aeSEd Tanous return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, 319079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 320b5c07418SJames Feist } 321b5c07418SJames Feist 322d9f466b3SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, boost::urls::url_view arg1, 3231668ce6dSEd Tanous std::string_view arg2) 324b5c07418SJames Feist { 325b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 326b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 327f4c4dcf4SKowalski, Kamil } 328f4c4dcf4SKowalski, Kamil 329f4c4dcf4SKowalski, Kamil /** 330f4c4dcf4SKowalski, Kamil * @internal 331f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 332f4c4dcf4SKowalski, Kamil * 333f4c4dcf4SKowalski, Kamil * See header file for more information 334f4c4dcf4SKowalski, Kamil * @endinternal 335f4c4dcf4SKowalski, Kamil */ 3361668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 3371668ce6dSEd Tanous std::string_view arg2) 338b5c07418SJames Feist { 339fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 3401668ce6dSEd Tanous std::to_array({arg1, arg2})); 341b5c07418SJames Feist } 342b5c07418SJames Feist 3431668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3441668ce6dSEd Tanous std::string_view arg2) 3451abe55efSEd Tanous { 346f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 347b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 348f4c4dcf4SKowalski, Kamil } 349f4c4dcf4SKowalski, Kamil 350f4c4dcf4SKowalski, Kamil /** 351f4c4dcf4SKowalski, Kamil * @internal 352f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 353f4c4dcf4SKowalski, Kamil * 354f4c4dcf4SKowalski, Kamil * See header file for more information 355f4c4dcf4SKowalski, Kamil * @endinternal 356f4c4dcf4SKowalski, Kamil */ 357b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3581abe55efSEd Tanous { 359fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 360fffb8c1fSEd Tanous {}); 361b5c07418SJames Feist } 362b5c07418SJames Feist 363b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 364b5c07418SJames Feist { 36544c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 366b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 367f4c4dcf4SKowalski, Kamil } 368f4c4dcf4SKowalski, Kamil 369f4c4dcf4SKowalski, Kamil /** 370f4c4dcf4SKowalski, Kamil * @internal 371f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 372f4c4dcf4SKowalski, Kamil * 373f4c4dcf4SKowalski, Kamil * See header file for more information 374f4c4dcf4SKowalski, Kamil * @endinternal 375f4c4dcf4SKowalski, Kamil */ 3761668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3771abe55efSEd Tanous { 378fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3791668ce6dSEd Tanous std::to_array({arg1})); 380b5c07418SJames Feist } 381b5c07418SJames Feist 3821668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 383b5c07418SJames Feist { 384b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 385b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 386f4c4dcf4SKowalski, Kamil } 387f4c4dcf4SKowalski, Kamil 388f4c4dcf4SKowalski, Kamil /** 389f4c4dcf4SKowalski, Kamil * @internal 390f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 391f4c4dcf4SKowalski, Kamil * 392f4c4dcf4SKowalski, Kamil * See header file for more information 393f4c4dcf4SKowalski, Kamil * @endinternal 394f4c4dcf4SKowalski, Kamil */ 3951668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3961abe55efSEd Tanous { 397b6cd31e1SEd Tanous return getLog( 398fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3991668ce6dSEd Tanous std::to_array({arg1})); 400b5c07418SJames Feist } 401b5c07418SJames Feist 4021668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 403b5c07418SJames Feist { 404d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 405b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 406b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 407f4c4dcf4SKowalski, Kamil } 408f4c4dcf4SKowalski, Kamil 409f4c4dcf4SKowalski, Kamil /** 410f4c4dcf4SKowalski, Kamil * @internal 411f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 412f4c4dcf4SKowalski, Kamil * 413f4c4dcf4SKowalski, Kamil * See header file for more information 414f4c4dcf4SKowalski, Kamil * @endinternal 415f4c4dcf4SKowalski, Kamil */ 4161668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 4171668ce6dSEd Tanous std::string_view arg2, 4181668ce6dSEd Tanous std::string_view arg3) 4191abe55efSEd Tanous { 420fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 4211668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 422b5c07418SJames Feist } 423b5c07418SJames Feist 4241668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 4251668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 426b5c07418SJames Feist { 427b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 428b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 429a08b46ccSJason M. Bills arg2); 430f4c4dcf4SKowalski, Kamil } 431f4c4dcf4SKowalski, Kamil 432f4c4dcf4SKowalski, Kamil /** 433f4c4dcf4SKowalski, Kamil * @internal 434f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 435f4c4dcf4SKowalski, Kamil * 436f4c4dcf4SKowalski, Kamil * See header file for more information 437f4c4dcf4SKowalski, Kamil * @endinternal 438f4c4dcf4SKowalski, Kamil */ 439b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4401abe55efSEd Tanous { 441fffb8c1fSEd Tanous return getLog( 442fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 443b5c07418SJames Feist } 444b5c07418SJames Feist 445b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 446b5c07418SJames Feist { 447b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 448b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 449f4c4dcf4SKowalski, Kamil } 450f4c4dcf4SKowalski, Kamil 451f4c4dcf4SKowalski, Kamil /** 452f4c4dcf4SKowalski, Kamil * @internal 453f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 454f4c4dcf4SKowalski, Kamil * 455f4c4dcf4SKowalski, Kamil * See header file for more information 456f4c4dcf4SKowalski, Kamil * @endinternal 457f4c4dcf4SKowalski, Kamil */ 4581668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4591abe55efSEd Tanous { 460fffb8c1fSEd Tanous return getLog( 461fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4621668ce6dSEd Tanous std::to_array({arg1})); 463b5c07418SJames Feist } 464b5c07418SJames Feist 465b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4661668ce6dSEd Tanous std::string_view arg1) 467b5c07418SJames Feist { 468b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 469b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 470a08b46ccSJason M. Bills arg1); 471f12894f8SJason M. Bills } 472f12894f8SJason M. Bills 473f12894f8SJason M. Bills /** 474f12894f8SJason M. Bills * @internal 475f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 476f12894f8SJason M. Bills * property 477f12894f8SJason M. Bills * 478f12894f8SJason M. Bills * See header file for more information 479f12894f8SJason M. Bills * @endinternal 480f12894f8SJason M. Bills */ 4811668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4821668ce6dSEd Tanous std::string_view arg2) 483f12894f8SJason M. Bills { 484fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4851668ce6dSEd Tanous std::to_array({arg1, arg2})); 486b5c07418SJames Feist } 487b5c07418SJames Feist 4881668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4891668ce6dSEd Tanous std::string_view arg2) 490b5c07418SJames Feist { 491b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 492b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 493f12894f8SJason M. Bills } 494f12894f8SJason M. Bills 495f12894f8SJason M. Bills /** 496f12894f8SJason M. Bills * @internal 497f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 498f12894f8SJason M. Bills * property 499f12894f8SJason M. Bills * 500f12894f8SJason M. Bills * See header file for more information 501f12894f8SJason M. Bills * @endinternal 502f12894f8SJason M. Bills */ 503*e2616cc5SEd Tanous 504*e2616cc5SEd Tanous nlohmann::json propertyValueNotInList(const nlohmann::json& arg1, 5051668ce6dSEd Tanous std::string_view arg2) 506f12894f8SJason M. Bills { 507*e2616cc5SEd Tanous std::string arg1Str = arg1.dump(-1, ' ', true, 508*e2616cc5SEd Tanous nlohmann::json::error_handler_t::replace); 509fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 510*e2616cc5SEd Tanous std::to_array<std::string_view>({arg1Str, arg2})); 511b5c07418SJames Feist } 512b5c07418SJames Feist 513*e2616cc5SEd Tanous void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1, 5141668ce6dSEd Tanous std::string_view arg2) 515b5c07418SJames Feist { 516b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 517b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 518f4c4dcf4SKowalski, Kamil } 519f4c4dcf4SKowalski, Kamil 520f4c4dcf4SKowalski, Kamil /** 521f4c4dcf4SKowalski, Kamil * @internal 522227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 523227a2b0aSJiaqing Zhao * 524227a2b0aSJiaqing Zhao * See header file for more information 525227a2b0aSJiaqing Zhao * @endinternal 526227a2b0aSJiaqing Zhao */ 527227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 528227a2b0aSJiaqing Zhao std::string_view arg2) 529227a2b0aSJiaqing Zhao { 530227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 531227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 532227a2b0aSJiaqing Zhao } 533227a2b0aSJiaqing Zhao 534227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 535227a2b0aSJiaqing Zhao std::string_view arg2) 536227a2b0aSJiaqing Zhao { 537227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 538227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 539227a2b0aSJiaqing Zhao } 540227a2b0aSJiaqing Zhao 541227a2b0aSJiaqing Zhao /** 542227a2b0aSJiaqing Zhao * @internal 543f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 544f4c4dcf4SKowalski, Kamil * 545f4c4dcf4SKowalski, Kamil * See header file for more information 546f4c4dcf4SKowalski, Kamil * @endinternal 547f4c4dcf4SKowalski, Kamil */ 548d9f466b3SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(boost::urls::url_view arg1) 5491abe55efSEd Tanous { 550b6cd31e1SEd Tanous return getLog( 551fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 552079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 553b5c07418SJames Feist } 554b5c07418SJames Feist 555ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 556d9f466b3SEd Tanous boost::urls::url_view arg1) 557b5c07418SJames Feist { 558b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 559b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 560f4c4dcf4SKowalski, Kamil } 561f4c4dcf4SKowalski, Kamil 562f4c4dcf4SKowalski, Kamil /** 563f4c4dcf4SKowalski, Kamil * @internal 56481856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 56581856681SAsmitha Karunanithi * 56681856681SAsmitha Karunanithi * See header file for more information 56781856681SAsmitha Karunanithi * @endinternal 56881856681SAsmitha Karunanithi */ 5691668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 57081856681SAsmitha Karunanithi { 571fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5721668ce6dSEd Tanous std::to_array({arg1})); 57381856681SAsmitha Karunanithi } 57481856681SAsmitha Karunanithi 5751668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 57681856681SAsmitha Karunanithi { 57781856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 57881856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 57981856681SAsmitha Karunanithi } 58081856681SAsmitha Karunanithi 58181856681SAsmitha Karunanithi /** 58281856681SAsmitha Karunanithi * @internal 583f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 584f4c4dcf4SKowalski, Kamil * 585f4c4dcf4SKowalski, Kamil * See header file for more information 586f4c4dcf4SKowalski, Kamil * @endinternal 587f4c4dcf4SKowalski, Kamil */ 588b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5891abe55efSEd Tanous { 590fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 591b5c07418SJames Feist } 592b5c07418SJames Feist 593b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 594b5c07418SJames Feist { 595b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 596b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 597f4c4dcf4SKowalski, Kamil } 598f4c4dcf4SKowalski, Kamil 599f4c4dcf4SKowalski, Kamil /** 600f4c4dcf4SKowalski, Kamil * @internal 601f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 602f4c4dcf4SKowalski, Kamil * 603f4c4dcf4SKowalski, Kamil * See header file for more information 604f4c4dcf4SKowalski, Kamil * @endinternal 605f4c4dcf4SKowalski, Kamil */ 606b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 6071abe55efSEd Tanous { 608fffb8c1fSEd Tanous return getLog( 609fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 610b5c07418SJames Feist } 611b5c07418SJames Feist 612b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 613b5c07418SJames Feist { 614789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 615b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 616f4c4dcf4SKowalski, Kamil } 617f4c4dcf4SKowalski, Kamil 618f4c4dcf4SKowalski, Kamil /** 619f4c4dcf4SKowalski, Kamil * @internal 620f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 621f4c4dcf4SKowalski, Kamil * 622f4c4dcf4SKowalski, Kamil * See header file for more information 623f4c4dcf4SKowalski, Kamil * @endinternal 624f4c4dcf4SKowalski, Kamil */ 6251668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 6261668ce6dSEd Tanous std::string_view arg2) 6271abe55efSEd Tanous { 628fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 6291668ce6dSEd Tanous std::to_array({arg1, arg2})); 630b5c07418SJames Feist } 631b5c07418SJames Feist 6321668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 6331668ce6dSEd Tanous std::string_view arg2) 634b5c07418SJames Feist { 635b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 636b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 637f4c4dcf4SKowalski, Kamil } 638f4c4dcf4SKowalski, Kamil 639f4c4dcf4SKowalski, Kamil /** 640f4c4dcf4SKowalski, Kamil * @internal 641f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 642f4c4dcf4SKowalski, Kamil * 643f4c4dcf4SKowalski, Kamil * See header file for more information 644f4c4dcf4SKowalski, Kamil * @endinternal 645f4c4dcf4SKowalski, Kamil */ 6461668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 6471abe55efSEd Tanous { 648b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 649fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 6501668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 651b5c07418SJames Feist } 652b5c07418SJames Feist 6531668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 654b5c07418SJames Feist { 655b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 656b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 657f4c4dcf4SKowalski, Kamil } 658f4c4dcf4SKowalski, Kamil 659f4c4dcf4SKowalski, Kamil /** 660f4c4dcf4SKowalski, Kamil * @internal 661cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 662cc9139ecSJason M. Bills * 663cc9139ecSJason M. Bills * See header file for more information 664cc9139ecSJason M. Bills * @endinternal 665cc9139ecSJason M. Bills */ 666b5c07418SJames Feist nlohmann::json sessionTerminated(void) 667cc9139ecSJason M. Bills { 668fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 669b5c07418SJames Feist } 670b5c07418SJames Feist 671b5c07418SJames Feist void sessionTerminated(crow::Response& res) 672b5c07418SJames Feist { 673b5c07418SJames Feist res.result(boost::beast::http::status::ok); 674b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 675cc9139ecSJason M. Bills } 676cc9139ecSJason M. Bills 677cc9139ecSJason M. Bills /** 678cc9139ecSJason M. Bills * @internal 679684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 680684bb4b8SJason M. Bills * 681684bb4b8SJason M. Bills * See header file for more information 682684bb4b8SJason M. Bills * @endinternal 683684bb4b8SJason M. Bills */ 684684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 685684bb4b8SJason M. Bills { 686fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 687684bb4b8SJason M. Bills } 688684bb4b8SJason M. Bills 689684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 690684bb4b8SJason M. Bills { 691684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 692684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 693684bb4b8SJason M. Bills } 694684bb4b8SJason M. Bills 695684bb4b8SJason M. Bills /** 696684bb4b8SJason M. Bills * @internal 697cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 698cc9139ecSJason M. Bills * 699cc9139ecSJason M. Bills * See header file for more information 700cc9139ecSJason M. Bills * @endinternal 701cc9139ecSJason M. Bills */ 7021668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 7031668ce6dSEd Tanous std::string_view arg2) 704cc9139ecSJason M. Bills { 705fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 7061668ce6dSEd Tanous std::to_array({arg1, arg2})); 707b5c07418SJames Feist } 708b5c07418SJames Feist 7091668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 7101668ce6dSEd Tanous std::string_view arg2) 711b5c07418SJames Feist { 712b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 713b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 714cc9139ecSJason M. Bills } 715cc9139ecSJason M. Bills 716cc9139ecSJason M. Bills /** 717cc9139ecSJason M. Bills * @internal 718684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 719684bb4b8SJason M. Bills * 720684bb4b8SJason M. Bills * See header file for more information 721684bb4b8SJason M. Bills * @endinternal 722684bb4b8SJason M. Bills */ 723d9f466b3SEd Tanous nlohmann::json resetRequired(boost::urls::url_view arg1, std::string_view arg2) 724684bb4b8SJason M. Bills { 725fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 726079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 727684bb4b8SJason M. Bills } 728684bb4b8SJason M. Bills 729d9f466b3SEd Tanous void resetRequired(crow::Response& res, boost::urls::url_view arg1, 7301668ce6dSEd Tanous std::string_view arg2) 731684bb4b8SJason M. Bills { 732684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 733684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 734684bb4b8SJason M. Bills } 735684bb4b8SJason M. Bills 736684bb4b8SJason M. Bills /** 737684bb4b8SJason M. Bills * @internal 738684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 739684bb4b8SJason M. Bills * 740684bb4b8SJason M. Bills * See header file for more information 741684bb4b8SJason M. Bills * @endinternal 742684bb4b8SJason M. Bills */ 7431668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 744684bb4b8SJason M. Bills { 745fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7461668ce6dSEd Tanous std::to_array({arg1})); 747684bb4b8SJason M. Bills } 748684bb4b8SJason M. Bills 7491668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 750684bb4b8SJason M. Bills { 751684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 752684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 753684bb4b8SJason M. Bills } 754684bb4b8SJason M. Bills 755684bb4b8SJason M. Bills /** 756684bb4b8SJason M. Bills * @internal 757684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 758684bb4b8SJason M. Bills * 759684bb4b8SJason M. Bills * See header file for more information 760684bb4b8SJason M. Bills * @endinternal 761684bb4b8SJason M. Bills */ 7621668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 763684bb4b8SJason M. Bills { 764b6cd31e1SEd Tanous return getLog( 765fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7661668ce6dSEd Tanous std::to_array({arg1})); 767684bb4b8SJason M. Bills } 768684bb4b8SJason M. Bills 7691668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 770684bb4b8SJason M. Bills { 771684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 772684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 773684bb4b8SJason M. Bills } 774684bb4b8SJason M. Bills 775684bb4b8SJason M. Bills /** 776684bb4b8SJason M. Bills * @internal 777684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 778684bb4b8SJason M. Bills * 779684bb4b8SJason M. Bills * See header file for more information 780684bb4b8SJason M. Bills * @endinternal 781684bb4b8SJason M. Bills */ 7821668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7831668ce6dSEd Tanous std::string_view arg2) 784684bb4b8SJason M. Bills { 785fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7861668ce6dSEd Tanous std::to_array({arg1, arg2})); 787684bb4b8SJason M. Bills } 788684bb4b8SJason M. Bills 7891668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7901668ce6dSEd Tanous std::string_view arg2) 791684bb4b8SJason M. Bills { 792684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 793684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 794684bb4b8SJason M. Bills } 795684bb4b8SJason M. Bills 796684bb4b8SJason M. Bills /** 797684bb4b8SJason M. Bills * @internal 7982a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7992a6af81cSRamesh Iyyar * 8002a6af81cSRamesh Iyyar * See header file for more information 8012a6af81cSRamesh Iyyar * @endinternal 8022a6af81cSRamesh Iyyar */ 8032a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 8042a6af81cSRamesh Iyyar std::string_view arg2, 805d9f466b3SEd Tanous boost::urls::url_view arg3) 8062a6af81cSRamesh Iyyar { 8072a6af81cSRamesh Iyyar return getLog( 8082a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 809079360aeSEd Tanous std::to_array<std::string_view>({arg1, arg2, arg3.buffer()})); 8102a6af81cSRamesh Iyyar } 8112a6af81cSRamesh Iyyar 8122a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 8132a6af81cSRamesh Iyyar std::string_view arg2, 814d9f466b3SEd Tanous boost::urls::url_view arg3) 8152a6af81cSRamesh Iyyar { 8162a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 8172a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 8182a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 8192a6af81cSRamesh Iyyar } 8202a6af81cSRamesh Iyyar 8212a6af81cSRamesh Iyyar /** 8222a6af81cSRamesh Iyyar * @internal 82324861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 82424861a28SRamesh Iyyar * 82524861a28SRamesh Iyyar * See header file for more information 82624861a28SRamesh Iyyar * @endinternal 82724861a28SRamesh Iyyar */ 82824861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 82924861a28SRamesh Iyyar std::string_view arg2) 83024861a28SRamesh Iyyar { 83124861a28SRamesh Iyyar return getLog( 83224861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 83324861a28SRamesh Iyyar std::to_array({arg1, arg2})); 83424861a28SRamesh Iyyar } 83524861a28SRamesh Iyyar 83624861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 83724861a28SRamesh Iyyar std::string_view arg2) 83824861a28SRamesh Iyyar { 83924861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 84024861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 84124861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 84224861a28SRamesh Iyyar } 84324861a28SRamesh Iyyar 84424861a28SRamesh Iyyar /** 84524861a28SRamesh Iyyar * @internal 846684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 847684bb4b8SJason M. Bills * 848684bb4b8SJason M. Bills * See header file for more information 849684bb4b8SJason M. Bills * @endinternal 850684bb4b8SJason M. Bills */ 8511668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8521668ce6dSEd Tanous std::string_view arg2) 853684bb4b8SJason M. Bills { 854fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8551668ce6dSEd Tanous std::to_array({arg1, arg2})); 856684bb4b8SJason M. Bills } 857684bb4b8SJason M. Bills 8581668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8591668ce6dSEd Tanous std::string_view arg2) 860684bb4b8SJason M. Bills { 861684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 862684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 863684bb4b8SJason M. Bills } 864684bb4b8SJason M. Bills 865684bb4b8SJason M. Bills /** 866684bb4b8SJason M. Bills * @internal 867684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 868684bb4b8SJason M. Bills * 869684bb4b8SJason M. Bills * See header file for more information 870684bb4b8SJason M. Bills * @endinternal 871684bb4b8SJason M. Bills */ 872d9f466b3SEd Tanous nlohmann::json resourceCreationConflict(boost::urls::url_view arg1) 873684bb4b8SJason M. Bills { 874fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 875079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 876684bb4b8SJason M. Bills } 877684bb4b8SJason M. Bills 878d9f466b3SEd Tanous void resourceCreationConflict(crow::Response& res, boost::urls::url_view arg1) 879684bb4b8SJason M. Bills { 880684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 881684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 882684bb4b8SJason M. Bills } 883684bb4b8SJason M. Bills 884684bb4b8SJason M. Bills /** 885684bb4b8SJason M. Bills * @internal 886684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 887684bb4b8SJason M. Bills * 888684bb4b8SJason M. Bills * See header file for more information 889684bb4b8SJason M. Bills * @endinternal 890684bb4b8SJason M. Bills */ 891684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 892684bb4b8SJason M. Bills { 893fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 894684bb4b8SJason M. Bills } 895684bb4b8SJason M. Bills 896684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 897684bb4b8SJason M. Bills { 898684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 899684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 900684bb4b8SJason M. Bills } 901684bb4b8SJason M. Bills 902684bb4b8SJason M. Bills /** 903684bb4b8SJason M. Bills * @internal 904684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 905684bb4b8SJason M. Bills * 906684bb4b8SJason M. Bills * See header file for more information 907684bb4b8SJason M. Bills * @endinternal 908684bb4b8SJason M. Bills */ 909684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 910684bb4b8SJason M. Bills { 911fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 912684bb4b8SJason M. Bills } 913684bb4b8SJason M. Bills 914684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 915684bb4b8SJason M. Bills { 9164df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 917684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 918684bb4b8SJason M. Bills } 919684bb4b8SJason M. Bills 920684bb4b8SJason M. Bills /** 921684bb4b8SJason M. Bills * @internal 922684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 923684bb4b8SJason M. Bills * 924684bb4b8SJason M. Bills * See header file for more information 925684bb4b8SJason M. Bills * @endinternal 926684bb4b8SJason M. Bills */ 927684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 928684bb4b8SJason M. Bills { 929fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 930684bb4b8SJason M. Bills } 931684bb4b8SJason M. Bills 932684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 933684bb4b8SJason M. Bills { 934684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 935684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 936684bb4b8SJason M. Bills } 937684bb4b8SJason M. Bills 938684bb4b8SJason M. Bills /** 939684bb4b8SJason M. Bills * @internal 940684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 941684bb4b8SJason M. Bills * 942684bb4b8SJason M. Bills * See header file for more information 943684bb4b8SJason M. Bills * @endinternal 944684bb4b8SJason M. Bills */ 945684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 946684bb4b8SJason M. Bills { 947fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 948684bb4b8SJason M. Bills } 949684bb4b8SJason M. Bills 950684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 951684bb4b8SJason M. Bills { 9528868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 953684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 954684bb4b8SJason M. Bills } 955684bb4b8SJason M. Bills 956684bb4b8SJason M. Bills /** 957684bb4b8SJason M. Bills * @internal 958684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 959684bb4b8SJason M. Bills * 960684bb4b8SJason M. Bills * See header file for more information 961684bb4b8SJason M. Bills * @endinternal 962684bb4b8SJason M. Bills */ 963684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 964684bb4b8SJason M. Bills { 965fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 966684bb4b8SJason M. Bills } 967684bb4b8SJason M. Bills 968684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 969684bb4b8SJason M. Bills { 970684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 971684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 972684bb4b8SJason M. Bills } 973684bb4b8SJason M. Bills 974684bb4b8SJason M. Bills /** 975684bb4b8SJason M. Bills * @internal 976f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 977f12894f8SJason M. Bills * property 978f12894f8SJason M. Bills * 979f12894f8SJason M. Bills * See header file for more information 980f12894f8SJason M. Bills * @endinternal 981f12894f8SJason M. Bills */ 9821668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 9831668ce6dSEd Tanous std::string_view arg2) 984f12894f8SJason M. Bills { 985fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9861668ce6dSEd Tanous std::to_array({arg1, arg2})); 987b5c07418SJames Feist } 988b5c07418SJames Feist 9891668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9901668ce6dSEd Tanous std::string_view arg2) 991b5c07418SJames Feist { 992b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 993b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 994f4c4dcf4SKowalski, Kamil } 995f4c4dcf4SKowalski, Kamil 996f4c4dcf4SKowalski, Kamil /** 997f4c4dcf4SKowalski, Kamil * @internal 998b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 999f4c4dcf4SKowalski, Kamil * 1000f4c4dcf4SKowalski, Kamil * See header file for more information 1001f4c4dcf4SKowalski, Kamil * @endinternal 1002f4c4dcf4SKowalski, Kamil */ 10031668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 10041abe55efSEd Tanous { 1005fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 10061668ce6dSEd Tanous std::to_array({arg1, arg2})); 1007b5c07418SJames Feist } 1008b5c07418SJames Feist 10091668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 10101668ce6dSEd Tanous std::string_view arg2) 1011b5c07418SJames Feist { 1012b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1013b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1014f4c4dcf4SKowalski, Kamil } 1015f4c4dcf4SKowalski, Kamil 1016f4c4dcf4SKowalski, Kamil /** 1017f4c4dcf4SKowalski, Kamil * @internal 1018f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1019f4c4dcf4SKowalski, Kamil * 1020f4c4dcf4SKowalski, Kamil * See header file for more information 1021f4c4dcf4SKowalski, Kamil * @endinternal 1022f4c4dcf4SKowalski, Kamil */ 1023d9f466b3SEd Tanous nlohmann::json couldNotEstablishConnection(boost::urls::url_view arg1) 10241abe55efSEd Tanous { 1025fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 1026079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1027b5c07418SJames Feist } 1028b5c07418SJames Feist 1029ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1030d9f466b3SEd Tanous boost::urls::url_view arg1) 1031b5c07418SJames Feist { 1032b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1033b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1034f4c4dcf4SKowalski, Kamil } 1035f4c4dcf4SKowalski, Kamil 1036f4c4dcf4SKowalski, Kamil /** 1037f4c4dcf4SKowalski, Kamil * @internal 1038f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1039f12894f8SJason M. Bills * property 1040f12894f8SJason M. Bills * 1041f12894f8SJason M. Bills * See header file for more information 1042f12894f8SJason M. Bills * @endinternal 1043f12894f8SJason M. Bills */ 10441668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 1045f12894f8SJason M. Bills { 1046fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 10471668ce6dSEd Tanous std::to_array({arg1})); 1048b5c07418SJames Feist } 1049b5c07418SJames Feist 10501668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1051b5c07418SJames Feist { 1052b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1053b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1054f4c4dcf4SKowalski, Kamil } 1055f4c4dcf4SKowalski, Kamil 1056f4c4dcf4SKowalski, Kamil /** 1057f4c4dcf4SKowalski, Kamil * @internal 1058f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1059f4c4dcf4SKowalski, Kamil * 1060f4c4dcf4SKowalski, Kamil * See header file for more information 1061f4c4dcf4SKowalski, Kamil * @endinternal 1062f4c4dcf4SKowalski, Kamil */ 10631668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10641668ce6dSEd Tanous std::string_view arg2) 10651abe55efSEd Tanous { 1066b6cd31e1SEd Tanous return getLog( 1067fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10681668ce6dSEd Tanous std::to_array({arg1, arg2})); 1069b5c07418SJames Feist } 1070b5c07418SJames Feist 10711668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10721668ce6dSEd Tanous std::string_view arg2) 1073b5c07418SJames Feist { 1074b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1075b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1076b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1077f4c4dcf4SKowalski, Kamil } 1078f4c4dcf4SKowalski, Kamil 1079f4c4dcf4SKowalski, Kamil /** 1080f4c4dcf4SKowalski, Kamil * @internal 1081f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1082f4c4dcf4SKowalski, Kamil * 1083f4c4dcf4SKowalski, Kamil * See header file for more information 1084f4c4dcf4SKowalski, Kamil * @endinternal 1085f4c4dcf4SKowalski, Kamil */ 1086b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10871abe55efSEd Tanous { 1088fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1089b5c07418SJames Feist } 1090b5c07418SJames Feist 1091b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1092b5c07418SJames Feist { 1093b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1094b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1095f4c4dcf4SKowalski, Kamil } 1096f4c4dcf4SKowalski, Kamil 1097f4c4dcf4SKowalski, Kamil /** 1098f4c4dcf4SKowalski, Kamil * @internal 1099f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1100f4c4dcf4SKowalski, Kamil * 1101f4c4dcf4SKowalski, Kamil * See header file for more information 1102f4c4dcf4SKowalski, Kamil * @endinternal 1103f4c4dcf4SKowalski, Kamil */ 11041668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 11051668ce6dSEd Tanous std::string_view arg2) 11061abe55efSEd Tanous { 1107fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 11081668ce6dSEd Tanous std::to_array({arg1, arg2})); 1109b5c07418SJames Feist } 1110b5c07418SJames Feist 11111668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 11121668ce6dSEd Tanous std::string_view arg2) 1113b5c07418SJames Feist { 1114b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1115b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1116f4c4dcf4SKowalski, Kamil } 1117f4c4dcf4SKowalski, Kamil 1118f4c4dcf4SKowalski, Kamil /** 1119f4c4dcf4SKowalski, Kamil * @internal 1120f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1121f4c4dcf4SKowalski, Kamil * 1122f4c4dcf4SKowalski, Kamil * See header file for more information 1123f4c4dcf4SKowalski, Kamil * @endinternal 1124f4c4dcf4SKowalski, Kamil */ 11251668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 11261668ce6dSEd Tanous std::string_view arg2) 11271abe55efSEd Tanous { 1128fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 11291668ce6dSEd Tanous std::to_array({arg1, arg2})); 1130b5c07418SJames Feist } 1131b5c07418SJames Feist 11321668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 11331668ce6dSEd Tanous std::string_view arg2) 1134b5c07418SJames Feist { 1135b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1136b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1137b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1138f4c4dcf4SKowalski, Kamil } 1139f4c4dcf4SKowalski, Kamil 1140f4c4dcf4SKowalski, Kamil /** 1141f4c4dcf4SKowalski, Kamil * @internal 1142f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1143f4c4dcf4SKowalski, Kamil * 1144f4c4dcf4SKowalski, Kamil * See header file for more information 1145f4c4dcf4SKowalski, Kamil * @endinternal 1146f4c4dcf4SKowalski, Kamil */ 1147d9f466b3SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(boost::urls::url_view arg1, 11481668ce6dSEd Tanous std::string_view arg2) 11491abe55efSEd Tanous { 1150b6cd31e1SEd Tanous return getLog( 1151fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 1152079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1153b5c07418SJames Feist } 1154b5c07418SJames Feist 1155ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1156d9f466b3SEd Tanous boost::urls::url_view arg1, 11571668ce6dSEd Tanous std::string_view arg2) 1158b5c07418SJames Feist { 1159b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1160b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1161b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1162f4c4dcf4SKowalski, Kamil } 1163f4c4dcf4SKowalski, Kamil 1164f4c4dcf4SKowalski, Kamil /** 1165f4c4dcf4SKowalski, Kamil * @internal 1166b4ad4c05SShantappa Teekappanavar * @brief Formats StrictAccountTypes message into JSON 1167b4ad4c05SShantappa Teekappanavar * 1168b4ad4c05SShantappa Teekappanavar * See header file for more information 1169b4ad4c05SShantappa Teekappanavar * @endinternal 1170b4ad4c05SShantappa Teekappanavar */ 1171b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1) 1172b4ad4c05SShantappa Teekappanavar { 1173b4ad4c05SShantappa Teekappanavar return getLog(redfish::registries::base::Index::strictAccountTypes, 1174b4ad4c05SShantappa Teekappanavar std::to_array({arg1})); 1175b4ad4c05SShantappa Teekappanavar } 1176b4ad4c05SShantappa Teekappanavar 1177b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1) 1178b4ad4c05SShantappa Teekappanavar { 1179b4ad4c05SShantappa Teekappanavar res.result(boost::beast::http::status::bad_request); 1180b4ad4c05SShantappa Teekappanavar addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 1181b4ad4c05SShantappa Teekappanavar } 1182b4ad4c05SShantappa Teekappanavar 1183b4ad4c05SShantappa Teekappanavar /** 1184b4ad4c05SShantappa Teekappanavar * @internal 1185f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1186f4c4dcf4SKowalski, Kamil * 1187f4c4dcf4SKowalski, Kamil * See header file for more information 1188f4c4dcf4SKowalski, Kamil * @endinternal 1189f4c4dcf4SKowalski, Kamil */ 1190b5c07418SJames Feist nlohmann::json accountRemoved(void) 11911abe55efSEd Tanous { 1192fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1193b5c07418SJames Feist } 1194b5c07418SJames Feist 1195b5c07418SJames Feist void accountRemoved(crow::Response& res) 1196b5c07418SJames Feist { 1197b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1198b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1199f4c4dcf4SKowalski, Kamil } 1200f4c4dcf4SKowalski, Kamil 1201f4c4dcf4SKowalski, Kamil /** 1202f4c4dcf4SKowalski, Kamil * @internal 1203f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1204f4c4dcf4SKowalski, Kamil * 1205f4c4dcf4SKowalski, Kamil * See header file for more information 1206f4c4dcf4SKowalski, Kamil * @endinternal 1207f4c4dcf4SKowalski, Kamil */ 1208d9f466b3SEd Tanous nlohmann::json accessDenied(boost::urls::url_view arg1) 12091abe55efSEd Tanous { 1210fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 1211079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1212b5c07418SJames Feist } 1213b5c07418SJames Feist 1214d9f466b3SEd Tanous void accessDenied(crow::Response& res, boost::urls::url_view arg1) 1215b5c07418SJames Feist { 1216b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1217b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1218f4c4dcf4SKowalski, Kamil } 1219f4c4dcf4SKowalski, Kamil 1220f4c4dcf4SKowalski, Kamil /** 1221f4c4dcf4SKowalski, Kamil * @internal 1222f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1223f4c4dcf4SKowalski, Kamil * 1224f4c4dcf4SKowalski, Kamil * See header file for more information 1225f4c4dcf4SKowalski, Kamil * @endinternal 1226f4c4dcf4SKowalski, Kamil */ 1227b5c07418SJames Feist nlohmann::json queryNotSupported(void) 12281abe55efSEd Tanous { 1229fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1230b5c07418SJames Feist } 1231b5c07418SJames Feist 1232b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1233b5c07418SJames Feist { 1234b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1235b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1236f4c4dcf4SKowalski, Kamil } 1237f4c4dcf4SKowalski, Kamil 1238f4c4dcf4SKowalski, Kamil /** 1239f4c4dcf4SKowalski, Kamil * @internal 1240f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1241f4c4dcf4SKowalski, Kamil * 1242f4c4dcf4SKowalski, Kamil * See header file for more information 1243f4c4dcf4SKowalski, Kamil * @endinternal 1244f4c4dcf4SKowalski, Kamil */ 1245b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 12461abe55efSEd Tanous { 1247b6cd31e1SEd Tanous return getLog( 1248fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1249b5c07418SJames Feist } 1250b5c07418SJames Feist 1251b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1252b5c07418SJames Feist { 1253b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1254b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1255f4c4dcf4SKowalski, Kamil } 1256f4c4dcf4SKowalski, Kamil 1257f4c4dcf4SKowalski, Kamil /** 1258f4c4dcf4SKowalski, Kamil * @internal 1259f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1260f4c4dcf4SKowalski, Kamil * 1261f4c4dcf4SKowalski, Kamil * See header file for more information 1262f4c4dcf4SKowalski, Kamil * @endinternal 1263f4c4dcf4SKowalski, Kamil */ 1264b5c07418SJames Feist nlohmann::json generalError(void) 12651abe55efSEd Tanous { 1266fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1267b5c07418SJames Feist } 1268b5c07418SJames Feist 1269b5c07418SJames Feist void generalError(crow::Response& res) 1270b5c07418SJames Feist { 1271b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1272b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1273f4c4dcf4SKowalski, Kamil } 1274f4c4dcf4SKowalski, Kamil 1275f4c4dcf4SKowalski, Kamil /** 1276f4c4dcf4SKowalski, Kamil * @internal 1277f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1278f4c4dcf4SKowalski, Kamil * 1279f4c4dcf4SKowalski, Kamil * See header file for more information 1280f4c4dcf4SKowalski, Kamil * @endinternal 1281f4c4dcf4SKowalski, Kamil */ 1282b5c07418SJames Feist nlohmann::json success(void) 12831abe55efSEd Tanous { 1284fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1285b5c07418SJames Feist } 1286b5c07418SJames Feist 1287b5c07418SJames Feist void success(crow::Response& res) 1288b5c07418SJames Feist { 1289b5c07418SJames Feist // don't set res.result here because success is the default and any 1290b5c07418SJames Feist // error should overwrite the default 1291b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1292f12894f8SJason M. Bills } 1293f12894f8SJason M. Bills 1294f12894f8SJason M. Bills /** 1295f12894f8SJason M. Bills * @internal 1296f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1297f4c4dcf4SKowalski, Kamil * 1298f4c4dcf4SKowalski, Kamil * See header file for more information 1299f4c4dcf4SKowalski, Kamil * @endinternal 1300f4c4dcf4SKowalski, Kamil */ 1301b5c07418SJames Feist nlohmann::json created(void) 13021abe55efSEd Tanous { 1303fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1304b5c07418SJames Feist } 1305b5c07418SJames Feist 1306b5c07418SJames Feist void created(crow::Response& res) 1307b5c07418SJames Feist { 1308b5c07418SJames Feist res.result(boost::beast::http::status::created); 1309b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1310f4c4dcf4SKowalski, Kamil } 1311f4c4dcf4SKowalski, Kamil 1312f4c4dcf4SKowalski, Kamil /** 1313f4c4dcf4SKowalski, Kamil * @internal 1314cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1315cc9139ecSJason M. Bills * 1316cc9139ecSJason M. Bills * See header file for more information 1317cc9139ecSJason M. Bills * @endinternal 1318cc9139ecSJason M. Bills */ 1319b5c07418SJames Feist nlohmann::json noOperation(void) 1320cc9139ecSJason M. Bills { 1321fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1322b5c07418SJames Feist } 1323b5c07418SJames Feist 1324b5c07418SJames Feist void noOperation(crow::Response& res) 1325b5c07418SJames Feist { 1326b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1327b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1328cc9139ecSJason M. Bills } 1329cc9139ecSJason M. Bills 1330cc9139ecSJason M. Bills /** 1331cc9139ecSJason M. Bills * @internal 1332b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1333b5c07418SJames Feist * property 1334f12894f8SJason M. Bills * 1335f12894f8SJason M. Bills * See header file for more information 1336f12894f8SJason M. Bills * @endinternal 1337f12894f8SJason M. Bills */ 13381668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1339b5c07418SJames Feist { 1340fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 13411668ce6dSEd Tanous std::to_array({arg1})); 1342b5c07418SJames Feist } 1343b5c07418SJames Feist 13441668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1345f12894f8SJason M. Bills { 1346f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 13477b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1348f4c4dcf4SKowalski, Kamil } 1349f4c4dcf4SKowalski, Kamil 1350f4c4dcf4SKowalski, Kamil /** 1351f4c4dcf4SKowalski, Kamil * @internal 1352f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1353f4c4dcf4SKowalski, Kamil * 1354f4c4dcf4SKowalski, Kamil * See header file for more information 1355f4c4dcf4SKowalski, Kamil * @endinternal 1356f4c4dcf4SKowalski, Kamil */ 1357b5c07418SJames Feist nlohmann::json noValidSession(void) 13581abe55efSEd Tanous { 1359fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1360b5c07418SJames Feist } 1361b5c07418SJames Feist 1362b5c07418SJames Feist void noValidSession(crow::Response& res) 1363b5c07418SJames Feist { 1364b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1365b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1366f4c4dcf4SKowalski, Kamil } 1367f4c4dcf4SKowalski, Kamil 1368f4c4dcf4SKowalski, Kamil /** 1369f4c4dcf4SKowalski, Kamil * @internal 1370f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1371f4c4dcf4SKowalski, Kamil * 1372f4c4dcf4SKowalski, Kamil * See header file for more information 1373f4c4dcf4SKowalski, Kamil * @endinternal 1374f4c4dcf4SKowalski, Kamil */ 1375d9f466b3SEd Tanous nlohmann::json invalidObject(boost::urls::url_view arg1) 13761abe55efSEd Tanous { 1377fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 1378079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1379b5c07418SJames Feist } 1380b5c07418SJames Feist 1381d9f466b3SEd Tanous void invalidObject(crow::Response& res, boost::urls::url_view arg1) 1382b5c07418SJames Feist { 1383b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1384b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1385f4c4dcf4SKowalski, Kamil } 1386f4c4dcf4SKowalski, Kamil 1387f4c4dcf4SKowalski, Kamil /** 1388f4c4dcf4SKowalski, Kamil * @internal 1389f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1390f4c4dcf4SKowalski, Kamil * 1391f4c4dcf4SKowalski, Kamil * See header file for more information 1392f4c4dcf4SKowalski, Kamil * @endinternal 1393f4c4dcf4SKowalski, Kamil */ 1394b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13951abe55efSEd Tanous { 1396fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1397b5c07418SJames Feist } 1398b5c07418SJames Feist 1399b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1400b5c07418SJames Feist { 1401b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1402b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1403f4c4dcf4SKowalski, Kamil } 1404f4c4dcf4SKowalski, Kamil 1405f4c4dcf4SKowalski, Kamil /** 1406f4c4dcf4SKowalski, Kamil * @internal 1407f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1408f4c4dcf4SKowalski, Kamil * 1409f4c4dcf4SKowalski, Kamil * See header file for more information 1410f4c4dcf4SKowalski, Kamil * @endinternal 1411f4c4dcf4SKowalski, Kamil */ 14121668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 14131668ce6dSEd Tanous std::string_view arg2, 14141668ce6dSEd Tanous std::string_view arg3) 14151abe55efSEd Tanous { 1416b6cd31e1SEd Tanous return getLog( 1417fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 14181668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1419b5c07418SJames Feist } 1420b5c07418SJames Feist 14211668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 14221668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1423b5c07418SJames Feist { 1424b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1425b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1426b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1427f4c4dcf4SKowalski, Kamil } 1428f4c4dcf4SKowalski, Kamil 1429f4c4dcf4SKowalski, Kamil /** 1430f4c4dcf4SKowalski, Kamil * @internal 1431f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1432f4c4dcf4SKowalski, Kamil * 1433f4c4dcf4SKowalski, Kamil * See header file for more information 1434f4c4dcf4SKowalski, Kamil * @endinternal 1435f4c4dcf4SKowalski, Kamil */ 1436b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 14371abe55efSEd Tanous { 1438fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1439b5c07418SJames Feist } 1440b5c07418SJames Feist 1441b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1442b5c07418SJames Feist { 1443b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1444b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1445f4c4dcf4SKowalski, Kamil } 1446f4c4dcf4SKowalski, Kamil 1447f4c4dcf4SKowalski, Kamil /** 1448f4c4dcf4SKowalski, Kamil * @internal 1449f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1450f4c4dcf4SKowalski, Kamil * 1451f4c4dcf4SKowalski, Kamil * See header file for more information 1452f4c4dcf4SKowalski, Kamil * @endinternal 1453f4c4dcf4SKowalski, Kamil */ 14541668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 14551abe55efSEd Tanous { 1456fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 14571668ce6dSEd Tanous std::to_array({arg1})); 1458b5c07418SJames Feist } 1459b5c07418SJames Feist 14601668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1461b5c07418SJames Feist { 1462b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1463b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1464f4c4dcf4SKowalski, Kamil } 1465f4c4dcf4SKowalski, Kamil 1466f4c4dcf4SKowalski, Kamil /** 1467f4c4dcf4SKowalski, Kamil * @internal 1468f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1469f4c4dcf4SKowalski, Kamil * 1470f4c4dcf4SKowalski, Kamil * See header file for more information 1471f4c4dcf4SKowalski, Kamil * @endinternal 1472f4c4dcf4SKowalski, Kamil */ 14735187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14741abe55efSEd Tanous { 1475b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1476fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14771668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1478b5c07418SJames Feist } 1479b5c07418SJames Feist 14805187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1481b5c07418SJames Feist { 1482b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1483b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1484f4c4dcf4SKowalski, Kamil } 1485f4c4dcf4SKowalski, Kamil 1486f4c4dcf4SKowalski, Kamil /** 1487f4c4dcf4SKowalski, Kamil * @internal 1488f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1489f4c4dcf4SKowalski, Kamil * 1490f4c4dcf4SKowalski, Kamil * See header file for more information 1491f4c4dcf4SKowalski, Kamil * @endinternal 1492f4c4dcf4SKowalski, Kamil */ 1493b5c07418SJames Feist nlohmann::json emptyJSON(void) 14941abe55efSEd Tanous { 1495fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1496b5c07418SJames Feist } 1497b5c07418SJames Feist 1498b5c07418SJames Feist void emptyJSON(crow::Response& res) 1499b5c07418SJames Feist { 1500b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1501b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1502f4c4dcf4SKowalski, Kamil } 1503f4c4dcf4SKowalski, Kamil 1504f4c4dcf4SKowalski, Kamil /** 1505f4c4dcf4SKowalski, Kamil * @internal 1506f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1507f4c4dcf4SKowalski, Kamil * 1508f4c4dcf4SKowalski, Kamil * See header file for more information 1509f4c4dcf4SKowalski, Kamil * @endinternal 1510f4c4dcf4SKowalski, Kamil */ 1511b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 15121abe55efSEd Tanous { 1513fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1514b6cd31e1SEd Tanous {}); 1515b5c07418SJames Feist } 1516b5c07418SJames Feist 1517b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1518b5c07418SJames Feist { 15196a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1520b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1521f4c4dcf4SKowalski, Kamil } 1522f4c4dcf4SKowalski, Kamil 1523f4c4dcf4SKowalski, Kamil /** 1524f4c4dcf4SKowalski, Kamil * @internal 1525684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1526684bb4b8SJason M. Bills * 1527684bb4b8SJason M. Bills * See header file for more information 1528684bb4b8SJason M. Bills * @endinternal 1529684bb4b8SJason M. Bills */ 1530684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1531684bb4b8SJason M. Bills { 1532b6cd31e1SEd Tanous return getLog( 1533fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1534684bb4b8SJason M. Bills } 1535684bb4b8SJason M. Bills 1536684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1537684bb4b8SJason M. Bills { 15386a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1539684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1540684bb4b8SJason M. Bills } 1541684bb4b8SJason M. Bills 1542684bb4b8SJason M. Bills /** 1543684bb4b8SJason M. Bills * @internal 1544684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1545684bb4b8SJason M. Bills * 1546684bb4b8SJason M. Bills * See header file for more information 1547684bb4b8SJason M. Bills * @endinternal 1548684bb4b8SJason M. Bills */ 1549684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1550684bb4b8SJason M. Bills { 1551fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1552fffb8c1fSEd Tanous {}); 1553684bb4b8SJason M. Bills } 1554684bb4b8SJason M. Bills 1555684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1556684bb4b8SJason M. Bills { 1557684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1558684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1559684bb4b8SJason M. Bills } 1560684bb4b8SJason M. Bills 1561684bb4b8SJason M. Bills /** 1562684bb4b8SJason M. Bills * @internal 1563f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1564f4c4dcf4SKowalski, Kamil * 1565f4c4dcf4SKowalski, Kamil * See header file for more information 1566f4c4dcf4SKowalski, Kamil * @endinternal 1567f4c4dcf4SKowalski, Kamil */ 1568b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15691abe55efSEd Tanous { 1570fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1571b5c07418SJames Feist } 1572b5c07418SJames Feist 1573b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1574b5c07418SJames Feist { 1575b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1576b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1577f4c4dcf4SKowalski, Kamil } 1578f4c4dcf4SKowalski, Kamil 1579f4c4dcf4SKowalski, Kamil /** 1580f4c4dcf4SKowalski, Kamil * @internal 1581f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1582f4c4dcf4SKowalski, Kamil * 1583f4c4dcf4SKowalski, Kamil * See header file for more information 1584f4c4dcf4SKowalski, Kamil * @endinternal 1585f4c4dcf4SKowalski, Kamil */ 15861668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15871668ce6dSEd Tanous std::string_view arg2) 1588b5c07418SJames Feist { 1589fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15901668ce6dSEd Tanous std::to_array({arg1, arg2})); 1591b5c07418SJames Feist } 1592b5c07418SJames Feist 15931668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15941668ce6dSEd Tanous std::string_view arg2) 15951abe55efSEd Tanous { 1596f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1597b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1598f4c4dcf4SKowalski, Kamil } 1599f4c4dcf4SKowalski, Kamil 1600f4c4dcf4SKowalski, Kamil /** 1601f4c4dcf4SKowalski, Kamil * @internal 1602f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1603f4c4dcf4SKowalski, Kamil * 1604f4c4dcf4SKowalski, Kamil * See header file for more information 1605f4c4dcf4SKowalski, Kamil * @endinternal 1606f4c4dcf4SKowalski, Kamil */ 1607b5c07418SJames Feist nlohmann::json accountNotModified(void) 16081abe55efSEd Tanous { 1609fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1610b5c07418SJames Feist } 1611b5c07418SJames Feist 1612b5c07418SJames Feist void accountNotModified(crow::Response& res) 1613b5c07418SJames Feist { 1614b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1615b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1616f4c4dcf4SKowalski, Kamil } 1617f4c4dcf4SKowalski, Kamil 1618f4c4dcf4SKowalski, Kamil /** 1619f4c4dcf4SKowalski, Kamil * @internal 1620f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1621f4c4dcf4SKowalski, Kamil * 1622f4c4dcf4SKowalski, Kamil * See header file for more information 1623f4c4dcf4SKowalski, Kamil * @endinternal 1624f4c4dcf4SKowalski, Kamil */ 16251668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 16261668ce6dSEd Tanous std::string_view arg2) 16271abe55efSEd Tanous { 1628fffb8c1fSEd Tanous return getLog( 1629fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 16301668ce6dSEd Tanous std::to_array({arg1, arg2})); 1631b5c07418SJames Feist } 1632b5c07418SJames Feist 16331668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 16341668ce6dSEd Tanous std::string_view arg2) 1635b5c07418SJames Feist { 1636b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1637b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1638b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1639f4c4dcf4SKowalski, Kamil } 1640f4c4dcf4SKowalski, Kamil 1641f4c4dcf4SKowalski, Kamil /** 1642f4c4dcf4SKowalski, Kamil * @internal 1643b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1644b5c07418SJames Feist * property 1645f12894f8SJason M. Bills * 1646f12894f8SJason M. Bills * See header file for more information 1647f12894f8SJason M. Bills * @endinternal 1648f12894f8SJason M. Bills */ 16491668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1650f12894f8SJason M. Bills { 1651fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 16521668ce6dSEd Tanous std::to_array({arg1})); 1653b5c07418SJames Feist } 1654b5c07418SJames Feist 16551668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1656b5c07418SJames Feist { 1657b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1658b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1659f4c4dcf4SKowalski, Kamil } 1660f4c4dcf4SKowalski, Kamil 1661f4c4dcf4SKowalski, Kamil /** 1662f4c4dcf4SKowalski, Kamil * @internal 1663f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1664f4c4dcf4SKowalski, Kamil * 1665f4c4dcf4SKowalski, Kamil * See header file for more information 1666f4c4dcf4SKowalski, Kamil * @endinternal 1667f4c4dcf4SKowalski, Kamil */ 16681668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16691abe55efSEd Tanous { 1670fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16711668ce6dSEd Tanous std::to_array({arg1})); 1672b5c07418SJames Feist } 1673b5c07418SJames Feist 16741668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1675b5c07418SJames Feist { 1676b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1677b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1678f4c4dcf4SKowalski, Kamil } 1679f4c4dcf4SKowalski, Kamil 1680f4c4dcf4SKowalski, Kamil /** 1681f4c4dcf4SKowalski, Kamil * @internal 1682f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1683f4c4dcf4SKowalski, Kamil * 1684f4c4dcf4SKowalski, Kamil * See header file for more information 1685f4c4dcf4SKowalski, Kamil * @endinternal 1686f4c4dcf4SKowalski, Kamil */ 1687b5c07418SJames Feist nlohmann::json accountModified(void) 16881abe55efSEd Tanous { 1689fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1690b5c07418SJames Feist } 1691b5c07418SJames Feist 1692b5c07418SJames Feist void accountModified(crow::Response& res) 1693b5c07418SJames Feist { 1694b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1695b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1696f4c4dcf4SKowalski, Kamil } 1697f4c4dcf4SKowalski, Kamil 1698f4c4dcf4SKowalski, Kamil /** 1699f4c4dcf4SKowalski, Kamil * @internal 1700f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1701f4c4dcf4SKowalski, Kamil * 1702f4c4dcf4SKowalski, Kamil * See header file for more information 1703f4c4dcf4SKowalski, Kamil * @endinternal 1704f4c4dcf4SKowalski, Kamil */ 17051668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 17061668ce6dSEd Tanous std::string_view arg2, 17071668ce6dSEd Tanous std::string_view arg3) 17081abe55efSEd Tanous { 1709fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 17101668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1711b5c07418SJames Feist } 1712b5c07418SJames Feist 17131668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 17141668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1715b5c07418SJames Feist { 1716b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1717b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1718b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1719f4c4dcf4SKowalski, Kamil } 1720f4c4dcf4SKowalski, Kamil 1721d9f466b3SEd Tanous nlohmann::json passwordChangeRequired(boost::urls::url_view arg1) 1722b6cd31e1SEd Tanous { 1723fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 1724079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1725b6cd31e1SEd Tanous } 1726b6cd31e1SEd Tanous 17273bf4e632SJoseph Reynolds /** 17283bf4e632SJoseph Reynolds * @internal 17293bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 17303bf4e632SJoseph Reynolds * 17313bf4e632SJoseph Reynolds * See header file for more information 17323bf4e632SJoseph Reynolds * @endinternal 17333bf4e632SJoseph Reynolds */ 1734d9f466b3SEd Tanous void passwordChangeRequired(crow::Response& res, boost::urls::url_view arg1) 17353bf4e632SJoseph Reynolds { 1736b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 17373bf4e632SJoseph Reynolds } 17383bf4e632SJoseph Reynolds 17394cde5d90SJames Feist /** 17404cde5d90SJames Feist * @internal 1741ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1742ae688313SNan Zhou * 1743ae688313SNan Zhou * See header file for more information 1744ae688313SNan Zhou * @endinternal 1745ae688313SNan Zhou */ 1746ae688313SNan Zhou nlohmann::json insufficientStorage() 1747ae688313SNan Zhou { 1748ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1749ae688313SNan Zhou } 1750ae688313SNan Zhou 1751ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1752ae688313SNan Zhou { 1753ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1754ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1755ae688313SNan Zhou } 1756ae688313SNan Zhou 1757ae688313SNan Zhou /** 1758ae688313SNan Zhou * @internal 175944c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 176044c70412SEd Tanous * 176144c70412SEd Tanous * See header file for more information 176244c70412SEd Tanous * @endinternal 176344c70412SEd Tanous */ 176444c70412SEd Tanous nlohmann::json operationNotAllowed() 176544c70412SEd Tanous { 176644c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 176744c70412SEd Tanous } 176844c70412SEd Tanous 176944c70412SEd Tanous void operationNotAllowed(crow::Response& res) 177044c70412SEd Tanous { 177144c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 177244c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 177344c70412SEd Tanous } 177444c70412SEd Tanous 1775600af5f1SAppaRao Puli /** 1776600af5f1SAppaRao Puli * @internal 1777600af5f1SAppaRao Puli * @brief Formats ArraySizeTooLong message into JSON 1778600af5f1SAppaRao Puli * 1779600af5f1SAppaRao Puli * See header file for more information 1780600af5f1SAppaRao Puli * @endinternal 1781600af5f1SAppaRao Puli */ 1782600af5f1SAppaRao Puli nlohmann::json arraySizeTooLong(std::string_view property, uint64_t length) 1783600af5f1SAppaRao Puli { 1784600af5f1SAppaRao Puli std::string valStr = std::to_string(length); 1785600af5f1SAppaRao Puli return getLog(redfish::registries::base::Index::arraySizeTooLong, 1786600af5f1SAppaRao Puli std::to_array<std::string_view>({property, valStr})); 1787600af5f1SAppaRao Puli } 1788600af5f1SAppaRao Puli 1789600af5f1SAppaRao Puli void arraySizeTooLong(crow::Response& res, std::string_view property, 1790600af5f1SAppaRao Puli uint64_t length) 1791600af5f1SAppaRao Puli { 1792600af5f1SAppaRao Puli res.result(boost::beast::http::status::method_not_allowed); 1793600af5f1SAppaRao Puli addMessageToErrorJson(res.jsonValue, arraySizeTooLong(property, length)); 1794600af5f1SAppaRao Puli } 1795600af5f1SAppaRao Puli 179644c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 179744c70412SEd Tanous std::string_view arg2) 179844c70412SEd Tanous { 179944c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 180044c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 180144c70412SEd Tanous } 180244c70412SEd Tanous 180344c70412SEd Tanous /** 180444c70412SEd Tanous * @internal 18054cde5d90SJames Feist * @brief Formats Invalid File message into JSON 18064cde5d90SJames Feist * 18074cde5d90SJames Feist * See header file for more information 18084cde5d90SJames Feist * @endinternal 18094cde5d90SJames Feist */ 18101668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 18114cde5d90SJames Feist { 18121668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 18131668ce6dSEd Tanous msg += arg1; 18141668ce6dSEd Tanous msg += ": "; 18151668ce6dSEd Tanous msg += arg2; 18161668ce6dSEd Tanous msg += "."; 1817613dabeaSEd Tanous 1818613dabeaSEd Tanous nlohmann::json::object_t ret; 1819613dabeaSEd Tanous ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message"; 1820613dabeaSEd Tanous ret["MessageId"] = "OpenBMC.0.2.InvalidUpload"; 1821613dabeaSEd Tanous ret["Message"] = std::move(msg); 1822613dabeaSEd Tanous nlohmann::json::array_t args; 1823ad539545SPatrick Williams args.emplace_back(arg1); 1824ad539545SPatrick Williams args.emplace_back(arg2); 1825613dabeaSEd Tanous ret["MessageArgs"] = std::move(args); 1826613dabeaSEd Tanous ret["MessageSeverity"] = "Warning"; 1827613dabeaSEd Tanous ret["Resolution"] = "None."; 1828613dabeaSEd Tanous return ret; 18294cde5d90SJames Feist } 1830ae688313SNan Zhou 1831f4c4dcf4SKowalski, Kamil } // namespace messages 1832f4c4dcf4SKowalski, Kamil 1833d425c6f6SEd Tanous } // namespace redfish 1834