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 { 209*079360aeSEd Tanous std::array<std::string_view, 1> args{arg1.buffer()}; 210fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 211b5c07418SJames Feist } 212b5c07418SJames Feist 213ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res, 214ace85d60SEd Tanous const boost::urls::url_view& arg1) 215b5c07418SJames Feist { 216b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 217b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 218f4c4dcf4SKowalski, Kamil } 219f4c4dcf4SKowalski, Kamil 220f4c4dcf4SKowalski, Kamil /** 221f4c4dcf4SKowalski, Kamil * @internal 222f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 223f4c4dcf4SKowalski, Kamil * 224f4c4dcf4SKowalski, Kamil * See header file for more information 225f4c4dcf4SKowalski, Kamil * @endinternal 226f4c4dcf4SKowalski, Kamil */ 2271668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2281668ce6dSEd Tanous std::string_view arg2, 2291668ce6dSEd Tanous std::string_view arg3) 2301abe55efSEd Tanous { 231fffb8c1fSEd Tanous return getLog( 232fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2331668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 234b5c07418SJames Feist } 235b5c07418SJames Feist 2361668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2371668ce6dSEd Tanous std::string_view arg2, 2381668ce6dSEd Tanous std::string_view arg3) 239b5c07418SJames Feist { 240b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 241b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 242b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 243f4c4dcf4SKowalski, Kamil } 244f4c4dcf4SKowalski, Kamil 245f4c4dcf4SKowalski, Kamil /** 246f4c4dcf4SKowalski, Kamil * @internal 247f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 248f4c4dcf4SKowalski, Kamil * 249f4c4dcf4SKowalski, Kamil * See header file for more information 250f4c4dcf4SKowalski, Kamil * @endinternal 251f4c4dcf4SKowalski, Kamil */ 252b5c07418SJames Feist nlohmann::json internalError(void) 2531abe55efSEd Tanous { 254fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 255b5c07418SJames Feist } 256b5c07418SJames Feist 257df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 258b5c07418SJames Feist { 259df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 260df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 261df5415fcSEd Tanous << location.function_name() << "`: "; 262b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 263b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 264f12894f8SJason M. Bills } 265f12894f8SJason M. Bills 266f12894f8SJason M. Bills /** 267f12894f8SJason M. Bills * @internal 268f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 269f4c4dcf4SKowalski, Kamil * 270f4c4dcf4SKowalski, Kamil * See header file for more information 271f4c4dcf4SKowalski, Kamil * @endinternal 272f4c4dcf4SKowalski, Kamil */ 273b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2741abe55efSEd Tanous { 275fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 276fffb8c1fSEd Tanous {}); 277b5c07418SJames Feist } 278b5c07418SJames Feist 279b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 280b5c07418SJames Feist { 281b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 282b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 283f4c4dcf4SKowalski, Kamil } 284f4c4dcf4SKowalski, Kamil 285f4c4dcf4SKowalski, Kamil /** 286f4c4dcf4SKowalski, Kamil * @internal 287f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 288f4c4dcf4SKowalski, Kamil * 289f4c4dcf4SKowalski, Kamil * See header file for more information 290f4c4dcf4SKowalski, Kamil * @endinternal 291f4c4dcf4SKowalski, Kamil */ 292ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 2931668ce6dSEd Tanous std::string_view arg2) 2941abe55efSEd Tanous { 295*079360aeSEd Tanous return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, 296*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 297b5c07418SJames Feist } 298b5c07418SJames Feist 299ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 300ace85d60SEd Tanous const boost::urls::url_view& arg1, 3011668ce6dSEd Tanous std::string_view arg2) 302b5c07418SJames Feist { 303b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 304b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 305f4c4dcf4SKowalski, Kamil } 306f4c4dcf4SKowalski, Kamil 307f4c4dcf4SKowalski, Kamil /** 308f4c4dcf4SKowalski, Kamil * @internal 309f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 310f4c4dcf4SKowalski, Kamil * 311f4c4dcf4SKowalski, Kamil * See header file for more information 312f4c4dcf4SKowalski, Kamil * @endinternal 313f4c4dcf4SKowalski, Kamil */ 3141668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 3151668ce6dSEd Tanous std::string_view arg2) 316b5c07418SJames Feist { 317fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 3181668ce6dSEd Tanous std::to_array({arg1, arg2})); 319b5c07418SJames Feist } 320b5c07418SJames Feist 3211668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3221668ce6dSEd Tanous std::string_view arg2) 3231abe55efSEd Tanous { 324f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 325b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 326f4c4dcf4SKowalski, Kamil } 327f4c4dcf4SKowalski, Kamil 328f4c4dcf4SKowalski, Kamil /** 329f4c4dcf4SKowalski, Kamil * @internal 330f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 331f4c4dcf4SKowalski, Kamil * 332f4c4dcf4SKowalski, Kamil * See header file for more information 333f4c4dcf4SKowalski, Kamil * @endinternal 334f4c4dcf4SKowalski, Kamil */ 335b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3361abe55efSEd Tanous { 337fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 338fffb8c1fSEd Tanous {}); 339b5c07418SJames Feist } 340b5c07418SJames Feist 341b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 342b5c07418SJames Feist { 34344c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 344b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 345f4c4dcf4SKowalski, Kamil } 346f4c4dcf4SKowalski, Kamil 347f4c4dcf4SKowalski, Kamil /** 348f4c4dcf4SKowalski, Kamil * @internal 349f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 350f4c4dcf4SKowalski, Kamil * 351f4c4dcf4SKowalski, Kamil * See header file for more information 352f4c4dcf4SKowalski, Kamil * @endinternal 353f4c4dcf4SKowalski, Kamil */ 3541668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3551abe55efSEd Tanous { 356fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3571668ce6dSEd Tanous std::to_array({arg1})); 358b5c07418SJames Feist } 359b5c07418SJames Feist 3601668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 361b5c07418SJames Feist { 362b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 363b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 364f4c4dcf4SKowalski, Kamil } 365f4c4dcf4SKowalski, Kamil 366f4c4dcf4SKowalski, Kamil /** 367f4c4dcf4SKowalski, Kamil * @internal 368f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 369f4c4dcf4SKowalski, Kamil * 370f4c4dcf4SKowalski, Kamil * See header file for more information 371f4c4dcf4SKowalski, Kamil * @endinternal 372f4c4dcf4SKowalski, Kamil */ 3731668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3741abe55efSEd Tanous { 375b6cd31e1SEd Tanous return getLog( 376fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3771668ce6dSEd Tanous std::to_array({arg1})); 378b5c07418SJames Feist } 379b5c07418SJames Feist 3801668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 381b5c07418SJames Feist { 382d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 383b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 384b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 385f4c4dcf4SKowalski, Kamil } 386f4c4dcf4SKowalski, Kamil 387f4c4dcf4SKowalski, Kamil /** 388f4c4dcf4SKowalski, Kamil * @internal 389f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 390f4c4dcf4SKowalski, Kamil * 391f4c4dcf4SKowalski, Kamil * See header file for more information 392f4c4dcf4SKowalski, Kamil * @endinternal 393f4c4dcf4SKowalski, Kamil */ 3941668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 3951668ce6dSEd Tanous std::string_view arg2, 3961668ce6dSEd Tanous std::string_view arg3) 3971abe55efSEd Tanous { 398fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 3991668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 400b5c07418SJames Feist } 401b5c07418SJames Feist 4021668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 4031668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 404b5c07418SJames Feist { 405b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 406b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 407a08b46ccSJason M. Bills arg2); 408f4c4dcf4SKowalski, Kamil } 409f4c4dcf4SKowalski, Kamil 410f4c4dcf4SKowalski, Kamil /** 411f4c4dcf4SKowalski, Kamil * @internal 412f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 413f4c4dcf4SKowalski, Kamil * 414f4c4dcf4SKowalski, Kamil * See header file for more information 415f4c4dcf4SKowalski, Kamil * @endinternal 416f4c4dcf4SKowalski, Kamil */ 417b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4181abe55efSEd Tanous { 419fffb8c1fSEd Tanous return getLog( 420fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 421b5c07418SJames Feist } 422b5c07418SJames Feist 423b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 424b5c07418SJames Feist { 425b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 426b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 427f4c4dcf4SKowalski, Kamil } 428f4c4dcf4SKowalski, Kamil 429f4c4dcf4SKowalski, Kamil /** 430f4c4dcf4SKowalski, Kamil * @internal 431f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 432f4c4dcf4SKowalski, Kamil * 433f4c4dcf4SKowalski, Kamil * See header file for more information 434f4c4dcf4SKowalski, Kamil * @endinternal 435f4c4dcf4SKowalski, Kamil */ 4361668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4371abe55efSEd Tanous { 438fffb8c1fSEd Tanous return getLog( 439fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4401668ce6dSEd Tanous std::to_array({arg1})); 441b5c07418SJames Feist } 442b5c07418SJames Feist 443b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4441668ce6dSEd Tanous std::string_view arg1) 445b5c07418SJames Feist { 446b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 447b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 448a08b46ccSJason M. Bills arg1); 449f12894f8SJason M. Bills } 450f12894f8SJason M. Bills 451f12894f8SJason M. Bills /** 452f12894f8SJason M. Bills * @internal 453f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 454f12894f8SJason M. Bills * property 455f12894f8SJason M. Bills * 456f12894f8SJason M. Bills * See header file for more information 457f12894f8SJason M. Bills * @endinternal 458f12894f8SJason M. Bills */ 4591668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4601668ce6dSEd Tanous std::string_view arg2) 461f12894f8SJason M. Bills { 462fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4631668ce6dSEd Tanous std::to_array({arg1, arg2})); 464b5c07418SJames Feist } 465b5c07418SJames Feist 4661668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4671668ce6dSEd Tanous std::string_view arg2) 468b5c07418SJames Feist { 469b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 470b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 471f12894f8SJason M. Bills } 472f12894f8SJason M. Bills 473f12894f8SJason M. Bills /** 474f12894f8SJason M. Bills * @internal 475f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList 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 propertyValueNotInList(std::string_view arg1, 4821668ce6dSEd Tanous std::string_view arg2) 483f12894f8SJason M. Bills { 484fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 4851668ce6dSEd Tanous std::to_array({arg1, arg2})); 486b5c07418SJames Feist } 487b5c07418SJames Feist 4881668ce6dSEd Tanous void propertyValueNotInList(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, propertyValueNotInList(arg1, arg2), arg2); 493f4c4dcf4SKowalski, Kamil } 494f4c4dcf4SKowalski, Kamil 495f4c4dcf4SKowalski, Kamil /** 496f4c4dcf4SKowalski, Kamil * @internal 497227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 498227a2b0aSJiaqing Zhao * 499227a2b0aSJiaqing Zhao * See header file for more information 500227a2b0aSJiaqing Zhao * @endinternal 501227a2b0aSJiaqing Zhao */ 502227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 503227a2b0aSJiaqing Zhao std::string_view arg2) 504227a2b0aSJiaqing Zhao { 505227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 506227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 507227a2b0aSJiaqing Zhao } 508227a2b0aSJiaqing Zhao 509227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 510227a2b0aSJiaqing Zhao std::string_view arg2) 511227a2b0aSJiaqing Zhao { 512227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 513227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 514227a2b0aSJiaqing Zhao } 515227a2b0aSJiaqing Zhao 516227a2b0aSJiaqing Zhao /** 517227a2b0aSJiaqing Zhao * @internal 518f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 519f4c4dcf4SKowalski, Kamil * 520f4c4dcf4SKowalski, Kamil * See header file for more information 521f4c4dcf4SKowalski, Kamil * @endinternal 522f4c4dcf4SKowalski, Kamil */ 523ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1) 5241abe55efSEd Tanous { 525b6cd31e1SEd Tanous return getLog( 526fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 527*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 528b5c07418SJames Feist } 529b5c07418SJames Feist 530ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 531ace85d60SEd Tanous const boost::urls::url_view& arg1) 532b5c07418SJames Feist { 533b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 534b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 535f4c4dcf4SKowalski, Kamil } 536f4c4dcf4SKowalski, Kamil 537f4c4dcf4SKowalski, Kamil /** 538f4c4dcf4SKowalski, Kamil * @internal 53981856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 54081856681SAsmitha Karunanithi * 54181856681SAsmitha Karunanithi * See header file for more information 54281856681SAsmitha Karunanithi * @endinternal 54381856681SAsmitha Karunanithi */ 5441668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 54581856681SAsmitha Karunanithi { 546fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5471668ce6dSEd Tanous std::to_array({arg1})); 54881856681SAsmitha Karunanithi } 54981856681SAsmitha Karunanithi 5501668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 55181856681SAsmitha Karunanithi { 55281856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 55381856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 55481856681SAsmitha Karunanithi } 55581856681SAsmitha Karunanithi 55681856681SAsmitha Karunanithi /** 55781856681SAsmitha Karunanithi * @internal 558f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 559f4c4dcf4SKowalski, Kamil * 560f4c4dcf4SKowalski, Kamil * See header file for more information 561f4c4dcf4SKowalski, Kamil * @endinternal 562f4c4dcf4SKowalski, Kamil */ 563b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5641abe55efSEd Tanous { 565fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 566b5c07418SJames Feist } 567b5c07418SJames Feist 568b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 569b5c07418SJames Feist { 570b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 571b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 572f4c4dcf4SKowalski, Kamil } 573f4c4dcf4SKowalski, Kamil 574f4c4dcf4SKowalski, Kamil /** 575f4c4dcf4SKowalski, Kamil * @internal 576f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 577f4c4dcf4SKowalski, Kamil * 578f4c4dcf4SKowalski, Kamil * See header file for more information 579f4c4dcf4SKowalski, Kamil * @endinternal 580f4c4dcf4SKowalski, Kamil */ 581b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 5821abe55efSEd Tanous { 583fffb8c1fSEd Tanous return getLog( 584fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 585b5c07418SJames Feist } 586b5c07418SJames Feist 587b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 588b5c07418SJames Feist { 589789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 590b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 591f4c4dcf4SKowalski, Kamil } 592f4c4dcf4SKowalski, Kamil 593f4c4dcf4SKowalski, Kamil /** 594f4c4dcf4SKowalski, Kamil * @internal 595f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 596f4c4dcf4SKowalski, Kamil * 597f4c4dcf4SKowalski, Kamil * See header file for more information 598f4c4dcf4SKowalski, Kamil * @endinternal 599f4c4dcf4SKowalski, Kamil */ 6001668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 6011668ce6dSEd Tanous std::string_view arg2) 6021abe55efSEd Tanous { 603fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 6041668ce6dSEd Tanous std::to_array({arg1, arg2})); 605b5c07418SJames Feist } 606b5c07418SJames Feist 6071668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 6081668ce6dSEd Tanous std::string_view arg2) 609b5c07418SJames Feist { 610b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 611b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 612f4c4dcf4SKowalski, Kamil } 613f4c4dcf4SKowalski, Kamil 614f4c4dcf4SKowalski, Kamil /** 615f4c4dcf4SKowalski, Kamil * @internal 616f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 617f4c4dcf4SKowalski, Kamil * 618f4c4dcf4SKowalski, Kamil * See header file for more information 619f4c4dcf4SKowalski, Kamil * @endinternal 620f4c4dcf4SKowalski, Kamil */ 6211668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 6221abe55efSEd Tanous { 623b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 624fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 6251668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 626b5c07418SJames Feist } 627b5c07418SJames Feist 6281668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 629b5c07418SJames Feist { 630b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 631b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 632f4c4dcf4SKowalski, Kamil } 633f4c4dcf4SKowalski, Kamil 634f4c4dcf4SKowalski, Kamil /** 635f4c4dcf4SKowalski, Kamil * @internal 636cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 637cc9139ecSJason M. Bills * 638cc9139ecSJason M. Bills * See header file for more information 639cc9139ecSJason M. Bills * @endinternal 640cc9139ecSJason M. Bills */ 641b5c07418SJames Feist nlohmann::json sessionTerminated(void) 642cc9139ecSJason M. Bills { 643fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 644b5c07418SJames Feist } 645b5c07418SJames Feist 646b5c07418SJames Feist void sessionTerminated(crow::Response& res) 647b5c07418SJames Feist { 648b5c07418SJames Feist res.result(boost::beast::http::status::ok); 649b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 650cc9139ecSJason M. Bills } 651cc9139ecSJason M. Bills 652cc9139ecSJason M. Bills /** 653cc9139ecSJason M. Bills * @internal 654684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 655684bb4b8SJason M. Bills * 656684bb4b8SJason M. Bills * See header file for more information 657684bb4b8SJason M. Bills * @endinternal 658684bb4b8SJason M. Bills */ 659684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 660684bb4b8SJason M. Bills { 661fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 662684bb4b8SJason M. Bills } 663684bb4b8SJason M. Bills 664684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 665684bb4b8SJason M. Bills { 666684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 667684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 668684bb4b8SJason M. Bills } 669684bb4b8SJason M. Bills 670684bb4b8SJason M. Bills /** 671684bb4b8SJason M. Bills * @internal 672cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 673cc9139ecSJason M. Bills * 674cc9139ecSJason M. Bills * See header file for more information 675cc9139ecSJason M. Bills * @endinternal 676cc9139ecSJason M. Bills */ 6771668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 6781668ce6dSEd Tanous std::string_view arg2) 679cc9139ecSJason M. Bills { 680fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 6811668ce6dSEd Tanous std::to_array({arg1, arg2})); 682b5c07418SJames Feist } 683b5c07418SJames Feist 6841668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 6851668ce6dSEd Tanous std::string_view arg2) 686b5c07418SJames Feist { 687b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 688b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 689cc9139ecSJason M. Bills } 690cc9139ecSJason M. Bills 691cc9139ecSJason M. Bills /** 692cc9139ecSJason M. Bills * @internal 693684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 694684bb4b8SJason M. Bills * 695684bb4b8SJason M. Bills * See header file for more information 696684bb4b8SJason M. Bills * @endinternal 697684bb4b8SJason M. Bills */ 698ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1, 6991668ce6dSEd Tanous std::string_view arg2) 700684bb4b8SJason M. Bills { 701fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 702*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 703684bb4b8SJason M. Bills } 704684bb4b8SJason M. Bills 705ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 7061668ce6dSEd Tanous std::string_view arg2) 707684bb4b8SJason M. Bills { 708684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 709684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 710684bb4b8SJason M. Bills } 711684bb4b8SJason M. Bills 712684bb4b8SJason M. Bills /** 713684bb4b8SJason M. Bills * @internal 714684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 715684bb4b8SJason M. Bills * 716684bb4b8SJason M. Bills * See header file for more information 717684bb4b8SJason M. Bills * @endinternal 718684bb4b8SJason M. Bills */ 7191668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 720684bb4b8SJason M. Bills { 721fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7221668ce6dSEd Tanous std::to_array({arg1})); 723684bb4b8SJason M. Bills } 724684bb4b8SJason M. Bills 7251668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 726684bb4b8SJason M. Bills { 727684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 728684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 729684bb4b8SJason M. Bills } 730684bb4b8SJason M. Bills 731684bb4b8SJason M. Bills /** 732684bb4b8SJason M. Bills * @internal 733684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 734684bb4b8SJason M. Bills * 735684bb4b8SJason M. Bills * See header file for more information 736684bb4b8SJason M. Bills * @endinternal 737684bb4b8SJason M. Bills */ 7381668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 739684bb4b8SJason M. Bills { 740b6cd31e1SEd Tanous return getLog( 741fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7421668ce6dSEd Tanous std::to_array({arg1})); 743684bb4b8SJason M. Bills } 744684bb4b8SJason M. Bills 7451668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 746684bb4b8SJason M. Bills { 747684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 748684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 749684bb4b8SJason M. Bills } 750684bb4b8SJason M. Bills 751684bb4b8SJason M. Bills /** 752684bb4b8SJason M. Bills * @internal 753684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 754684bb4b8SJason M. Bills * 755684bb4b8SJason M. Bills * See header file for more information 756684bb4b8SJason M. Bills * @endinternal 757684bb4b8SJason M. Bills */ 7581668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7591668ce6dSEd Tanous std::string_view arg2) 760684bb4b8SJason M. Bills { 761fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7621668ce6dSEd Tanous std::to_array({arg1, arg2})); 763684bb4b8SJason M. Bills } 764684bb4b8SJason M. Bills 7651668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7661668ce6dSEd Tanous std::string_view arg2) 767684bb4b8SJason M. Bills { 768684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 769684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 770684bb4b8SJason M. Bills } 771684bb4b8SJason M. Bills 772684bb4b8SJason M. Bills /** 773684bb4b8SJason M. Bills * @internal 7742a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7752a6af81cSRamesh Iyyar * 7762a6af81cSRamesh Iyyar * See header file for more information 7772a6af81cSRamesh Iyyar * @endinternal 7782a6af81cSRamesh Iyyar */ 7792a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 7802a6af81cSRamesh Iyyar std::string_view arg2, 7812a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7822a6af81cSRamesh Iyyar { 7832a6af81cSRamesh Iyyar return getLog( 7842a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 785*079360aeSEd Tanous std::to_array<std::string_view>({arg1, arg2, arg3.buffer()})); 7862a6af81cSRamesh Iyyar } 7872a6af81cSRamesh Iyyar 7882a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 7892a6af81cSRamesh Iyyar std::string_view arg2, 7902a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7912a6af81cSRamesh Iyyar { 7922a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 7932a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 7942a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 7952a6af81cSRamesh Iyyar } 7962a6af81cSRamesh Iyyar 7972a6af81cSRamesh Iyyar /** 7982a6af81cSRamesh Iyyar * @internal 79924861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 80024861a28SRamesh Iyyar * 80124861a28SRamesh Iyyar * See header file for more information 80224861a28SRamesh Iyyar * @endinternal 80324861a28SRamesh Iyyar */ 80424861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 80524861a28SRamesh Iyyar std::string_view arg2) 80624861a28SRamesh Iyyar { 80724861a28SRamesh Iyyar return getLog( 80824861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 80924861a28SRamesh Iyyar std::to_array({arg1, arg2})); 81024861a28SRamesh Iyyar } 81124861a28SRamesh Iyyar 81224861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 81324861a28SRamesh Iyyar std::string_view arg2) 81424861a28SRamesh Iyyar { 81524861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 81624861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 81724861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 81824861a28SRamesh Iyyar } 81924861a28SRamesh Iyyar 82024861a28SRamesh Iyyar /** 82124861a28SRamesh Iyyar * @internal 822684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 823684bb4b8SJason M. Bills * 824684bb4b8SJason M. Bills * See header file for more information 825684bb4b8SJason M. Bills * @endinternal 826684bb4b8SJason M. Bills */ 8271668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8281668ce6dSEd Tanous std::string_view arg2) 829684bb4b8SJason M. Bills { 830fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8311668ce6dSEd Tanous std::to_array({arg1, arg2})); 832684bb4b8SJason M. Bills } 833684bb4b8SJason M. Bills 8341668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8351668ce6dSEd Tanous std::string_view arg2) 836684bb4b8SJason M. Bills { 837684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 838684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 839684bb4b8SJason M. Bills } 840684bb4b8SJason M. Bills 841684bb4b8SJason M. Bills /** 842684bb4b8SJason M. Bills * @internal 843684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 844684bb4b8SJason M. Bills * 845684bb4b8SJason M. Bills * See header file for more information 846684bb4b8SJason M. Bills * @endinternal 847684bb4b8SJason M. Bills */ 848ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1) 849684bb4b8SJason M. Bills { 850fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 851*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 852684bb4b8SJason M. Bills } 853684bb4b8SJason M. Bills 854ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res, 855ace85d60SEd Tanous const boost::urls::url_view& arg1) 856684bb4b8SJason M. Bills { 857684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 858684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 859684bb4b8SJason M. Bills } 860684bb4b8SJason M. Bills 861684bb4b8SJason M. Bills /** 862684bb4b8SJason M. Bills * @internal 863684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 864684bb4b8SJason M. Bills * 865684bb4b8SJason M. Bills * See header file for more information 866684bb4b8SJason M. Bills * @endinternal 867684bb4b8SJason M. Bills */ 868684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 869684bb4b8SJason M. Bills { 870fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 871684bb4b8SJason M. Bills } 872684bb4b8SJason M. Bills 873684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 874684bb4b8SJason M. Bills { 875684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 876684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 877684bb4b8SJason M. Bills } 878684bb4b8SJason M. Bills 879684bb4b8SJason M. Bills /** 880684bb4b8SJason M. Bills * @internal 881684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 882684bb4b8SJason M. Bills * 883684bb4b8SJason M. Bills * See header file for more information 884684bb4b8SJason M. Bills * @endinternal 885684bb4b8SJason M. Bills */ 886684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 887684bb4b8SJason M. Bills { 888fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 889684bb4b8SJason M. Bills } 890684bb4b8SJason M. Bills 891684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 892684bb4b8SJason M. Bills { 8934df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 894684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 895684bb4b8SJason M. Bills } 896684bb4b8SJason M. Bills 897684bb4b8SJason M. Bills /** 898684bb4b8SJason M. Bills * @internal 899684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 900684bb4b8SJason M. Bills * 901684bb4b8SJason M. Bills * See header file for more information 902684bb4b8SJason M. Bills * @endinternal 903684bb4b8SJason M. Bills */ 904684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 905684bb4b8SJason M. Bills { 906fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 907684bb4b8SJason M. Bills } 908684bb4b8SJason M. Bills 909684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 910684bb4b8SJason M. Bills { 911684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 912684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 913684bb4b8SJason M. Bills } 914684bb4b8SJason M. Bills 915684bb4b8SJason M. Bills /** 916684bb4b8SJason M. Bills * @internal 917684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 918684bb4b8SJason M. Bills * 919684bb4b8SJason M. Bills * See header file for more information 920684bb4b8SJason M. Bills * @endinternal 921684bb4b8SJason M. Bills */ 922684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 923684bb4b8SJason M. Bills { 924fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 925684bb4b8SJason M. Bills } 926684bb4b8SJason M. Bills 927684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 928684bb4b8SJason M. Bills { 9298868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 930684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 931684bb4b8SJason M. Bills } 932684bb4b8SJason M. Bills 933684bb4b8SJason M. Bills /** 934684bb4b8SJason M. Bills * @internal 935684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 936684bb4b8SJason M. Bills * 937684bb4b8SJason M. Bills * See header file for more information 938684bb4b8SJason M. Bills * @endinternal 939684bb4b8SJason M. Bills */ 940684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 941684bb4b8SJason M. Bills { 942fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 943684bb4b8SJason M. Bills } 944684bb4b8SJason M. Bills 945684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 946684bb4b8SJason M. Bills { 947684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 948684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 949684bb4b8SJason M. Bills } 950684bb4b8SJason M. Bills 951684bb4b8SJason M. Bills /** 952684bb4b8SJason M. Bills * @internal 953f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 954f12894f8SJason M. Bills * property 955f12894f8SJason M. Bills * 956f12894f8SJason M. Bills * See header file for more information 957f12894f8SJason M. Bills * @endinternal 958f12894f8SJason M. Bills */ 9591668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 9601668ce6dSEd Tanous std::string_view arg2) 961f12894f8SJason M. Bills { 962fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9631668ce6dSEd Tanous std::to_array({arg1, arg2})); 964b5c07418SJames Feist } 965b5c07418SJames Feist 9661668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9671668ce6dSEd Tanous std::string_view arg2) 968b5c07418SJames Feist { 969b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 970b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 971f4c4dcf4SKowalski, Kamil } 972f4c4dcf4SKowalski, Kamil 973f4c4dcf4SKowalski, Kamil /** 974f4c4dcf4SKowalski, Kamil * @internal 975b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 976f4c4dcf4SKowalski, Kamil * 977f4c4dcf4SKowalski, Kamil * See header file for more information 978f4c4dcf4SKowalski, Kamil * @endinternal 979f4c4dcf4SKowalski, Kamil */ 9801668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 9811abe55efSEd Tanous { 982fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 9831668ce6dSEd Tanous std::to_array({arg1, arg2})); 984b5c07418SJames Feist } 985b5c07418SJames Feist 9861668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 9871668ce6dSEd Tanous std::string_view arg2) 988b5c07418SJames Feist { 989b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 990b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 991f4c4dcf4SKowalski, Kamil } 992f4c4dcf4SKowalski, Kamil 993f4c4dcf4SKowalski, Kamil /** 994f4c4dcf4SKowalski, Kamil * @internal 995f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 996f4c4dcf4SKowalski, Kamil * 997f4c4dcf4SKowalski, Kamil * See header file for more information 998f4c4dcf4SKowalski, Kamil * @endinternal 999f4c4dcf4SKowalski, Kamil */ 1000ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1) 10011abe55efSEd Tanous { 1002fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 1003*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1004b5c07418SJames Feist } 1005b5c07418SJames Feist 1006ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1007ace85d60SEd Tanous const boost::urls::url_view& arg1) 1008b5c07418SJames Feist { 1009b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1010b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1011f4c4dcf4SKowalski, Kamil } 1012f4c4dcf4SKowalski, Kamil 1013f4c4dcf4SKowalski, Kamil /** 1014f4c4dcf4SKowalski, Kamil * @internal 1015f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1016f12894f8SJason M. Bills * property 1017f12894f8SJason M. Bills * 1018f12894f8SJason M. Bills * See header file for more information 1019f12894f8SJason M. Bills * @endinternal 1020f12894f8SJason M. Bills */ 10211668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 1022f12894f8SJason M. Bills { 1023fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 10241668ce6dSEd Tanous std::to_array({arg1})); 1025b5c07418SJames Feist } 1026b5c07418SJames Feist 10271668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1028b5c07418SJames Feist { 1029b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1030b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1031f4c4dcf4SKowalski, Kamil } 1032f4c4dcf4SKowalski, Kamil 1033f4c4dcf4SKowalski, Kamil /** 1034f4c4dcf4SKowalski, Kamil * @internal 1035f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1036f4c4dcf4SKowalski, Kamil * 1037f4c4dcf4SKowalski, Kamil * See header file for more information 1038f4c4dcf4SKowalski, Kamil * @endinternal 1039f4c4dcf4SKowalski, Kamil */ 10401668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10411668ce6dSEd Tanous std::string_view arg2) 10421abe55efSEd Tanous { 1043b6cd31e1SEd Tanous return getLog( 1044fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10451668ce6dSEd Tanous std::to_array({arg1, arg2})); 1046b5c07418SJames Feist } 1047b5c07418SJames Feist 10481668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10491668ce6dSEd Tanous std::string_view arg2) 1050b5c07418SJames Feist { 1051b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1052b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1053b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1054f4c4dcf4SKowalski, Kamil } 1055f4c4dcf4SKowalski, Kamil 1056f4c4dcf4SKowalski, Kamil /** 1057f4c4dcf4SKowalski, Kamil * @internal 1058f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1059f4c4dcf4SKowalski, Kamil * 1060f4c4dcf4SKowalski, Kamil * See header file for more information 1061f4c4dcf4SKowalski, Kamil * @endinternal 1062f4c4dcf4SKowalski, Kamil */ 1063b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10641abe55efSEd Tanous { 1065fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1066b5c07418SJames Feist } 1067b5c07418SJames Feist 1068b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1069b5c07418SJames Feist { 1070b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1071b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1072f4c4dcf4SKowalski, Kamil } 1073f4c4dcf4SKowalski, Kamil 1074f4c4dcf4SKowalski, Kamil /** 1075f4c4dcf4SKowalski, Kamil * @internal 1076f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1077f4c4dcf4SKowalski, Kamil * 1078f4c4dcf4SKowalski, Kamil * See header file for more information 1079f4c4dcf4SKowalski, Kamil * @endinternal 1080f4c4dcf4SKowalski, Kamil */ 10811668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 10821668ce6dSEd Tanous std::string_view arg2) 10831abe55efSEd Tanous { 1084fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 10851668ce6dSEd Tanous std::to_array({arg1, arg2})); 1086b5c07418SJames Feist } 1087b5c07418SJames Feist 10881668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 10891668ce6dSEd Tanous std::string_view arg2) 1090b5c07418SJames Feist { 1091b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1092b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1093f4c4dcf4SKowalski, Kamil } 1094f4c4dcf4SKowalski, Kamil 1095f4c4dcf4SKowalski, Kamil /** 1096f4c4dcf4SKowalski, Kamil * @internal 1097f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1098f4c4dcf4SKowalski, Kamil * 1099f4c4dcf4SKowalski, Kamil * See header file for more information 1100f4c4dcf4SKowalski, Kamil * @endinternal 1101f4c4dcf4SKowalski, Kamil */ 11021668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 11031668ce6dSEd Tanous std::string_view arg2) 11041abe55efSEd Tanous { 1105fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 11061668ce6dSEd Tanous std::to_array({arg1, arg2})); 1107b5c07418SJames Feist } 1108b5c07418SJames Feist 11091668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 11101668ce6dSEd Tanous std::string_view arg2) 1111b5c07418SJames Feist { 1112b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1113b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1114b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1115f4c4dcf4SKowalski, Kamil } 1116f4c4dcf4SKowalski, Kamil 1117f4c4dcf4SKowalski, Kamil /** 1118f4c4dcf4SKowalski, Kamil * @internal 1119f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1120f4c4dcf4SKowalski, Kamil * 1121f4c4dcf4SKowalski, Kamil * See header file for more information 1122f4c4dcf4SKowalski, Kamil * @endinternal 1123f4c4dcf4SKowalski, Kamil */ 1124ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 11251668ce6dSEd Tanous std::string_view arg2) 11261abe55efSEd Tanous { 1127b6cd31e1SEd Tanous return getLog( 1128fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 1129*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1130b5c07418SJames Feist } 1131b5c07418SJames Feist 1132ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1133ace85d60SEd Tanous const boost::urls::url_view& arg1, 11341668ce6dSEd Tanous std::string_view arg2) 1135b5c07418SJames Feist { 1136b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1137b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1138b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1139f4c4dcf4SKowalski, Kamil } 1140f4c4dcf4SKowalski, Kamil 1141f4c4dcf4SKowalski, Kamil /** 1142f4c4dcf4SKowalski, Kamil * @internal 1143b4ad4c05SShantappa Teekappanavar * @brief Formats StrictAccountTypes message into JSON 1144b4ad4c05SShantappa Teekappanavar * 1145b4ad4c05SShantappa Teekappanavar * See header file for more information 1146b4ad4c05SShantappa Teekappanavar * @endinternal 1147b4ad4c05SShantappa Teekappanavar */ 1148b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1) 1149b4ad4c05SShantappa Teekappanavar { 1150b4ad4c05SShantappa Teekappanavar return getLog(redfish::registries::base::Index::strictAccountTypes, 1151b4ad4c05SShantappa Teekappanavar std::to_array({arg1})); 1152b4ad4c05SShantappa Teekappanavar } 1153b4ad4c05SShantappa Teekappanavar 1154b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1) 1155b4ad4c05SShantappa Teekappanavar { 1156b4ad4c05SShantappa Teekappanavar res.result(boost::beast::http::status::bad_request); 1157b4ad4c05SShantappa Teekappanavar addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 1158b4ad4c05SShantappa Teekappanavar } 1159b4ad4c05SShantappa Teekappanavar 1160b4ad4c05SShantappa Teekappanavar /** 1161b4ad4c05SShantappa Teekappanavar * @internal 1162f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1163f4c4dcf4SKowalski, Kamil * 1164f4c4dcf4SKowalski, Kamil * See header file for more information 1165f4c4dcf4SKowalski, Kamil * @endinternal 1166f4c4dcf4SKowalski, Kamil */ 1167b5c07418SJames Feist nlohmann::json accountRemoved(void) 11681abe55efSEd Tanous { 1169fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1170b5c07418SJames Feist } 1171b5c07418SJames Feist 1172b5c07418SJames Feist void accountRemoved(crow::Response& res) 1173b5c07418SJames Feist { 1174b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1175b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1176f4c4dcf4SKowalski, Kamil } 1177f4c4dcf4SKowalski, Kamil 1178f4c4dcf4SKowalski, Kamil /** 1179f4c4dcf4SKowalski, Kamil * @internal 1180f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1181f4c4dcf4SKowalski, Kamil * 1182f4c4dcf4SKowalski, Kamil * See header file for more information 1183f4c4dcf4SKowalski, Kamil * @endinternal 1184f4c4dcf4SKowalski, Kamil */ 1185ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1) 11861abe55efSEd Tanous { 1187fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 1188*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1189b5c07418SJames Feist } 1190b5c07418SJames Feist 1191ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1) 1192b5c07418SJames Feist { 1193b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1194b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1195f4c4dcf4SKowalski, Kamil } 1196f4c4dcf4SKowalski, Kamil 1197f4c4dcf4SKowalski, Kamil /** 1198f4c4dcf4SKowalski, Kamil * @internal 1199f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1200f4c4dcf4SKowalski, Kamil * 1201f4c4dcf4SKowalski, Kamil * See header file for more information 1202f4c4dcf4SKowalski, Kamil * @endinternal 1203f4c4dcf4SKowalski, Kamil */ 1204b5c07418SJames Feist nlohmann::json queryNotSupported(void) 12051abe55efSEd Tanous { 1206fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1207b5c07418SJames Feist } 1208b5c07418SJames Feist 1209b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1210b5c07418SJames Feist { 1211b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1212b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1213f4c4dcf4SKowalski, Kamil } 1214f4c4dcf4SKowalski, Kamil 1215f4c4dcf4SKowalski, Kamil /** 1216f4c4dcf4SKowalski, Kamil * @internal 1217f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1218f4c4dcf4SKowalski, Kamil * 1219f4c4dcf4SKowalski, Kamil * See header file for more information 1220f4c4dcf4SKowalski, Kamil * @endinternal 1221f4c4dcf4SKowalski, Kamil */ 1222b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 12231abe55efSEd Tanous { 1224b6cd31e1SEd Tanous return getLog( 1225fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1226b5c07418SJames Feist } 1227b5c07418SJames Feist 1228b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1229b5c07418SJames Feist { 1230b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1231b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1232f4c4dcf4SKowalski, Kamil } 1233f4c4dcf4SKowalski, Kamil 1234f4c4dcf4SKowalski, Kamil /** 1235f4c4dcf4SKowalski, Kamil * @internal 1236f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1237f4c4dcf4SKowalski, Kamil * 1238f4c4dcf4SKowalski, Kamil * See header file for more information 1239f4c4dcf4SKowalski, Kamil * @endinternal 1240f4c4dcf4SKowalski, Kamil */ 1241b5c07418SJames Feist nlohmann::json generalError(void) 12421abe55efSEd Tanous { 1243fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1244b5c07418SJames Feist } 1245b5c07418SJames Feist 1246b5c07418SJames Feist void generalError(crow::Response& res) 1247b5c07418SJames Feist { 1248b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1249b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1250f4c4dcf4SKowalski, Kamil } 1251f4c4dcf4SKowalski, Kamil 1252f4c4dcf4SKowalski, Kamil /** 1253f4c4dcf4SKowalski, Kamil * @internal 1254f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1255f4c4dcf4SKowalski, Kamil * 1256f4c4dcf4SKowalski, Kamil * See header file for more information 1257f4c4dcf4SKowalski, Kamil * @endinternal 1258f4c4dcf4SKowalski, Kamil */ 1259b5c07418SJames Feist nlohmann::json success(void) 12601abe55efSEd Tanous { 1261fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1262b5c07418SJames Feist } 1263b5c07418SJames Feist 1264b5c07418SJames Feist void success(crow::Response& res) 1265b5c07418SJames Feist { 1266b5c07418SJames Feist // don't set res.result here because success is the default and any 1267b5c07418SJames Feist // error should overwrite the default 1268b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1269f12894f8SJason M. Bills } 1270f12894f8SJason M. Bills 1271f12894f8SJason M. Bills /** 1272f12894f8SJason M. Bills * @internal 1273f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1274f4c4dcf4SKowalski, Kamil * 1275f4c4dcf4SKowalski, Kamil * See header file for more information 1276f4c4dcf4SKowalski, Kamil * @endinternal 1277f4c4dcf4SKowalski, Kamil */ 1278b5c07418SJames Feist nlohmann::json created(void) 12791abe55efSEd Tanous { 1280fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1281b5c07418SJames Feist } 1282b5c07418SJames Feist 1283b5c07418SJames Feist void created(crow::Response& res) 1284b5c07418SJames Feist { 1285b5c07418SJames Feist res.result(boost::beast::http::status::created); 1286b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1287f4c4dcf4SKowalski, Kamil } 1288f4c4dcf4SKowalski, Kamil 1289f4c4dcf4SKowalski, Kamil /** 1290f4c4dcf4SKowalski, Kamil * @internal 1291cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1292cc9139ecSJason M. Bills * 1293cc9139ecSJason M. Bills * See header file for more information 1294cc9139ecSJason M. Bills * @endinternal 1295cc9139ecSJason M. Bills */ 1296b5c07418SJames Feist nlohmann::json noOperation(void) 1297cc9139ecSJason M. Bills { 1298fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1299b5c07418SJames Feist } 1300b5c07418SJames Feist 1301b5c07418SJames Feist void noOperation(crow::Response& res) 1302b5c07418SJames Feist { 1303b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1304b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1305cc9139ecSJason M. Bills } 1306cc9139ecSJason M. Bills 1307cc9139ecSJason M. Bills /** 1308cc9139ecSJason M. Bills * @internal 1309b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1310b5c07418SJames Feist * property 1311f12894f8SJason M. Bills * 1312f12894f8SJason M. Bills * See header file for more information 1313f12894f8SJason M. Bills * @endinternal 1314f12894f8SJason M. Bills */ 13151668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1316b5c07418SJames Feist { 1317fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 13181668ce6dSEd Tanous std::to_array({arg1})); 1319b5c07418SJames Feist } 1320b5c07418SJames Feist 13211668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1322f12894f8SJason M. Bills { 1323f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 13247b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1325f4c4dcf4SKowalski, Kamil } 1326f4c4dcf4SKowalski, Kamil 1327f4c4dcf4SKowalski, Kamil /** 1328f4c4dcf4SKowalski, Kamil * @internal 1329f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1330f4c4dcf4SKowalski, Kamil * 1331f4c4dcf4SKowalski, Kamil * See header file for more information 1332f4c4dcf4SKowalski, Kamil * @endinternal 1333f4c4dcf4SKowalski, Kamil */ 1334b5c07418SJames Feist nlohmann::json noValidSession(void) 13351abe55efSEd Tanous { 1336fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1337b5c07418SJames Feist } 1338b5c07418SJames Feist 1339b5c07418SJames Feist void noValidSession(crow::Response& res) 1340b5c07418SJames Feist { 1341b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1342b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1343f4c4dcf4SKowalski, Kamil } 1344f4c4dcf4SKowalski, Kamil 1345f4c4dcf4SKowalski, Kamil /** 1346f4c4dcf4SKowalski, Kamil * @internal 1347f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1348f4c4dcf4SKowalski, Kamil * 1349f4c4dcf4SKowalski, Kamil * See header file for more information 1350f4c4dcf4SKowalski, Kamil * @endinternal 1351f4c4dcf4SKowalski, Kamil */ 1352ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1) 13531abe55efSEd Tanous { 1354fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 1355*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1356b5c07418SJames Feist } 1357b5c07418SJames Feist 1358ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1) 1359b5c07418SJames Feist { 1360b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1361b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1362f4c4dcf4SKowalski, Kamil } 1363f4c4dcf4SKowalski, Kamil 1364f4c4dcf4SKowalski, Kamil /** 1365f4c4dcf4SKowalski, Kamil * @internal 1366f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1367f4c4dcf4SKowalski, Kamil * 1368f4c4dcf4SKowalski, Kamil * See header file for more information 1369f4c4dcf4SKowalski, Kamil * @endinternal 1370f4c4dcf4SKowalski, Kamil */ 1371b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13721abe55efSEd Tanous { 1373fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1374b5c07418SJames Feist } 1375b5c07418SJames Feist 1376b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1377b5c07418SJames Feist { 1378b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1379b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1380f4c4dcf4SKowalski, Kamil } 1381f4c4dcf4SKowalski, Kamil 1382f4c4dcf4SKowalski, Kamil /** 1383f4c4dcf4SKowalski, Kamil * @internal 1384f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1385f4c4dcf4SKowalski, Kamil * 1386f4c4dcf4SKowalski, Kamil * See header file for more information 1387f4c4dcf4SKowalski, Kamil * @endinternal 1388f4c4dcf4SKowalski, Kamil */ 13891668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 13901668ce6dSEd Tanous std::string_view arg2, 13911668ce6dSEd Tanous std::string_view arg3) 13921abe55efSEd Tanous { 1393b6cd31e1SEd Tanous return getLog( 1394fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 13951668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1396b5c07418SJames Feist } 1397b5c07418SJames Feist 13981668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 13991668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1400b5c07418SJames Feist { 1401b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1402b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1403b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1404f4c4dcf4SKowalski, Kamil } 1405f4c4dcf4SKowalski, Kamil 1406f4c4dcf4SKowalski, Kamil /** 1407f4c4dcf4SKowalski, Kamil * @internal 1408f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1409f4c4dcf4SKowalski, Kamil * 1410f4c4dcf4SKowalski, Kamil * See header file for more information 1411f4c4dcf4SKowalski, Kamil * @endinternal 1412f4c4dcf4SKowalski, Kamil */ 1413b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 14141abe55efSEd Tanous { 1415fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1416b5c07418SJames Feist } 1417b5c07418SJames Feist 1418b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1419b5c07418SJames Feist { 1420b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1421b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1422f4c4dcf4SKowalski, Kamil } 1423f4c4dcf4SKowalski, Kamil 1424f4c4dcf4SKowalski, Kamil /** 1425f4c4dcf4SKowalski, Kamil * @internal 1426f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1427f4c4dcf4SKowalski, Kamil * 1428f4c4dcf4SKowalski, Kamil * See header file for more information 1429f4c4dcf4SKowalski, Kamil * @endinternal 1430f4c4dcf4SKowalski, Kamil */ 14311668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 14321abe55efSEd Tanous { 1433fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 14341668ce6dSEd Tanous std::to_array({arg1})); 1435b5c07418SJames Feist } 1436b5c07418SJames Feist 14371668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1438b5c07418SJames Feist { 1439b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1440b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1441f4c4dcf4SKowalski, Kamil } 1442f4c4dcf4SKowalski, Kamil 1443f4c4dcf4SKowalski, Kamil /** 1444f4c4dcf4SKowalski, Kamil * @internal 1445f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1446f4c4dcf4SKowalski, Kamil * 1447f4c4dcf4SKowalski, Kamil * See header file for more information 1448f4c4dcf4SKowalski, Kamil * @endinternal 1449f4c4dcf4SKowalski, Kamil */ 14505187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14511abe55efSEd Tanous { 1452b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1453fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14541668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1455b5c07418SJames Feist } 1456b5c07418SJames Feist 14575187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1458b5c07418SJames Feist { 1459b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1460b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1461f4c4dcf4SKowalski, Kamil } 1462f4c4dcf4SKowalski, Kamil 1463f4c4dcf4SKowalski, Kamil /** 1464f4c4dcf4SKowalski, Kamil * @internal 1465f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1466f4c4dcf4SKowalski, Kamil * 1467f4c4dcf4SKowalski, Kamil * See header file for more information 1468f4c4dcf4SKowalski, Kamil * @endinternal 1469f4c4dcf4SKowalski, Kamil */ 1470b5c07418SJames Feist nlohmann::json emptyJSON(void) 14711abe55efSEd Tanous { 1472fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1473b5c07418SJames Feist } 1474b5c07418SJames Feist 1475b5c07418SJames Feist void emptyJSON(crow::Response& res) 1476b5c07418SJames Feist { 1477b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1478b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1479f4c4dcf4SKowalski, Kamil } 1480f4c4dcf4SKowalski, Kamil 1481f4c4dcf4SKowalski, Kamil /** 1482f4c4dcf4SKowalski, Kamil * @internal 1483f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1484f4c4dcf4SKowalski, Kamil * 1485f4c4dcf4SKowalski, Kamil * See header file for more information 1486f4c4dcf4SKowalski, Kamil * @endinternal 1487f4c4dcf4SKowalski, Kamil */ 1488b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 14891abe55efSEd Tanous { 1490fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1491b6cd31e1SEd Tanous {}); 1492b5c07418SJames Feist } 1493b5c07418SJames Feist 1494b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1495b5c07418SJames Feist { 14966a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1497b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1498f4c4dcf4SKowalski, Kamil } 1499f4c4dcf4SKowalski, Kamil 1500f4c4dcf4SKowalski, Kamil /** 1501f4c4dcf4SKowalski, Kamil * @internal 1502684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1503684bb4b8SJason M. Bills * 1504684bb4b8SJason M. Bills * See header file for more information 1505684bb4b8SJason M. Bills * @endinternal 1506684bb4b8SJason M. Bills */ 1507684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1508684bb4b8SJason M. Bills { 1509b6cd31e1SEd Tanous return getLog( 1510fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1511684bb4b8SJason M. Bills } 1512684bb4b8SJason M. Bills 1513684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1514684bb4b8SJason M. Bills { 15156a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1516684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1517684bb4b8SJason M. Bills } 1518684bb4b8SJason M. Bills 1519684bb4b8SJason M. Bills /** 1520684bb4b8SJason M. Bills * @internal 1521684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1522684bb4b8SJason M. Bills * 1523684bb4b8SJason M. Bills * See header file for more information 1524684bb4b8SJason M. Bills * @endinternal 1525684bb4b8SJason M. Bills */ 1526684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1527684bb4b8SJason M. Bills { 1528fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1529fffb8c1fSEd Tanous {}); 1530684bb4b8SJason M. Bills } 1531684bb4b8SJason M. Bills 1532684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1533684bb4b8SJason M. Bills { 1534684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1535684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1536684bb4b8SJason M. Bills } 1537684bb4b8SJason M. Bills 1538684bb4b8SJason M. Bills /** 1539684bb4b8SJason M. Bills * @internal 1540f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1541f4c4dcf4SKowalski, Kamil * 1542f4c4dcf4SKowalski, Kamil * See header file for more information 1543f4c4dcf4SKowalski, Kamil * @endinternal 1544f4c4dcf4SKowalski, Kamil */ 1545b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15461abe55efSEd Tanous { 1547fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1548b5c07418SJames Feist } 1549b5c07418SJames Feist 1550b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1551b5c07418SJames Feist { 1552b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1553b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1554f4c4dcf4SKowalski, Kamil } 1555f4c4dcf4SKowalski, Kamil 1556f4c4dcf4SKowalski, Kamil /** 1557f4c4dcf4SKowalski, Kamil * @internal 1558f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1559f4c4dcf4SKowalski, Kamil * 1560f4c4dcf4SKowalski, Kamil * See header file for more information 1561f4c4dcf4SKowalski, Kamil * @endinternal 1562f4c4dcf4SKowalski, Kamil */ 15631668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15641668ce6dSEd Tanous std::string_view arg2) 1565b5c07418SJames Feist { 1566fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15671668ce6dSEd Tanous std::to_array({arg1, arg2})); 1568b5c07418SJames Feist } 1569b5c07418SJames Feist 15701668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15711668ce6dSEd Tanous std::string_view arg2) 15721abe55efSEd Tanous { 1573f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1574b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1575f4c4dcf4SKowalski, Kamil } 1576f4c4dcf4SKowalski, Kamil 1577f4c4dcf4SKowalski, Kamil /** 1578f4c4dcf4SKowalski, Kamil * @internal 1579f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1580f4c4dcf4SKowalski, Kamil * 1581f4c4dcf4SKowalski, Kamil * See header file for more information 1582f4c4dcf4SKowalski, Kamil * @endinternal 1583f4c4dcf4SKowalski, Kamil */ 1584b5c07418SJames Feist nlohmann::json accountNotModified(void) 15851abe55efSEd Tanous { 1586fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1587b5c07418SJames Feist } 1588b5c07418SJames Feist 1589b5c07418SJames Feist void accountNotModified(crow::Response& res) 1590b5c07418SJames Feist { 1591b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1592b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1593f4c4dcf4SKowalski, Kamil } 1594f4c4dcf4SKowalski, Kamil 1595f4c4dcf4SKowalski, Kamil /** 1596f4c4dcf4SKowalski, Kamil * @internal 1597f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1598f4c4dcf4SKowalski, Kamil * 1599f4c4dcf4SKowalski, Kamil * See header file for more information 1600f4c4dcf4SKowalski, Kamil * @endinternal 1601f4c4dcf4SKowalski, Kamil */ 16021668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 16031668ce6dSEd Tanous std::string_view arg2) 16041abe55efSEd Tanous { 1605fffb8c1fSEd Tanous return getLog( 1606fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 16071668ce6dSEd Tanous std::to_array({arg1, arg2})); 1608b5c07418SJames Feist } 1609b5c07418SJames Feist 16101668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 16111668ce6dSEd Tanous std::string_view arg2) 1612b5c07418SJames Feist { 1613b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1614b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1615b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1616f4c4dcf4SKowalski, Kamil } 1617f4c4dcf4SKowalski, Kamil 1618f4c4dcf4SKowalski, Kamil /** 1619f4c4dcf4SKowalski, Kamil * @internal 1620b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1621b5c07418SJames Feist * property 1622f12894f8SJason M. Bills * 1623f12894f8SJason M. Bills * See header file for more information 1624f12894f8SJason M. Bills * @endinternal 1625f12894f8SJason M. Bills */ 16261668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1627f12894f8SJason M. Bills { 1628fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 16291668ce6dSEd Tanous std::to_array({arg1})); 1630b5c07418SJames Feist } 1631b5c07418SJames Feist 16321668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1633b5c07418SJames Feist { 1634b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1635b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1636f4c4dcf4SKowalski, Kamil } 1637f4c4dcf4SKowalski, Kamil 1638f4c4dcf4SKowalski, Kamil /** 1639f4c4dcf4SKowalski, Kamil * @internal 1640f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1641f4c4dcf4SKowalski, Kamil * 1642f4c4dcf4SKowalski, Kamil * See header file for more information 1643f4c4dcf4SKowalski, Kamil * @endinternal 1644f4c4dcf4SKowalski, Kamil */ 16451668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16461abe55efSEd Tanous { 1647fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16481668ce6dSEd Tanous std::to_array({arg1})); 1649b5c07418SJames Feist } 1650b5c07418SJames Feist 16511668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1652b5c07418SJames Feist { 1653b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1654b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1655f4c4dcf4SKowalski, Kamil } 1656f4c4dcf4SKowalski, Kamil 1657f4c4dcf4SKowalski, Kamil /** 1658f4c4dcf4SKowalski, Kamil * @internal 1659f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1660f4c4dcf4SKowalski, Kamil * 1661f4c4dcf4SKowalski, Kamil * See header file for more information 1662f4c4dcf4SKowalski, Kamil * @endinternal 1663f4c4dcf4SKowalski, Kamil */ 1664b5c07418SJames Feist nlohmann::json accountModified(void) 16651abe55efSEd Tanous { 1666fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1667b5c07418SJames Feist } 1668b5c07418SJames Feist 1669b5c07418SJames Feist void accountModified(crow::Response& res) 1670b5c07418SJames Feist { 1671b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1672b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1673f4c4dcf4SKowalski, Kamil } 1674f4c4dcf4SKowalski, Kamil 1675f4c4dcf4SKowalski, Kamil /** 1676f4c4dcf4SKowalski, Kamil * @internal 1677f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1678f4c4dcf4SKowalski, Kamil * 1679f4c4dcf4SKowalski, Kamil * See header file for more information 1680f4c4dcf4SKowalski, Kamil * @endinternal 1681f4c4dcf4SKowalski, Kamil */ 16821668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 16831668ce6dSEd Tanous std::string_view arg2, 16841668ce6dSEd Tanous std::string_view arg3) 16851abe55efSEd Tanous { 1686fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 16871668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1688b5c07418SJames Feist } 1689b5c07418SJames Feist 16901668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 16911668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1692b5c07418SJames Feist { 1693b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1694b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1695b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1696f4c4dcf4SKowalski, Kamil } 1697f4c4dcf4SKowalski, Kamil 1698b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1) 1699b6cd31e1SEd Tanous { 1700fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 1701*079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1702b6cd31e1SEd Tanous } 1703b6cd31e1SEd Tanous 17043bf4e632SJoseph Reynolds /** 17053bf4e632SJoseph Reynolds * @internal 17063bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 17073bf4e632SJoseph Reynolds * 17083bf4e632SJoseph Reynolds * See header file for more information 17093bf4e632SJoseph Reynolds * @endinternal 17103bf4e632SJoseph Reynolds */ 1711ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res, 1712ace85d60SEd Tanous const boost::urls::url_view& arg1) 17133bf4e632SJoseph Reynolds { 1714b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 17153bf4e632SJoseph Reynolds } 17163bf4e632SJoseph Reynolds 17174cde5d90SJames Feist /** 17184cde5d90SJames Feist * @internal 1719ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1720ae688313SNan Zhou * 1721ae688313SNan Zhou * See header file for more information 1722ae688313SNan Zhou * @endinternal 1723ae688313SNan Zhou */ 1724ae688313SNan Zhou nlohmann::json insufficientStorage() 1725ae688313SNan Zhou { 1726ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1727ae688313SNan Zhou } 1728ae688313SNan Zhou 1729ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1730ae688313SNan Zhou { 1731ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1732ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1733ae688313SNan Zhou } 1734ae688313SNan Zhou 1735ae688313SNan Zhou /** 1736ae688313SNan Zhou * @internal 173744c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 173844c70412SEd Tanous * 173944c70412SEd Tanous * See header file for more information 174044c70412SEd Tanous * @endinternal 174144c70412SEd Tanous */ 174244c70412SEd Tanous nlohmann::json operationNotAllowed() 174344c70412SEd Tanous { 174444c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 174544c70412SEd Tanous } 174644c70412SEd Tanous 174744c70412SEd Tanous void operationNotAllowed(crow::Response& res) 174844c70412SEd Tanous { 174944c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 175044c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 175144c70412SEd Tanous } 175244c70412SEd Tanous 175344c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 175444c70412SEd Tanous std::string_view arg2) 175544c70412SEd Tanous { 175644c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 175744c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 175844c70412SEd Tanous } 175944c70412SEd Tanous 176044c70412SEd Tanous /** 176144c70412SEd Tanous * @internal 17624cde5d90SJames Feist * @brief Formats Invalid File message into JSON 17634cde5d90SJames Feist * 17644cde5d90SJames Feist * See header file for more information 17654cde5d90SJames Feist * @endinternal 17664cde5d90SJames Feist */ 17671668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 17684cde5d90SJames Feist { 17691668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 17701668ce6dSEd Tanous msg += arg1; 17711668ce6dSEd Tanous msg += ": "; 17721668ce6dSEd Tanous msg += arg2; 17731668ce6dSEd Tanous msg += "."; 1774613dabeaSEd Tanous 1775613dabeaSEd Tanous nlohmann::json::object_t ret; 1776613dabeaSEd Tanous ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message"; 1777613dabeaSEd Tanous ret["MessageId"] = "OpenBMC.0.2.InvalidUpload"; 1778613dabeaSEd Tanous ret["Message"] = std::move(msg); 1779613dabeaSEd Tanous nlohmann::json::array_t args; 1780613dabeaSEd Tanous args.push_back(arg1); 1781613dabeaSEd Tanous args.push_back(arg2); 1782613dabeaSEd Tanous ret["MessageArgs"] = std::move(args); 1783613dabeaSEd Tanous ret["MessageSeverity"] = "Warning"; 1784613dabeaSEd Tanous ret["Resolution"] = "None."; 1785613dabeaSEd Tanous return ret; 17864cde5d90SJames Feist } 1787ae688313SNan Zhou 1788f4c4dcf4SKowalski, Kamil } // namespace messages 1789f4c4dcf4SKowalski, Kamil 1790d425c6f6SEd Tanous } // namespace redfish 1791