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 "nlohmann/json.hpp" 210442ef92SNan Zhou #include "registries.hpp" 220442ef92SNan Zhou #include "registries/base_message_registry.hpp" 230442ef92SNan Zhou #include "source_location.hpp" 240442ef92SNan Zhou 250442ef92SNan Zhou #include <boost/beast/http/field.hpp> 269ea15c35SEd Tanous #include <boost/beast/http/status.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 */ 207ace85d60SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1) 2081abe55efSEd Tanous { 209b6cd31e1SEd Tanous std::array<std::string_view, 1> args{ 210b6cd31e1SEd Tanous std::string_view{arg1.data(), arg1.size()}}; 211fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 212b5c07418SJames Feist } 213b5c07418SJames Feist 214ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res, 215ace85d60SEd Tanous const boost::urls::url_view& arg1) 216b5c07418SJames Feist { 217b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 218b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 219f4c4dcf4SKowalski, Kamil } 220f4c4dcf4SKowalski, Kamil 221f4c4dcf4SKowalski, Kamil /** 222f4c4dcf4SKowalski, Kamil * @internal 223f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 224f4c4dcf4SKowalski, Kamil * 225f4c4dcf4SKowalski, Kamil * See header file for more information 226f4c4dcf4SKowalski, Kamil * @endinternal 227f4c4dcf4SKowalski, Kamil */ 2281668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2291668ce6dSEd Tanous std::string_view arg2, 2301668ce6dSEd Tanous std::string_view arg3) 2311abe55efSEd Tanous { 232fffb8c1fSEd Tanous return getLog( 233fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2341668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 235b5c07418SJames Feist } 236b5c07418SJames Feist 2371668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2381668ce6dSEd Tanous std::string_view arg2, 2391668ce6dSEd Tanous std::string_view arg3) 240b5c07418SJames Feist { 241b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 242b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 243b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 244f4c4dcf4SKowalski, Kamil } 245f4c4dcf4SKowalski, Kamil 246f4c4dcf4SKowalski, Kamil /** 247f4c4dcf4SKowalski, Kamil * @internal 248f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 249f4c4dcf4SKowalski, Kamil * 250f4c4dcf4SKowalski, Kamil * See header file for more information 251f4c4dcf4SKowalski, Kamil * @endinternal 252f4c4dcf4SKowalski, Kamil */ 253b5c07418SJames Feist nlohmann::json internalError(void) 2541abe55efSEd Tanous { 255fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 256b5c07418SJames Feist } 257b5c07418SJames Feist 258df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 259b5c07418SJames Feist { 260df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 261df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 262df5415fcSEd Tanous << location.function_name() << "`: "; 263b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 264b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 265f12894f8SJason M. Bills } 266f12894f8SJason M. Bills 267f12894f8SJason M. Bills /** 268f12894f8SJason M. Bills * @internal 269f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 270f4c4dcf4SKowalski, Kamil * 271f4c4dcf4SKowalski, Kamil * See header file for more information 272f4c4dcf4SKowalski, Kamil * @endinternal 273f4c4dcf4SKowalski, Kamil */ 274b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2751abe55efSEd Tanous { 276fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 277fffb8c1fSEd Tanous {}); 278b5c07418SJames Feist } 279b5c07418SJames Feist 280b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 281b5c07418SJames Feist { 282b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 283b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 284f4c4dcf4SKowalski, Kamil } 285f4c4dcf4SKowalski, Kamil 286f4c4dcf4SKowalski, Kamil /** 287f4c4dcf4SKowalski, Kamil * @internal 288f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 289f4c4dcf4SKowalski, Kamil * 290f4c4dcf4SKowalski, Kamil * See header file for more information 291f4c4dcf4SKowalski, Kamil * @endinternal 292f4c4dcf4SKowalski, Kamil */ 293ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 2941668ce6dSEd Tanous std::string_view arg2) 2951abe55efSEd Tanous { 296b6cd31e1SEd Tanous return getLog( 297fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriUnauthorized, 2981668ce6dSEd Tanous std::to_array({std::string_view{arg1.data(), arg1.size()}, arg2})); 299b5c07418SJames Feist } 300b5c07418SJames Feist 301ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 302ace85d60SEd Tanous const boost::urls::url_view& arg1, 3031668ce6dSEd Tanous std::string_view arg2) 304b5c07418SJames Feist { 305b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 306b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 307f4c4dcf4SKowalski, Kamil } 308f4c4dcf4SKowalski, Kamil 309f4c4dcf4SKowalski, Kamil /** 310f4c4dcf4SKowalski, Kamil * @internal 311f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 312f4c4dcf4SKowalski, Kamil * 313f4c4dcf4SKowalski, Kamil * See header file for more information 314f4c4dcf4SKowalski, Kamil * @endinternal 315f4c4dcf4SKowalski, Kamil */ 3161668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 3171668ce6dSEd Tanous std::string_view arg2) 318b5c07418SJames Feist { 319fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 3201668ce6dSEd Tanous std::to_array({arg1, arg2})); 321b5c07418SJames Feist } 322b5c07418SJames Feist 3231668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3241668ce6dSEd Tanous std::string_view arg2) 3251abe55efSEd Tanous { 326f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 327b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 328f4c4dcf4SKowalski, Kamil } 329f4c4dcf4SKowalski, Kamil 330f4c4dcf4SKowalski, Kamil /** 331f4c4dcf4SKowalski, Kamil * @internal 332f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 333f4c4dcf4SKowalski, Kamil * 334f4c4dcf4SKowalski, Kamil * See header file for more information 335f4c4dcf4SKowalski, Kamil * @endinternal 336f4c4dcf4SKowalski, Kamil */ 337b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3381abe55efSEd Tanous { 339fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 340fffb8c1fSEd Tanous {}); 341b5c07418SJames Feist } 342b5c07418SJames Feist 343b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 344b5c07418SJames Feist { 34544c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 346b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 347f4c4dcf4SKowalski, Kamil } 348f4c4dcf4SKowalski, Kamil 349f4c4dcf4SKowalski, Kamil /** 350f4c4dcf4SKowalski, Kamil * @internal 351f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 352f4c4dcf4SKowalski, Kamil * 353f4c4dcf4SKowalski, Kamil * See header file for more information 354f4c4dcf4SKowalski, Kamil * @endinternal 355f4c4dcf4SKowalski, Kamil */ 3561668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3571abe55efSEd Tanous { 358fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3591668ce6dSEd Tanous std::to_array({arg1})); 360b5c07418SJames Feist } 361b5c07418SJames Feist 3621668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 363b5c07418SJames Feist { 364b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 365b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 366f4c4dcf4SKowalski, Kamil } 367f4c4dcf4SKowalski, Kamil 368f4c4dcf4SKowalski, Kamil /** 369f4c4dcf4SKowalski, Kamil * @internal 370f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 371f4c4dcf4SKowalski, Kamil * 372f4c4dcf4SKowalski, Kamil * See header file for more information 373f4c4dcf4SKowalski, Kamil * @endinternal 374f4c4dcf4SKowalski, Kamil */ 3751668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3761abe55efSEd Tanous { 377b6cd31e1SEd Tanous return getLog( 378fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3791668ce6dSEd Tanous std::to_array({arg1})); 380b5c07418SJames Feist } 381b5c07418SJames Feist 3821668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 383b5c07418SJames Feist { 384d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 385b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 386b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 387f4c4dcf4SKowalski, Kamil } 388f4c4dcf4SKowalski, Kamil 389f4c4dcf4SKowalski, Kamil /** 390f4c4dcf4SKowalski, Kamil * @internal 391f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 392f4c4dcf4SKowalski, Kamil * 393f4c4dcf4SKowalski, Kamil * See header file for more information 394f4c4dcf4SKowalski, Kamil * @endinternal 395f4c4dcf4SKowalski, Kamil */ 3961668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 3971668ce6dSEd Tanous std::string_view arg2, 3981668ce6dSEd Tanous std::string_view arg3) 3991abe55efSEd Tanous { 400fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 4011668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 402b5c07418SJames Feist } 403b5c07418SJames Feist 4041668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 4051668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 406b5c07418SJames Feist { 407b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 408b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 409a08b46ccSJason M. Bills arg2); 410f4c4dcf4SKowalski, Kamil } 411f4c4dcf4SKowalski, Kamil 412f4c4dcf4SKowalski, Kamil /** 413f4c4dcf4SKowalski, Kamil * @internal 414f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 415f4c4dcf4SKowalski, Kamil * 416f4c4dcf4SKowalski, Kamil * See header file for more information 417f4c4dcf4SKowalski, Kamil * @endinternal 418f4c4dcf4SKowalski, Kamil */ 419b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4201abe55efSEd Tanous { 421fffb8c1fSEd Tanous return getLog( 422fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 423b5c07418SJames Feist } 424b5c07418SJames Feist 425b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 426b5c07418SJames Feist { 427b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 428b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 429f4c4dcf4SKowalski, Kamil } 430f4c4dcf4SKowalski, Kamil 431f4c4dcf4SKowalski, Kamil /** 432f4c4dcf4SKowalski, Kamil * @internal 433f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 434f4c4dcf4SKowalski, Kamil * 435f4c4dcf4SKowalski, Kamil * See header file for more information 436f4c4dcf4SKowalski, Kamil * @endinternal 437f4c4dcf4SKowalski, Kamil */ 4381668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4391abe55efSEd Tanous { 440fffb8c1fSEd Tanous return getLog( 441fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4421668ce6dSEd Tanous std::to_array({arg1})); 443b5c07418SJames Feist } 444b5c07418SJames Feist 445b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4461668ce6dSEd Tanous std::string_view arg1) 447b5c07418SJames Feist { 448b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 449b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 450a08b46ccSJason M. Bills arg1); 451f12894f8SJason M. Bills } 452f12894f8SJason M. Bills 453f12894f8SJason M. Bills /** 454f12894f8SJason M. Bills * @internal 455f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 456f12894f8SJason M. Bills * property 457f12894f8SJason M. Bills * 458f12894f8SJason M. Bills * See header file for more information 459f12894f8SJason M. Bills * @endinternal 460f12894f8SJason M. Bills */ 4611668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4621668ce6dSEd Tanous std::string_view arg2) 463f12894f8SJason M. Bills { 464fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4651668ce6dSEd Tanous std::to_array({arg1, arg2})); 466b5c07418SJames Feist } 467b5c07418SJames Feist 4681668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4691668ce6dSEd Tanous std::string_view arg2) 470b5c07418SJames Feist { 471b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 472b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 473f12894f8SJason M. Bills } 474f12894f8SJason M. Bills 475f12894f8SJason M. Bills /** 476f12894f8SJason M. Bills * @internal 477f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 478f12894f8SJason M. Bills * property 479f12894f8SJason M. Bills * 480f12894f8SJason M. Bills * See header file for more information 481f12894f8SJason M. Bills * @endinternal 482f12894f8SJason M. Bills */ 4831668ce6dSEd Tanous nlohmann::json propertyValueNotInList(std::string_view arg1, 4841668ce6dSEd Tanous std::string_view arg2) 485f12894f8SJason M. Bills { 486fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 4871668ce6dSEd Tanous std::to_array({arg1, arg2})); 488b5c07418SJames Feist } 489b5c07418SJames Feist 4901668ce6dSEd Tanous void propertyValueNotInList(crow::Response& res, std::string_view arg1, 4911668ce6dSEd Tanous std::string_view arg2) 492b5c07418SJames Feist { 493b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 494b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 495f4c4dcf4SKowalski, Kamil } 496f4c4dcf4SKowalski, Kamil 497f4c4dcf4SKowalski, Kamil /** 498f4c4dcf4SKowalski, Kamil * @internal 499227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 500227a2b0aSJiaqing Zhao * 501227a2b0aSJiaqing Zhao * See header file for more information 502227a2b0aSJiaqing Zhao * @endinternal 503227a2b0aSJiaqing Zhao */ 504227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 505227a2b0aSJiaqing Zhao std::string_view arg2) 506227a2b0aSJiaqing Zhao { 507227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 508227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 509227a2b0aSJiaqing Zhao } 510227a2b0aSJiaqing Zhao 511227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 512227a2b0aSJiaqing Zhao std::string_view arg2) 513227a2b0aSJiaqing Zhao { 514227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 515227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 516227a2b0aSJiaqing Zhao } 517227a2b0aSJiaqing Zhao 518227a2b0aSJiaqing Zhao /** 519227a2b0aSJiaqing Zhao * @internal 520f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 521f4c4dcf4SKowalski, Kamil * 522f4c4dcf4SKowalski, Kamil * See header file for more information 523f4c4dcf4SKowalski, Kamil * @endinternal 524f4c4dcf4SKowalski, Kamil */ 525ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1) 5261abe55efSEd Tanous { 5271668ce6dSEd Tanous std::string_view arg1str{arg1.data(), arg1.size()}; 528b6cd31e1SEd Tanous return getLog( 529fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 5301668ce6dSEd Tanous std::to_array({arg1str})); 531b5c07418SJames Feist } 532b5c07418SJames Feist 533ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 534ace85d60SEd Tanous const boost::urls::url_view& arg1) 535b5c07418SJames Feist { 536b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 537b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 538f4c4dcf4SKowalski, Kamil } 539f4c4dcf4SKowalski, Kamil 540f4c4dcf4SKowalski, Kamil /** 541f4c4dcf4SKowalski, Kamil * @internal 54281856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 54381856681SAsmitha Karunanithi * 54481856681SAsmitha Karunanithi * See header file for more information 54581856681SAsmitha Karunanithi * @endinternal 54681856681SAsmitha Karunanithi */ 5471668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 54881856681SAsmitha Karunanithi { 549fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5501668ce6dSEd Tanous std::to_array({arg1})); 55181856681SAsmitha Karunanithi } 55281856681SAsmitha Karunanithi 5531668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 55481856681SAsmitha Karunanithi { 55581856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 55681856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 55781856681SAsmitha Karunanithi } 55881856681SAsmitha Karunanithi 55981856681SAsmitha Karunanithi /** 56081856681SAsmitha Karunanithi * @internal 561f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 562f4c4dcf4SKowalski, Kamil * 563f4c4dcf4SKowalski, Kamil * See header file for more information 564f4c4dcf4SKowalski, Kamil * @endinternal 565f4c4dcf4SKowalski, Kamil */ 566b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5671abe55efSEd Tanous { 568fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 569b5c07418SJames Feist } 570b5c07418SJames Feist 571b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 572b5c07418SJames Feist { 573b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 574b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 575f4c4dcf4SKowalski, Kamil } 576f4c4dcf4SKowalski, Kamil 577f4c4dcf4SKowalski, Kamil /** 578f4c4dcf4SKowalski, Kamil * @internal 579f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 580f4c4dcf4SKowalski, Kamil * 581f4c4dcf4SKowalski, Kamil * See header file for more information 582f4c4dcf4SKowalski, Kamil * @endinternal 583f4c4dcf4SKowalski, Kamil */ 584b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 5851abe55efSEd Tanous { 586fffb8c1fSEd Tanous return getLog( 587fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 588b5c07418SJames Feist } 589b5c07418SJames Feist 590b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 591b5c07418SJames Feist { 592789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 593b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 594f4c4dcf4SKowalski, Kamil } 595f4c4dcf4SKowalski, Kamil 596f4c4dcf4SKowalski, Kamil /** 597f4c4dcf4SKowalski, Kamil * @internal 598f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 599f4c4dcf4SKowalski, Kamil * 600f4c4dcf4SKowalski, Kamil * See header file for more information 601f4c4dcf4SKowalski, Kamil * @endinternal 602f4c4dcf4SKowalski, Kamil */ 6031668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 6041668ce6dSEd Tanous std::string_view arg2) 6051abe55efSEd Tanous { 606fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 6071668ce6dSEd Tanous std::to_array({arg1, arg2})); 608b5c07418SJames Feist } 609b5c07418SJames Feist 6101668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 6111668ce6dSEd Tanous std::string_view arg2) 612b5c07418SJames Feist { 613b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 614b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 615f4c4dcf4SKowalski, Kamil } 616f4c4dcf4SKowalski, Kamil 617f4c4dcf4SKowalski, Kamil /** 618f4c4dcf4SKowalski, Kamil * @internal 619f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 620f4c4dcf4SKowalski, Kamil * 621f4c4dcf4SKowalski, Kamil * See header file for more information 622f4c4dcf4SKowalski, Kamil * @endinternal 623f4c4dcf4SKowalski, Kamil */ 6241668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 6251abe55efSEd Tanous { 626b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 627fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 6281668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 629b5c07418SJames Feist } 630b5c07418SJames Feist 6311668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 632b5c07418SJames Feist { 633b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 634b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 635f4c4dcf4SKowalski, Kamil } 636f4c4dcf4SKowalski, Kamil 637f4c4dcf4SKowalski, Kamil /** 638f4c4dcf4SKowalski, Kamil * @internal 639cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 640cc9139ecSJason M. Bills * 641cc9139ecSJason M. Bills * See header file for more information 642cc9139ecSJason M. Bills * @endinternal 643cc9139ecSJason M. Bills */ 644b5c07418SJames Feist nlohmann::json sessionTerminated(void) 645cc9139ecSJason M. Bills { 646fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 647b5c07418SJames Feist } 648b5c07418SJames Feist 649b5c07418SJames Feist void sessionTerminated(crow::Response& res) 650b5c07418SJames Feist { 651b5c07418SJames Feist res.result(boost::beast::http::status::ok); 652b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 653cc9139ecSJason M. Bills } 654cc9139ecSJason M. Bills 655cc9139ecSJason M. Bills /** 656cc9139ecSJason M. Bills * @internal 657684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 658684bb4b8SJason M. Bills * 659684bb4b8SJason M. Bills * See header file for more information 660684bb4b8SJason M. Bills * @endinternal 661684bb4b8SJason M. Bills */ 662684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 663684bb4b8SJason M. Bills { 664fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 665684bb4b8SJason M. Bills } 666684bb4b8SJason M. Bills 667684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 668684bb4b8SJason M. Bills { 669684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 670684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 671684bb4b8SJason M. Bills } 672684bb4b8SJason M. Bills 673684bb4b8SJason M. Bills /** 674684bb4b8SJason M. Bills * @internal 675cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 676cc9139ecSJason M. Bills * 677cc9139ecSJason M. Bills * See header file for more information 678cc9139ecSJason M. Bills * @endinternal 679cc9139ecSJason M. Bills */ 6801668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 6811668ce6dSEd Tanous std::string_view arg2) 682cc9139ecSJason M. Bills { 683fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 6841668ce6dSEd Tanous std::to_array({arg1, arg2})); 685b5c07418SJames Feist } 686b5c07418SJames Feist 6871668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 6881668ce6dSEd Tanous std::string_view arg2) 689b5c07418SJames Feist { 690b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 691b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 692cc9139ecSJason M. Bills } 693cc9139ecSJason M. Bills 694cc9139ecSJason M. Bills /** 695cc9139ecSJason M. Bills * @internal 696684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 697684bb4b8SJason M. Bills * 698684bb4b8SJason M. Bills * See header file for more information 699684bb4b8SJason M. Bills * @endinternal 700684bb4b8SJason M. Bills */ 701ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1, 7021668ce6dSEd Tanous std::string_view arg2) 703684bb4b8SJason M. Bills { 7041668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 705fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7061668ce6dSEd Tanous std::to_array({arg1str, arg2})); 707684bb4b8SJason M. Bills } 708684bb4b8SJason M. Bills 709ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 7101668ce6dSEd Tanous std::string_view arg2) 711684bb4b8SJason M. Bills { 712684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 713684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 714684bb4b8SJason M. Bills } 715684bb4b8SJason M. Bills 716684bb4b8SJason M. Bills /** 717684bb4b8SJason M. Bills * @internal 718684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 719684bb4b8SJason M. Bills * 720684bb4b8SJason M. Bills * See header file for more information 721684bb4b8SJason M. Bills * @endinternal 722684bb4b8SJason M. Bills */ 7231668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 724684bb4b8SJason M. Bills { 725fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7261668ce6dSEd Tanous std::to_array({arg1})); 727684bb4b8SJason M. Bills } 728684bb4b8SJason M. Bills 7291668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 730684bb4b8SJason M. Bills { 731684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 732684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 733684bb4b8SJason M. Bills } 734684bb4b8SJason M. Bills 735684bb4b8SJason M. Bills /** 736684bb4b8SJason M. Bills * @internal 737684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 738684bb4b8SJason M. Bills * 739684bb4b8SJason M. Bills * See header file for more information 740684bb4b8SJason M. Bills * @endinternal 741684bb4b8SJason M. Bills */ 7421668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 743684bb4b8SJason M. Bills { 744b6cd31e1SEd Tanous return getLog( 745fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7461668ce6dSEd Tanous std::to_array({arg1})); 747684bb4b8SJason M. Bills } 748684bb4b8SJason M. Bills 7491668ce6dSEd Tanous void chassisPowerStateOffRequired(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, chassisPowerStateOffRequired(arg1)); 753684bb4b8SJason M. Bills } 754684bb4b8SJason M. Bills 755684bb4b8SJason M. Bills /** 756684bb4b8SJason M. Bills * @internal 757684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict 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 propertyValueConflict(std::string_view arg1, 7631668ce6dSEd Tanous std::string_view arg2) 764684bb4b8SJason M. Bills { 765fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7661668ce6dSEd Tanous std::to_array({arg1, arg2})); 767684bb4b8SJason M. Bills } 768684bb4b8SJason M. Bills 7691668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7701668ce6dSEd Tanous std::string_view arg2) 771684bb4b8SJason M. Bills { 772684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 773684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 774684bb4b8SJason M. Bills } 775684bb4b8SJason M. Bills 776684bb4b8SJason M. Bills /** 777684bb4b8SJason M. Bills * @internal 7782a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7792a6af81cSRamesh Iyyar * 7802a6af81cSRamesh Iyyar * See header file for more information 7812a6af81cSRamesh Iyyar * @endinternal 7822a6af81cSRamesh Iyyar */ 7832a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 7842a6af81cSRamesh Iyyar std::string_view arg2, 7852a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7862a6af81cSRamesh Iyyar { 7872a6af81cSRamesh Iyyar return getLog( 7882a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 7892a6af81cSRamesh Iyyar std::to_array( 7902a6af81cSRamesh Iyyar {arg1, arg2, std::string_view{arg3.data(), arg3.size()}})); 7912a6af81cSRamesh Iyyar } 7922a6af81cSRamesh Iyyar 7932a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 7942a6af81cSRamesh Iyyar std::string_view arg2, 7952a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7962a6af81cSRamesh Iyyar { 7972a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 7982a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 7992a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 8002a6af81cSRamesh Iyyar } 8012a6af81cSRamesh Iyyar 8022a6af81cSRamesh Iyyar /** 8032a6af81cSRamesh Iyyar * @internal 80424861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 80524861a28SRamesh Iyyar * 80624861a28SRamesh Iyyar * See header file for more information 80724861a28SRamesh Iyyar * @endinternal 80824861a28SRamesh Iyyar */ 80924861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 81024861a28SRamesh Iyyar std::string_view arg2) 81124861a28SRamesh Iyyar { 81224861a28SRamesh Iyyar return getLog( 81324861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 81424861a28SRamesh Iyyar std::to_array({arg1, arg2})); 81524861a28SRamesh Iyyar } 81624861a28SRamesh Iyyar 81724861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 81824861a28SRamesh Iyyar std::string_view arg2) 81924861a28SRamesh Iyyar { 82024861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 82124861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 82224861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 82324861a28SRamesh Iyyar } 82424861a28SRamesh Iyyar 82524861a28SRamesh Iyyar /** 82624861a28SRamesh Iyyar * @internal 827684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 828684bb4b8SJason M. Bills * 829684bb4b8SJason M. Bills * See header file for more information 830684bb4b8SJason M. Bills * @endinternal 831684bb4b8SJason M. Bills */ 8321668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8331668ce6dSEd Tanous std::string_view arg2) 834684bb4b8SJason M. Bills { 835fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8361668ce6dSEd Tanous std::to_array({arg1, arg2})); 837684bb4b8SJason M. Bills } 838684bb4b8SJason M. Bills 8391668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8401668ce6dSEd Tanous std::string_view arg2) 841684bb4b8SJason M. Bills { 842684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 843684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 844684bb4b8SJason M. Bills } 845684bb4b8SJason M. Bills 846684bb4b8SJason M. Bills /** 847684bb4b8SJason M. Bills * @internal 848684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 849684bb4b8SJason M. Bills * 850684bb4b8SJason M. Bills * See header file for more information 851684bb4b8SJason M. Bills * @endinternal 852684bb4b8SJason M. Bills */ 853ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1) 854684bb4b8SJason M. Bills { 8551668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 856fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 8571668ce6dSEd Tanous std::to_array({arg1str})); 858684bb4b8SJason M. Bills } 859684bb4b8SJason M. Bills 860ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res, 861ace85d60SEd Tanous const boost::urls::url_view& arg1) 862684bb4b8SJason M. Bills { 863684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 864684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 865684bb4b8SJason M. Bills } 866684bb4b8SJason M. Bills 867684bb4b8SJason M. Bills /** 868684bb4b8SJason M. Bills * @internal 869684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 870684bb4b8SJason M. Bills * 871684bb4b8SJason M. Bills * See header file for more information 872684bb4b8SJason M. Bills * @endinternal 873684bb4b8SJason M. Bills */ 874684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 875684bb4b8SJason M. Bills { 876fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 877684bb4b8SJason M. Bills } 878684bb4b8SJason M. Bills 879684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 880684bb4b8SJason M. Bills { 881684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 882684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 883684bb4b8SJason M. Bills } 884684bb4b8SJason M. Bills 885684bb4b8SJason M. Bills /** 886684bb4b8SJason M. Bills * @internal 887684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 888684bb4b8SJason M. Bills * 889684bb4b8SJason M. Bills * See header file for more information 890684bb4b8SJason M. Bills * @endinternal 891684bb4b8SJason M. Bills */ 892684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 893684bb4b8SJason M. Bills { 894fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 895684bb4b8SJason M. Bills } 896684bb4b8SJason M. Bills 897684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 898684bb4b8SJason M. Bills { 8994df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 900684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 901684bb4b8SJason M. Bills } 902684bb4b8SJason M. Bills 903684bb4b8SJason M. Bills /** 904684bb4b8SJason M. Bills * @internal 905684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 906684bb4b8SJason M. Bills * 907684bb4b8SJason M. Bills * See header file for more information 908684bb4b8SJason M. Bills * @endinternal 909684bb4b8SJason M. Bills */ 910684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 911684bb4b8SJason M. Bills { 912fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 913684bb4b8SJason M. Bills } 914684bb4b8SJason M. Bills 915684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 916684bb4b8SJason M. Bills { 917684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 918684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 919684bb4b8SJason M. Bills } 920684bb4b8SJason M. Bills 921684bb4b8SJason M. Bills /** 922684bb4b8SJason M. Bills * @internal 923684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 924684bb4b8SJason M. Bills * 925684bb4b8SJason M. Bills * See header file for more information 926684bb4b8SJason M. Bills * @endinternal 927684bb4b8SJason M. Bills */ 928684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 929684bb4b8SJason M. Bills { 930fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 931684bb4b8SJason M. Bills } 932684bb4b8SJason M. Bills 933684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 934684bb4b8SJason M. Bills { 9358868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 936684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 937684bb4b8SJason M. Bills } 938684bb4b8SJason M. Bills 939684bb4b8SJason M. Bills /** 940684bb4b8SJason M. Bills * @internal 941684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 942684bb4b8SJason M. Bills * 943684bb4b8SJason M. Bills * See header file for more information 944684bb4b8SJason M. Bills * @endinternal 945684bb4b8SJason M. Bills */ 946684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 947684bb4b8SJason M. Bills { 948fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 949684bb4b8SJason M. Bills } 950684bb4b8SJason M. Bills 951684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 952684bb4b8SJason M. Bills { 953684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 954684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 955684bb4b8SJason M. Bills } 956684bb4b8SJason M. Bills 957684bb4b8SJason M. Bills /** 958684bb4b8SJason M. Bills * @internal 959f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 960f12894f8SJason M. Bills * property 961f12894f8SJason M. Bills * 962f12894f8SJason M. Bills * See header file for more information 963f12894f8SJason M. Bills * @endinternal 964f12894f8SJason M. Bills */ 9651668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 9661668ce6dSEd Tanous std::string_view arg2) 967f12894f8SJason M. Bills { 968fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9691668ce6dSEd Tanous std::to_array({arg1, arg2})); 970b5c07418SJames Feist } 971b5c07418SJames Feist 9721668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9731668ce6dSEd Tanous std::string_view arg2) 974b5c07418SJames Feist { 975b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 976b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 977f4c4dcf4SKowalski, Kamil } 978f4c4dcf4SKowalski, Kamil 979f4c4dcf4SKowalski, Kamil /** 980f4c4dcf4SKowalski, Kamil * @internal 981b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 982f4c4dcf4SKowalski, Kamil * 983f4c4dcf4SKowalski, Kamil * See header file for more information 984f4c4dcf4SKowalski, Kamil * @endinternal 985f4c4dcf4SKowalski, Kamil */ 9861668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 9871abe55efSEd Tanous { 988fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 9891668ce6dSEd Tanous std::to_array({arg1, arg2})); 990b5c07418SJames Feist } 991b5c07418SJames Feist 9921668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 9931668ce6dSEd Tanous std::string_view arg2) 994b5c07418SJames Feist { 995b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 996b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 997f4c4dcf4SKowalski, Kamil } 998f4c4dcf4SKowalski, Kamil 999f4c4dcf4SKowalski, Kamil /** 1000f4c4dcf4SKowalski, Kamil * @internal 1001f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1002f4c4dcf4SKowalski, Kamil * 1003f4c4dcf4SKowalski, Kamil * See header file for more information 1004f4c4dcf4SKowalski, Kamil * @endinternal 1005f4c4dcf4SKowalski, Kamil */ 1006ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1) 10071abe55efSEd Tanous { 10081668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1009fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 10101668ce6dSEd Tanous std::to_array({arg1str})); 1011b5c07418SJames Feist } 1012b5c07418SJames Feist 1013ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1014ace85d60SEd Tanous const boost::urls::url_view& arg1) 1015b5c07418SJames Feist { 1016b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1017b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1018f4c4dcf4SKowalski, Kamil } 1019f4c4dcf4SKowalski, Kamil 1020f4c4dcf4SKowalski, Kamil /** 1021f4c4dcf4SKowalski, Kamil * @internal 1022f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1023f12894f8SJason M. Bills * property 1024f12894f8SJason M. Bills * 1025f12894f8SJason M. Bills * See header file for more information 1026f12894f8SJason M. Bills * @endinternal 1027f12894f8SJason M. Bills */ 10281668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 1029f12894f8SJason M. Bills { 1030fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 10311668ce6dSEd Tanous std::to_array({arg1})); 1032b5c07418SJames Feist } 1033b5c07418SJames Feist 10341668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1035b5c07418SJames Feist { 1036b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1037b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1038f4c4dcf4SKowalski, Kamil } 1039f4c4dcf4SKowalski, Kamil 1040f4c4dcf4SKowalski, Kamil /** 1041f4c4dcf4SKowalski, Kamil * @internal 1042f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1043f4c4dcf4SKowalski, Kamil * 1044f4c4dcf4SKowalski, Kamil * See header file for more information 1045f4c4dcf4SKowalski, Kamil * @endinternal 1046f4c4dcf4SKowalski, Kamil */ 10471668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10481668ce6dSEd Tanous std::string_view arg2) 10491abe55efSEd Tanous { 1050b6cd31e1SEd Tanous return getLog( 1051fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10521668ce6dSEd Tanous std::to_array({arg1, arg2})); 1053b5c07418SJames Feist } 1054b5c07418SJames Feist 10551668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10561668ce6dSEd Tanous std::string_view arg2) 1057b5c07418SJames Feist { 1058b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1059b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1060b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1061f4c4dcf4SKowalski, Kamil } 1062f4c4dcf4SKowalski, Kamil 1063f4c4dcf4SKowalski, Kamil /** 1064f4c4dcf4SKowalski, Kamil * @internal 1065f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1066f4c4dcf4SKowalski, Kamil * 1067f4c4dcf4SKowalski, Kamil * See header file for more information 1068f4c4dcf4SKowalski, Kamil * @endinternal 1069f4c4dcf4SKowalski, Kamil */ 1070b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10711abe55efSEd Tanous { 1072fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1073b5c07418SJames Feist } 1074b5c07418SJames Feist 1075b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1076b5c07418SJames Feist { 1077b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1078b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1079f4c4dcf4SKowalski, Kamil } 1080f4c4dcf4SKowalski, Kamil 1081f4c4dcf4SKowalski, Kamil /** 1082f4c4dcf4SKowalski, Kamil * @internal 1083f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1084f4c4dcf4SKowalski, Kamil * 1085f4c4dcf4SKowalski, Kamil * See header file for more information 1086f4c4dcf4SKowalski, Kamil * @endinternal 1087f4c4dcf4SKowalski, Kamil */ 10881668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 10891668ce6dSEd Tanous std::string_view arg2) 10901abe55efSEd Tanous { 1091fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 10921668ce6dSEd Tanous std::to_array({arg1, arg2})); 1093b5c07418SJames Feist } 1094b5c07418SJames Feist 10951668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 10961668ce6dSEd Tanous std::string_view arg2) 1097b5c07418SJames Feist { 1098b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1099b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1100f4c4dcf4SKowalski, Kamil } 1101f4c4dcf4SKowalski, Kamil 1102f4c4dcf4SKowalski, Kamil /** 1103f4c4dcf4SKowalski, Kamil * @internal 1104f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1105f4c4dcf4SKowalski, Kamil * 1106f4c4dcf4SKowalski, Kamil * See header file for more information 1107f4c4dcf4SKowalski, Kamil * @endinternal 1108f4c4dcf4SKowalski, Kamil */ 11091668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 11101668ce6dSEd Tanous std::string_view arg2) 11111abe55efSEd Tanous { 1112fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 11131668ce6dSEd Tanous std::to_array({arg1, arg2})); 1114b5c07418SJames Feist } 1115b5c07418SJames Feist 11161668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 11171668ce6dSEd Tanous std::string_view arg2) 1118b5c07418SJames Feist { 1119b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1120b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1121b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1122f4c4dcf4SKowalski, Kamil } 1123f4c4dcf4SKowalski, Kamil 1124f4c4dcf4SKowalski, Kamil /** 1125f4c4dcf4SKowalski, Kamil * @internal 1126f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1127f4c4dcf4SKowalski, Kamil * 1128f4c4dcf4SKowalski, Kamil * See header file for more information 1129f4c4dcf4SKowalski, Kamil * @endinternal 1130f4c4dcf4SKowalski, Kamil */ 1131ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 11321668ce6dSEd Tanous std::string_view arg2) 11331abe55efSEd Tanous { 11341668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1135b6cd31e1SEd Tanous return getLog( 1136fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 11371668ce6dSEd Tanous std::to_array({arg1str, arg2})); 1138b5c07418SJames Feist } 1139b5c07418SJames Feist 1140ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1141ace85d60SEd Tanous const boost::urls::url_view& arg1, 11421668ce6dSEd Tanous std::string_view arg2) 1143b5c07418SJames Feist { 1144b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1145b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1146b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1147f4c4dcf4SKowalski, Kamil } 1148f4c4dcf4SKowalski, Kamil 1149f4c4dcf4SKowalski, Kamil /** 1150f4c4dcf4SKowalski, Kamil * @internal 1151*b4ad4c05SShantappa Teekappanavar * @brief Formats StrictAccountTypes message into JSON 1152*b4ad4c05SShantappa Teekappanavar * 1153*b4ad4c05SShantappa Teekappanavar * See header file for more information 1154*b4ad4c05SShantappa Teekappanavar * @endinternal 1155*b4ad4c05SShantappa Teekappanavar */ 1156*b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1) 1157*b4ad4c05SShantappa Teekappanavar { 1158*b4ad4c05SShantappa Teekappanavar return getLog(redfish::registries::base::Index::strictAccountTypes, 1159*b4ad4c05SShantappa Teekappanavar std::to_array({arg1})); 1160*b4ad4c05SShantappa Teekappanavar } 1161*b4ad4c05SShantappa Teekappanavar 1162*b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1) 1163*b4ad4c05SShantappa Teekappanavar { 1164*b4ad4c05SShantappa Teekappanavar res.result(boost::beast::http::status::bad_request); 1165*b4ad4c05SShantappa Teekappanavar addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 1166*b4ad4c05SShantappa Teekappanavar } 1167*b4ad4c05SShantappa Teekappanavar 1168*b4ad4c05SShantappa Teekappanavar /** 1169*b4ad4c05SShantappa Teekappanavar * @internal 1170f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1171f4c4dcf4SKowalski, Kamil * 1172f4c4dcf4SKowalski, Kamil * See header file for more information 1173f4c4dcf4SKowalski, Kamil * @endinternal 1174f4c4dcf4SKowalski, Kamil */ 1175b5c07418SJames Feist nlohmann::json accountRemoved(void) 11761abe55efSEd Tanous { 1177fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1178b5c07418SJames Feist } 1179b5c07418SJames Feist 1180b5c07418SJames Feist void accountRemoved(crow::Response& res) 1181b5c07418SJames Feist { 1182b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1183b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1184f4c4dcf4SKowalski, Kamil } 1185f4c4dcf4SKowalski, Kamil 1186f4c4dcf4SKowalski, Kamil /** 1187f4c4dcf4SKowalski, Kamil * @internal 1188f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1189f4c4dcf4SKowalski, Kamil * 1190f4c4dcf4SKowalski, Kamil * See header file for more information 1191f4c4dcf4SKowalski, Kamil * @endinternal 1192f4c4dcf4SKowalski, Kamil */ 1193ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1) 11941abe55efSEd Tanous { 11951668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1196fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 11971668ce6dSEd Tanous std::to_array({arg1str})); 1198b5c07418SJames Feist } 1199b5c07418SJames Feist 1200ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1) 1201b5c07418SJames Feist { 1202b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1203b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1204f4c4dcf4SKowalski, Kamil } 1205f4c4dcf4SKowalski, Kamil 1206f4c4dcf4SKowalski, Kamil /** 1207f4c4dcf4SKowalski, Kamil * @internal 1208f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1209f4c4dcf4SKowalski, Kamil * 1210f4c4dcf4SKowalski, Kamil * See header file for more information 1211f4c4dcf4SKowalski, Kamil * @endinternal 1212f4c4dcf4SKowalski, Kamil */ 1213b5c07418SJames Feist nlohmann::json queryNotSupported(void) 12141abe55efSEd Tanous { 1215fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1216b5c07418SJames Feist } 1217b5c07418SJames Feist 1218b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1219b5c07418SJames Feist { 1220b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1221b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1222f4c4dcf4SKowalski, Kamil } 1223f4c4dcf4SKowalski, Kamil 1224f4c4dcf4SKowalski, Kamil /** 1225f4c4dcf4SKowalski, Kamil * @internal 1226f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1227f4c4dcf4SKowalski, Kamil * 1228f4c4dcf4SKowalski, Kamil * See header file for more information 1229f4c4dcf4SKowalski, Kamil * @endinternal 1230f4c4dcf4SKowalski, Kamil */ 1231b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 12321abe55efSEd Tanous { 1233b6cd31e1SEd Tanous return getLog( 1234fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1235b5c07418SJames Feist } 1236b5c07418SJames Feist 1237b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1238b5c07418SJames Feist { 1239b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1240b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1241f4c4dcf4SKowalski, Kamil } 1242f4c4dcf4SKowalski, Kamil 1243f4c4dcf4SKowalski, Kamil /** 1244f4c4dcf4SKowalski, Kamil * @internal 1245f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1246f4c4dcf4SKowalski, Kamil * 1247f4c4dcf4SKowalski, Kamil * See header file for more information 1248f4c4dcf4SKowalski, Kamil * @endinternal 1249f4c4dcf4SKowalski, Kamil */ 1250b5c07418SJames Feist nlohmann::json generalError(void) 12511abe55efSEd Tanous { 1252fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1253b5c07418SJames Feist } 1254b5c07418SJames Feist 1255b5c07418SJames Feist void generalError(crow::Response& res) 1256b5c07418SJames Feist { 1257b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1258b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1259f4c4dcf4SKowalski, Kamil } 1260f4c4dcf4SKowalski, Kamil 1261f4c4dcf4SKowalski, Kamil /** 1262f4c4dcf4SKowalski, Kamil * @internal 1263f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1264f4c4dcf4SKowalski, Kamil * 1265f4c4dcf4SKowalski, Kamil * See header file for more information 1266f4c4dcf4SKowalski, Kamil * @endinternal 1267f4c4dcf4SKowalski, Kamil */ 1268b5c07418SJames Feist nlohmann::json success(void) 12691abe55efSEd Tanous { 1270fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1271b5c07418SJames Feist } 1272b5c07418SJames Feist 1273b5c07418SJames Feist void success(crow::Response& res) 1274b5c07418SJames Feist { 1275b5c07418SJames Feist // don't set res.result here because success is the default and any 1276b5c07418SJames Feist // error should overwrite the default 1277b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1278f12894f8SJason M. Bills } 1279f12894f8SJason M. Bills 1280f12894f8SJason M. Bills /** 1281f12894f8SJason M. Bills * @internal 1282f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1283f4c4dcf4SKowalski, Kamil * 1284f4c4dcf4SKowalski, Kamil * See header file for more information 1285f4c4dcf4SKowalski, Kamil * @endinternal 1286f4c4dcf4SKowalski, Kamil */ 1287b5c07418SJames Feist nlohmann::json created(void) 12881abe55efSEd Tanous { 1289fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1290b5c07418SJames Feist } 1291b5c07418SJames Feist 1292b5c07418SJames Feist void created(crow::Response& res) 1293b5c07418SJames Feist { 1294b5c07418SJames Feist res.result(boost::beast::http::status::created); 1295b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1296f4c4dcf4SKowalski, Kamil } 1297f4c4dcf4SKowalski, Kamil 1298f4c4dcf4SKowalski, Kamil /** 1299f4c4dcf4SKowalski, Kamil * @internal 1300cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1301cc9139ecSJason M. Bills * 1302cc9139ecSJason M. Bills * See header file for more information 1303cc9139ecSJason M. Bills * @endinternal 1304cc9139ecSJason M. Bills */ 1305b5c07418SJames Feist nlohmann::json noOperation(void) 1306cc9139ecSJason M. Bills { 1307fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1308b5c07418SJames Feist } 1309b5c07418SJames Feist 1310b5c07418SJames Feist void noOperation(crow::Response& res) 1311b5c07418SJames Feist { 1312b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1313b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1314cc9139ecSJason M. Bills } 1315cc9139ecSJason M. Bills 1316cc9139ecSJason M. Bills /** 1317cc9139ecSJason M. Bills * @internal 1318b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1319b5c07418SJames Feist * property 1320f12894f8SJason M. Bills * 1321f12894f8SJason M. Bills * See header file for more information 1322f12894f8SJason M. Bills * @endinternal 1323f12894f8SJason M. Bills */ 13241668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1325b5c07418SJames Feist { 1326fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 13271668ce6dSEd Tanous std::to_array({arg1})); 1328b5c07418SJames Feist } 1329b5c07418SJames Feist 13301668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1331f12894f8SJason M. Bills { 1332f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 13337b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1334f4c4dcf4SKowalski, Kamil } 1335f4c4dcf4SKowalski, Kamil 1336f4c4dcf4SKowalski, Kamil /** 1337f4c4dcf4SKowalski, Kamil * @internal 1338f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1339f4c4dcf4SKowalski, Kamil * 1340f4c4dcf4SKowalski, Kamil * See header file for more information 1341f4c4dcf4SKowalski, Kamil * @endinternal 1342f4c4dcf4SKowalski, Kamil */ 1343b5c07418SJames Feist nlohmann::json noValidSession(void) 13441abe55efSEd Tanous { 1345fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1346b5c07418SJames Feist } 1347b5c07418SJames Feist 1348b5c07418SJames Feist void noValidSession(crow::Response& res) 1349b5c07418SJames Feist { 1350b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1351b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1352f4c4dcf4SKowalski, Kamil } 1353f4c4dcf4SKowalski, Kamil 1354f4c4dcf4SKowalski, Kamil /** 1355f4c4dcf4SKowalski, Kamil * @internal 1356f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1357f4c4dcf4SKowalski, Kamil * 1358f4c4dcf4SKowalski, Kamil * See header file for more information 1359f4c4dcf4SKowalski, Kamil * @endinternal 1360f4c4dcf4SKowalski, Kamil */ 1361ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1) 13621abe55efSEd Tanous { 13631668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1364fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 13651668ce6dSEd Tanous std::to_array({arg1str})); 1366b5c07418SJames Feist } 1367b5c07418SJames Feist 1368ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1) 1369b5c07418SJames Feist { 1370b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1371b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1372f4c4dcf4SKowalski, Kamil } 1373f4c4dcf4SKowalski, Kamil 1374f4c4dcf4SKowalski, Kamil /** 1375f4c4dcf4SKowalski, Kamil * @internal 1376f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1377f4c4dcf4SKowalski, Kamil * 1378f4c4dcf4SKowalski, Kamil * See header file for more information 1379f4c4dcf4SKowalski, Kamil * @endinternal 1380f4c4dcf4SKowalski, Kamil */ 1381b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13821abe55efSEd Tanous { 1383fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1384b5c07418SJames Feist } 1385b5c07418SJames Feist 1386b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1387b5c07418SJames Feist { 1388b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1389b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1390f4c4dcf4SKowalski, Kamil } 1391f4c4dcf4SKowalski, Kamil 1392f4c4dcf4SKowalski, Kamil /** 1393f4c4dcf4SKowalski, Kamil * @internal 1394f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1395f4c4dcf4SKowalski, Kamil * 1396f4c4dcf4SKowalski, Kamil * See header file for more information 1397f4c4dcf4SKowalski, Kamil * @endinternal 1398f4c4dcf4SKowalski, Kamil */ 13991668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 14001668ce6dSEd Tanous std::string_view arg2, 14011668ce6dSEd Tanous std::string_view arg3) 14021abe55efSEd Tanous { 1403b6cd31e1SEd Tanous return getLog( 1404fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 14051668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1406b5c07418SJames Feist } 1407b5c07418SJames Feist 14081668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 14091668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1410b5c07418SJames Feist { 1411b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1412b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1413b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1414f4c4dcf4SKowalski, Kamil } 1415f4c4dcf4SKowalski, Kamil 1416f4c4dcf4SKowalski, Kamil /** 1417f4c4dcf4SKowalski, Kamil * @internal 1418f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1419f4c4dcf4SKowalski, Kamil * 1420f4c4dcf4SKowalski, Kamil * See header file for more information 1421f4c4dcf4SKowalski, Kamil * @endinternal 1422f4c4dcf4SKowalski, Kamil */ 1423b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 14241abe55efSEd Tanous { 1425fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1426b5c07418SJames Feist } 1427b5c07418SJames Feist 1428b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1429b5c07418SJames Feist { 1430b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1431b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1432f4c4dcf4SKowalski, Kamil } 1433f4c4dcf4SKowalski, Kamil 1434f4c4dcf4SKowalski, Kamil /** 1435f4c4dcf4SKowalski, Kamil * @internal 1436f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1437f4c4dcf4SKowalski, Kamil * 1438f4c4dcf4SKowalski, Kamil * See header file for more information 1439f4c4dcf4SKowalski, Kamil * @endinternal 1440f4c4dcf4SKowalski, Kamil */ 14411668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 14421abe55efSEd Tanous { 1443fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 14441668ce6dSEd Tanous std::to_array({arg1})); 1445b5c07418SJames Feist } 1446b5c07418SJames Feist 14471668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1448b5c07418SJames Feist { 1449b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1450b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1451f4c4dcf4SKowalski, Kamil } 1452f4c4dcf4SKowalski, Kamil 1453f4c4dcf4SKowalski, Kamil /** 1454f4c4dcf4SKowalski, Kamil * @internal 1455f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1456f4c4dcf4SKowalski, Kamil * 1457f4c4dcf4SKowalski, Kamil * See header file for more information 1458f4c4dcf4SKowalski, Kamil * @endinternal 1459f4c4dcf4SKowalski, Kamil */ 14605187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14611abe55efSEd Tanous { 1462b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1463fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14641668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1465b5c07418SJames Feist } 1466b5c07418SJames Feist 14675187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1468b5c07418SJames Feist { 1469b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1470b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1471f4c4dcf4SKowalski, Kamil } 1472f4c4dcf4SKowalski, Kamil 1473f4c4dcf4SKowalski, Kamil /** 1474f4c4dcf4SKowalski, Kamil * @internal 1475f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1476f4c4dcf4SKowalski, Kamil * 1477f4c4dcf4SKowalski, Kamil * See header file for more information 1478f4c4dcf4SKowalski, Kamil * @endinternal 1479f4c4dcf4SKowalski, Kamil */ 1480b5c07418SJames Feist nlohmann::json emptyJSON(void) 14811abe55efSEd Tanous { 1482fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1483b5c07418SJames Feist } 1484b5c07418SJames Feist 1485b5c07418SJames Feist void emptyJSON(crow::Response& res) 1486b5c07418SJames Feist { 1487b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1488b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1489f4c4dcf4SKowalski, Kamil } 1490f4c4dcf4SKowalski, Kamil 1491f4c4dcf4SKowalski, Kamil /** 1492f4c4dcf4SKowalski, Kamil * @internal 1493f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1494f4c4dcf4SKowalski, Kamil * 1495f4c4dcf4SKowalski, Kamil * See header file for more information 1496f4c4dcf4SKowalski, Kamil * @endinternal 1497f4c4dcf4SKowalski, Kamil */ 1498b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 14991abe55efSEd Tanous { 1500fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1501b6cd31e1SEd Tanous {}); 1502b5c07418SJames Feist } 1503b5c07418SJames Feist 1504b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1505b5c07418SJames Feist { 15066a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1507b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1508f4c4dcf4SKowalski, Kamil } 1509f4c4dcf4SKowalski, Kamil 1510f4c4dcf4SKowalski, Kamil /** 1511f4c4dcf4SKowalski, Kamil * @internal 1512684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1513684bb4b8SJason M. Bills * 1514684bb4b8SJason M. Bills * See header file for more information 1515684bb4b8SJason M. Bills * @endinternal 1516684bb4b8SJason M. Bills */ 1517684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1518684bb4b8SJason M. Bills { 1519b6cd31e1SEd Tanous return getLog( 1520fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1521684bb4b8SJason M. Bills } 1522684bb4b8SJason M. Bills 1523684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1524684bb4b8SJason M. Bills { 15256a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1526684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1527684bb4b8SJason M. Bills } 1528684bb4b8SJason M. Bills 1529684bb4b8SJason M. Bills /** 1530684bb4b8SJason M. Bills * @internal 1531684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1532684bb4b8SJason M. Bills * 1533684bb4b8SJason M. Bills * See header file for more information 1534684bb4b8SJason M. Bills * @endinternal 1535684bb4b8SJason M. Bills */ 1536684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1537684bb4b8SJason M. Bills { 1538fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1539fffb8c1fSEd Tanous {}); 1540684bb4b8SJason M. Bills } 1541684bb4b8SJason M. Bills 1542684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1543684bb4b8SJason M. Bills { 1544684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1545684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1546684bb4b8SJason M. Bills } 1547684bb4b8SJason M. Bills 1548684bb4b8SJason M. Bills /** 1549684bb4b8SJason M. Bills * @internal 1550f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1551f4c4dcf4SKowalski, Kamil * 1552f4c4dcf4SKowalski, Kamil * See header file for more information 1553f4c4dcf4SKowalski, Kamil * @endinternal 1554f4c4dcf4SKowalski, Kamil */ 1555b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15561abe55efSEd Tanous { 1557fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1558b5c07418SJames Feist } 1559b5c07418SJames Feist 1560b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1561b5c07418SJames Feist { 1562b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1563b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1564f4c4dcf4SKowalski, Kamil } 1565f4c4dcf4SKowalski, Kamil 1566f4c4dcf4SKowalski, Kamil /** 1567f4c4dcf4SKowalski, Kamil * @internal 1568f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1569f4c4dcf4SKowalski, Kamil * 1570f4c4dcf4SKowalski, Kamil * See header file for more information 1571f4c4dcf4SKowalski, Kamil * @endinternal 1572f4c4dcf4SKowalski, Kamil */ 15731668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15741668ce6dSEd Tanous std::string_view arg2) 1575b5c07418SJames Feist { 1576fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15771668ce6dSEd Tanous std::to_array({arg1, arg2})); 1578b5c07418SJames Feist } 1579b5c07418SJames Feist 15801668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15811668ce6dSEd Tanous std::string_view arg2) 15821abe55efSEd Tanous { 1583f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1584b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1585f4c4dcf4SKowalski, Kamil } 1586f4c4dcf4SKowalski, Kamil 1587f4c4dcf4SKowalski, Kamil /** 1588f4c4dcf4SKowalski, Kamil * @internal 1589f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1590f4c4dcf4SKowalski, Kamil * 1591f4c4dcf4SKowalski, Kamil * See header file for more information 1592f4c4dcf4SKowalski, Kamil * @endinternal 1593f4c4dcf4SKowalski, Kamil */ 1594b5c07418SJames Feist nlohmann::json accountNotModified(void) 15951abe55efSEd Tanous { 1596fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1597b5c07418SJames Feist } 1598b5c07418SJames Feist 1599b5c07418SJames Feist void accountNotModified(crow::Response& res) 1600b5c07418SJames Feist { 1601b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1602b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1603f4c4dcf4SKowalski, Kamil } 1604f4c4dcf4SKowalski, Kamil 1605f4c4dcf4SKowalski, Kamil /** 1606f4c4dcf4SKowalski, Kamil * @internal 1607f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1608f4c4dcf4SKowalski, Kamil * 1609f4c4dcf4SKowalski, Kamil * See header file for more information 1610f4c4dcf4SKowalski, Kamil * @endinternal 1611f4c4dcf4SKowalski, Kamil */ 16121668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 16131668ce6dSEd Tanous std::string_view arg2) 16141abe55efSEd Tanous { 1615fffb8c1fSEd Tanous return getLog( 1616fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 16171668ce6dSEd Tanous std::to_array({arg1, arg2})); 1618b5c07418SJames Feist } 1619b5c07418SJames Feist 16201668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 16211668ce6dSEd Tanous std::string_view arg2) 1622b5c07418SJames Feist { 1623b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1624b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1625b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1626f4c4dcf4SKowalski, Kamil } 1627f4c4dcf4SKowalski, Kamil 1628f4c4dcf4SKowalski, Kamil /** 1629f4c4dcf4SKowalski, Kamil * @internal 1630b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1631b5c07418SJames Feist * property 1632f12894f8SJason M. Bills * 1633f12894f8SJason M. Bills * See header file for more information 1634f12894f8SJason M. Bills * @endinternal 1635f12894f8SJason M. Bills */ 16361668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1637f12894f8SJason M. Bills { 1638fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 16391668ce6dSEd Tanous std::to_array({arg1})); 1640b5c07418SJames Feist } 1641b5c07418SJames Feist 16421668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1643b5c07418SJames Feist { 1644b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1645b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1646f4c4dcf4SKowalski, Kamil } 1647f4c4dcf4SKowalski, Kamil 1648f4c4dcf4SKowalski, Kamil /** 1649f4c4dcf4SKowalski, Kamil * @internal 1650f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1651f4c4dcf4SKowalski, Kamil * 1652f4c4dcf4SKowalski, Kamil * See header file for more information 1653f4c4dcf4SKowalski, Kamil * @endinternal 1654f4c4dcf4SKowalski, Kamil */ 16551668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16561abe55efSEd Tanous { 1657fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16581668ce6dSEd Tanous std::to_array({arg1})); 1659b5c07418SJames Feist } 1660b5c07418SJames Feist 16611668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1662b5c07418SJames Feist { 1663b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1664b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1665f4c4dcf4SKowalski, Kamil } 1666f4c4dcf4SKowalski, Kamil 1667f4c4dcf4SKowalski, Kamil /** 1668f4c4dcf4SKowalski, Kamil * @internal 1669f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1670f4c4dcf4SKowalski, Kamil * 1671f4c4dcf4SKowalski, Kamil * See header file for more information 1672f4c4dcf4SKowalski, Kamil * @endinternal 1673f4c4dcf4SKowalski, Kamil */ 1674b5c07418SJames Feist nlohmann::json accountModified(void) 16751abe55efSEd Tanous { 1676fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1677b5c07418SJames Feist } 1678b5c07418SJames Feist 1679b5c07418SJames Feist void accountModified(crow::Response& res) 1680b5c07418SJames Feist { 1681b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1682b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1683f4c4dcf4SKowalski, Kamil } 1684f4c4dcf4SKowalski, Kamil 1685f4c4dcf4SKowalski, Kamil /** 1686f4c4dcf4SKowalski, Kamil * @internal 1687f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1688f4c4dcf4SKowalski, Kamil * 1689f4c4dcf4SKowalski, Kamil * See header file for more information 1690f4c4dcf4SKowalski, Kamil * @endinternal 1691f4c4dcf4SKowalski, Kamil */ 16921668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 16931668ce6dSEd Tanous std::string_view arg2, 16941668ce6dSEd Tanous std::string_view arg3) 16951abe55efSEd Tanous { 1696fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 16971668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1698b5c07418SJames Feist } 1699b5c07418SJames Feist 17001668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 17011668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1702b5c07418SJames Feist { 1703b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1704b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1705b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1706f4c4dcf4SKowalski, Kamil } 1707f4c4dcf4SKowalski, Kamil 1708b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1) 1709b6cd31e1SEd Tanous { 17101668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1711fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 17121668ce6dSEd Tanous std::to_array({arg1str})); 1713b6cd31e1SEd Tanous } 1714b6cd31e1SEd Tanous 17153bf4e632SJoseph Reynolds /** 17163bf4e632SJoseph Reynolds * @internal 17173bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 17183bf4e632SJoseph Reynolds * 17193bf4e632SJoseph Reynolds * See header file for more information 17203bf4e632SJoseph Reynolds * @endinternal 17213bf4e632SJoseph Reynolds */ 1722ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res, 1723ace85d60SEd Tanous const boost::urls::url_view& arg1) 17243bf4e632SJoseph Reynolds { 1725b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 17263bf4e632SJoseph Reynolds } 17273bf4e632SJoseph Reynolds 17284cde5d90SJames Feist /** 17294cde5d90SJames Feist * @internal 1730ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1731ae688313SNan Zhou * 1732ae688313SNan Zhou * See header file for more information 1733ae688313SNan Zhou * @endinternal 1734ae688313SNan Zhou */ 1735ae688313SNan Zhou nlohmann::json insufficientStorage() 1736ae688313SNan Zhou { 1737ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1738ae688313SNan Zhou } 1739ae688313SNan Zhou 1740ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1741ae688313SNan Zhou { 1742ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1743ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1744ae688313SNan Zhou } 1745ae688313SNan Zhou 1746ae688313SNan Zhou /** 1747ae688313SNan Zhou * @internal 174844c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 174944c70412SEd Tanous * 175044c70412SEd Tanous * See header file for more information 175144c70412SEd Tanous * @endinternal 175244c70412SEd Tanous */ 175344c70412SEd Tanous nlohmann::json operationNotAllowed() 175444c70412SEd Tanous { 175544c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 175644c70412SEd Tanous } 175744c70412SEd Tanous 175844c70412SEd Tanous void operationNotAllowed(crow::Response& res) 175944c70412SEd Tanous { 176044c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 176144c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 176244c70412SEd Tanous } 176344c70412SEd Tanous 176444c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 176544c70412SEd Tanous std::string_view arg2) 176644c70412SEd Tanous { 176744c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 176844c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 176944c70412SEd Tanous } 177044c70412SEd Tanous 177144c70412SEd Tanous /** 177244c70412SEd Tanous * @internal 17734cde5d90SJames Feist * @brief Formats Invalid File message into JSON 17744cde5d90SJames Feist * 17754cde5d90SJames Feist * See header file for more information 17764cde5d90SJames Feist * @endinternal 17774cde5d90SJames Feist */ 17781668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 17794cde5d90SJames Feist { 17801668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 17811668ce6dSEd Tanous msg += arg1; 17821668ce6dSEd Tanous msg += ": "; 17831668ce6dSEd Tanous msg += arg2; 17841668ce6dSEd Tanous msg += "."; 1785613dabeaSEd Tanous 1786613dabeaSEd Tanous nlohmann::json::object_t ret; 1787613dabeaSEd Tanous ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message"; 1788613dabeaSEd Tanous ret["MessageId"] = "OpenBMC.0.2.InvalidUpload"; 1789613dabeaSEd Tanous ret["Message"] = std::move(msg); 1790613dabeaSEd Tanous nlohmann::json::array_t args; 1791613dabeaSEd Tanous args.push_back(arg1); 1792613dabeaSEd Tanous args.push_back(arg2); 1793613dabeaSEd Tanous ret["MessageArgs"] = std::move(args); 1794613dabeaSEd Tanous ret["MessageSeverity"] = "Warning"; 1795613dabeaSEd Tanous ret["Resolution"] = "None."; 1796613dabeaSEd Tanous return ret; 17974cde5d90SJames Feist } 1798ae688313SNan Zhou 1799f4c4dcf4SKowalski, Kamil } // namespace messages 1800f4c4dcf4SKowalski, Kamil 1801d425c6f6SEd Tanous } // namespace redfish 1802