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 */ 169ea15c35SEd Tanous #include "http_response.hpp" 17b6cd31e1SEd Tanous #include "registries/base_message_registry.hpp" 189ea15c35SEd Tanous 199ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 20ace85d60SEd Tanous #include <boost/url/url.hpp> 211abe55efSEd Tanous #include <error_messages.hpp> 2204e438cbSEd Tanous #include <logging.hpp> 239ea15c35SEd Tanous #include <nlohmann/json.hpp> 24f4c4dcf4SKowalski, Kamil 251668ce6dSEd Tanous #include <array> 261668ce6dSEd Tanous 271abe55efSEd Tanous namespace redfish 281abe55efSEd Tanous { 291abe55efSEd Tanous 301abe55efSEd Tanous namespace messages 311abe55efSEd Tanous { 32f4c4dcf4SKowalski, Kamil 33f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 341abe55efSEd Tanous const nlohmann::json& message) 351abe55efSEd Tanous { 36f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 37f4c4dcf4SKowalski, Kamil 381abe55efSEd Tanous // If this is the first error message, fill in the information from the 391abe55efSEd Tanous // first error message to the top level struct 401abe55efSEd Tanous if (!error.is_object()) 411abe55efSEd Tanous { 42c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 43c074230bSJason M. Bills if (messageIdIterator == message.end()) 441abe55efSEd Tanous { 451abe55efSEd Tanous BMCWEB_LOG_CRITICAL 461abe55efSEd Tanous << "Attempt to add error message without MessageId"; 47f4c4dcf4SKowalski, Kamil return; 48f4c4dcf4SKowalski, Kamil } 49f4c4dcf4SKowalski, Kamil 50c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 51c074230bSJason M. Bills if (messageFieldIterator == message.end()) 521abe55efSEd Tanous { 531abe55efSEd Tanous BMCWEB_LOG_CRITICAL 541abe55efSEd Tanous << "Attempt to add error message without Message"; 55f4c4dcf4SKowalski, Kamil return; 56f4c4dcf4SKowalski, Kamil } 57c21055aaSEd Tanous error = {{"code", *messageIdIterator}, 58c21055aaSEd Tanous {"message", *messageFieldIterator}}; 591abe55efSEd Tanous } 601abe55efSEd Tanous else 611abe55efSEd Tanous { 62f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 6355c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 64cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 65cc9139ecSJason M. Bills "information on how to resolve the error."; 66f4c4dcf4SKowalski, Kamil } 67f4c4dcf4SKowalski, Kamil 68f4c4dcf4SKowalski, Kamil // This check could technically be done in in the default construction 69f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 70f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 71c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 72c074230bSJason M. Bills if (!extendedInfo.is_array()) 731abe55efSEd Tanous { 74c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 75f4c4dcf4SKowalski, Kamil } 76f4c4dcf4SKowalski, Kamil 77c074230bSJason M. Bills extendedInfo.push_back(message); 78f4c4dcf4SKowalski, Kamil } 79f4c4dcf4SKowalski, Kamil 80f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 81f12894f8SJason M. Bills const nlohmann::json& message) 821abe55efSEd Tanous { 831abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 841abe55efSEd Tanous { 85f4c4dcf4SKowalski, Kamil // Force object to be an array 8655c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 87f4c4dcf4SKowalski, Kamil } 88f4c4dcf4SKowalski, Kamil 8955c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 90f4c4dcf4SKowalski, Kamil } 91f4c4dcf4SKowalski, Kamil 92f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 93f12894f8SJason M. Bills const nlohmann::json& message, 941668ce6dSEd Tanous std::string_view fieldPath) 951abe55efSEd Tanous { 961668ce6dSEd Tanous std::string extendedInfo(fieldPath); 971668ce6dSEd Tanous extendedInfo += messages::messageAnnotation; 98f4c4dcf4SKowalski, Kamil 991668ce6dSEd Tanous nlohmann::json& field = target[extendedInfo]; 1001668ce6dSEd Tanous if (!field.is_array()) 1011abe55efSEd Tanous { 102f4c4dcf4SKowalski, Kamil // Force object to be an array 1031668ce6dSEd Tanous field = nlohmann::json::array(); 104f4c4dcf4SKowalski, Kamil } 105f4c4dcf4SKowalski, Kamil 106f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 1071668ce6dSEd Tanous field.push_back(message); 108f4c4dcf4SKowalski, Kamil } 109f4c4dcf4SKowalski, Kamil 110f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name, 111b6cd31e1SEd Tanous std::span<const std::string_view> args) 112b6cd31e1SEd Tanous { 113b6cd31e1SEd Tanous size_t index = static_cast<size_t>(name); 114fffb8c1fSEd Tanous if (index >= redfish::registries::base::registry.size()) 115b6cd31e1SEd Tanous { 116b6cd31e1SEd Tanous return {}; 117b6cd31e1SEd Tanous } 118fffb8c1fSEd Tanous const redfish::registries::MessageEntry& entry = 119fffb8c1fSEd Tanous redfish::registries::base::registry[index]; 120b6cd31e1SEd Tanous // Intentionally make a copy of the string, so we can append in the 121b6cd31e1SEd Tanous // parameters. 122b6cd31e1SEd Tanous std::string msg = entry.second.message; 123fffb8c1fSEd Tanous redfish::registries::fillMessageArgs(args, msg); 124b6cd31e1SEd Tanous nlohmann::json jArgs = nlohmann::json::array(); 125b6cd31e1SEd Tanous for (const std::string_view arg : args) 126b6cd31e1SEd Tanous { 127b6cd31e1SEd Tanous jArgs.push_back(arg); 128b6cd31e1SEd Tanous } 129fffb8c1fSEd Tanous std::string msgId = redfish::registries::base::header.id; 130b6cd31e1SEd Tanous msgId += "."; 131b6cd31e1SEd Tanous msgId += entry.first; 132b6cd31e1SEd Tanous return {{"@odata.type", "#Message.v1_1_1.Message"}, 133b6cd31e1SEd Tanous {"MessageId", std::move(msgId)}, 134b6cd31e1SEd Tanous {"Message", std::move(msg)}, 135b6cd31e1SEd Tanous {"MessageArgs", std::move(jArgs)}, 1365f2b84eeSEd Tanous {"MessageSeverity", entry.second.messageSeverity}, 137b6cd31e1SEd Tanous {"Resolution", entry.second.resolution}}; 138b6cd31e1SEd Tanous } 139b6cd31e1SEd Tanous 140f4c4dcf4SKowalski, Kamil /** 141f4c4dcf4SKowalski, Kamil * @internal 142f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 143f4c4dcf4SKowalski, Kamil * 144f4c4dcf4SKowalski, Kamil * See header file for more information 145f4c4dcf4SKowalski, Kamil * @endinternal 146f4c4dcf4SKowalski, Kamil */ 147b5c07418SJames Feist nlohmann::json resourceInUse(void) 1481abe55efSEd Tanous { 149fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInUse, {}); 150b5c07418SJames Feist } 151b5c07418SJames Feist 152b5c07418SJames Feist void resourceInUse(crow::Response& res) 153b5c07418SJames Feist { 154b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 155b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 156f4c4dcf4SKowalski, Kamil } 157f4c4dcf4SKowalski, Kamil 158f4c4dcf4SKowalski, Kamil /** 159f4c4dcf4SKowalski, Kamil * @internal 160f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 161f4c4dcf4SKowalski, Kamil * 162f4c4dcf4SKowalski, Kamil * See header file for more information 163f4c4dcf4SKowalski, Kamil * @endinternal 164f4c4dcf4SKowalski, Kamil */ 165b5c07418SJames Feist nlohmann::json malformedJSON(void) 1661abe55efSEd Tanous { 167fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::malformedJSON, {}); 168b5c07418SJames Feist } 169b5c07418SJames Feist 170b5c07418SJames Feist void malformedJSON(crow::Response& res) 171b5c07418SJames Feist { 172b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 173b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 174f4c4dcf4SKowalski, Kamil } 175f4c4dcf4SKowalski, Kamil 176f4c4dcf4SKowalski, Kamil /** 177f4c4dcf4SKowalski, Kamil * @internal 178f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 179f4c4dcf4SKowalski, Kamil * 180f4c4dcf4SKowalski, Kamil * See header file for more information 181f4c4dcf4SKowalski, Kamil * @endinternal 182f4c4dcf4SKowalski, Kamil */ 183ace85d60SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1) 1841abe55efSEd Tanous { 185b6cd31e1SEd Tanous std::array<std::string_view, 1> args{ 186b6cd31e1SEd Tanous std::string_view{arg1.data(), arg1.size()}}; 187fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 188b5c07418SJames Feist } 189b5c07418SJames Feist 190ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res, 191ace85d60SEd Tanous const boost::urls::url_view& arg1) 192b5c07418SJames Feist { 193b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 194b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 195f4c4dcf4SKowalski, Kamil } 196f4c4dcf4SKowalski, Kamil 197f4c4dcf4SKowalski, Kamil /** 198f4c4dcf4SKowalski, Kamil * @internal 199f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 200f4c4dcf4SKowalski, Kamil * 201f4c4dcf4SKowalski, Kamil * See header file for more information 202f4c4dcf4SKowalski, Kamil * @endinternal 203f4c4dcf4SKowalski, Kamil */ 2041668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2051668ce6dSEd Tanous std::string_view arg2, 2061668ce6dSEd Tanous std::string_view arg3) 2071abe55efSEd Tanous { 208fffb8c1fSEd Tanous return getLog( 209fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2101668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 211b5c07418SJames Feist } 212b5c07418SJames Feist 2131668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2141668ce6dSEd Tanous std::string_view arg2, 2151668ce6dSEd Tanous std::string_view arg3) 216b5c07418SJames Feist { 217b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 218b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 219b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 220f4c4dcf4SKowalski, Kamil } 221f4c4dcf4SKowalski, Kamil 222f4c4dcf4SKowalski, Kamil /** 223f4c4dcf4SKowalski, Kamil * @internal 224f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 225f4c4dcf4SKowalski, Kamil * 226f4c4dcf4SKowalski, Kamil * See header file for more information 227f4c4dcf4SKowalski, Kamil * @endinternal 228f4c4dcf4SKowalski, Kamil */ 229b5c07418SJames Feist nlohmann::json internalError(void) 2301abe55efSEd Tanous { 231fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 232b5c07418SJames Feist } 233b5c07418SJames Feist 234df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 235b5c07418SJames Feist { 236df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 237df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 238df5415fcSEd Tanous << location.function_name() << "`: "; 239b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 240b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 241f12894f8SJason M. Bills } 242f12894f8SJason M. Bills 243f12894f8SJason M. Bills /** 244f12894f8SJason M. Bills * @internal 245f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 246f4c4dcf4SKowalski, Kamil * 247f4c4dcf4SKowalski, Kamil * See header file for more information 248f4c4dcf4SKowalski, Kamil * @endinternal 249f4c4dcf4SKowalski, Kamil */ 250b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2511abe55efSEd Tanous { 252fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 253fffb8c1fSEd Tanous {}); 254b5c07418SJames Feist } 255b5c07418SJames Feist 256b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 257b5c07418SJames Feist { 258b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 259b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 260f4c4dcf4SKowalski, Kamil } 261f4c4dcf4SKowalski, Kamil 262f4c4dcf4SKowalski, Kamil /** 263f4c4dcf4SKowalski, Kamil * @internal 264f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 265f4c4dcf4SKowalski, Kamil * 266f4c4dcf4SKowalski, Kamil * See header file for more information 267f4c4dcf4SKowalski, Kamil * @endinternal 268f4c4dcf4SKowalski, Kamil */ 269ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 2701668ce6dSEd Tanous std::string_view arg2) 2711abe55efSEd Tanous { 272b6cd31e1SEd Tanous return getLog( 273fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriUnauthorized, 2741668ce6dSEd Tanous std::to_array({std::string_view{arg1.data(), arg1.size()}, arg2})); 275b5c07418SJames Feist } 276b5c07418SJames Feist 277ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 278ace85d60SEd Tanous const boost::urls::url_view& arg1, 2791668ce6dSEd Tanous std::string_view arg2) 280b5c07418SJames Feist { 281b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 282b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 283f4c4dcf4SKowalski, Kamil } 284f4c4dcf4SKowalski, Kamil 285f4c4dcf4SKowalski, Kamil /** 286f4c4dcf4SKowalski, Kamil * @internal 287f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 288f4c4dcf4SKowalski, Kamil * 289f4c4dcf4SKowalski, Kamil * See header file for more information 290f4c4dcf4SKowalski, Kamil * @endinternal 291f4c4dcf4SKowalski, Kamil */ 2921668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 2931668ce6dSEd Tanous std::string_view arg2) 294b5c07418SJames Feist { 295fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 2961668ce6dSEd Tanous std::to_array({arg1, arg2})); 297b5c07418SJames Feist } 298b5c07418SJames Feist 2991668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3001668ce6dSEd Tanous std::string_view arg2) 3011abe55efSEd Tanous { 302f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 303b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 304f4c4dcf4SKowalski, Kamil } 305f4c4dcf4SKowalski, Kamil 306f4c4dcf4SKowalski, Kamil /** 307f4c4dcf4SKowalski, Kamil * @internal 308f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 309f4c4dcf4SKowalski, Kamil * 310f4c4dcf4SKowalski, Kamil * See header file for more information 311f4c4dcf4SKowalski, Kamil * @endinternal 312f4c4dcf4SKowalski, Kamil */ 313b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3141abe55efSEd Tanous { 315fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 316fffb8c1fSEd Tanous {}); 317b5c07418SJames Feist } 318b5c07418SJames Feist 319b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 320b5c07418SJames Feist { 321b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 322b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 323f4c4dcf4SKowalski, Kamil } 324f4c4dcf4SKowalski, Kamil 325f4c4dcf4SKowalski, Kamil /** 326f4c4dcf4SKowalski, Kamil * @internal 327f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 328f4c4dcf4SKowalski, Kamil * 329f4c4dcf4SKowalski, Kamil * See header file for more information 330f4c4dcf4SKowalski, Kamil * @endinternal 331f4c4dcf4SKowalski, Kamil */ 3321668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3331abe55efSEd Tanous { 334fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3351668ce6dSEd Tanous std::to_array({arg1})); 336b5c07418SJames Feist } 337b5c07418SJames Feist 3381668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 339b5c07418SJames Feist { 340b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 341b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 342f4c4dcf4SKowalski, Kamil } 343f4c4dcf4SKowalski, Kamil 344f4c4dcf4SKowalski, Kamil /** 345f4c4dcf4SKowalski, Kamil * @internal 346f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 347f4c4dcf4SKowalski, Kamil * 348f4c4dcf4SKowalski, Kamil * See header file for more information 349f4c4dcf4SKowalski, Kamil * @endinternal 350f4c4dcf4SKowalski, Kamil */ 3511668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3521abe55efSEd Tanous { 353b6cd31e1SEd Tanous return getLog( 354fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3551668ce6dSEd Tanous std::to_array({arg1})); 356b5c07418SJames Feist } 357b5c07418SJames Feist 3581668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 359b5c07418SJames Feist { 360b5c07418SJames Feist res.addHeader("Retry-After", arg1); 361b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 362b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 363f4c4dcf4SKowalski, Kamil } 364f4c4dcf4SKowalski, Kamil 365f4c4dcf4SKowalski, Kamil /** 366f4c4dcf4SKowalski, Kamil * @internal 367f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 368f4c4dcf4SKowalski, Kamil * 369f4c4dcf4SKowalski, Kamil * See header file for more information 370f4c4dcf4SKowalski, Kamil * @endinternal 371f4c4dcf4SKowalski, Kamil */ 3721668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 3731668ce6dSEd Tanous std::string_view arg2, 3741668ce6dSEd Tanous std::string_view arg3) 3751abe55efSEd Tanous { 376fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 3771668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 378b5c07418SJames Feist } 379b5c07418SJames Feist 3801668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 3811668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 382b5c07418SJames Feist { 383b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 384b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 385a08b46ccSJason M. Bills arg2); 386f4c4dcf4SKowalski, Kamil } 387f4c4dcf4SKowalski, Kamil 388f4c4dcf4SKowalski, Kamil /** 389f4c4dcf4SKowalski, Kamil * @internal 390f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 391f4c4dcf4SKowalski, Kamil * 392f4c4dcf4SKowalski, Kamil * See header file for more information 393f4c4dcf4SKowalski, Kamil * @endinternal 394f4c4dcf4SKowalski, Kamil */ 395b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 3961abe55efSEd Tanous { 397fffb8c1fSEd Tanous return getLog( 398fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 399b5c07418SJames Feist } 400b5c07418SJames Feist 401b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 402b5c07418SJames Feist { 403b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 404b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 405f4c4dcf4SKowalski, Kamil } 406f4c4dcf4SKowalski, Kamil 407f4c4dcf4SKowalski, Kamil /** 408f4c4dcf4SKowalski, Kamil * @internal 409f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 410f4c4dcf4SKowalski, Kamil * 411f4c4dcf4SKowalski, Kamil * See header file for more information 412f4c4dcf4SKowalski, Kamil * @endinternal 413f4c4dcf4SKowalski, Kamil */ 4141668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4151abe55efSEd Tanous { 416fffb8c1fSEd Tanous return getLog( 417fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4181668ce6dSEd Tanous std::to_array({arg1})); 419b5c07418SJames Feist } 420b5c07418SJames Feist 421b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4221668ce6dSEd Tanous std::string_view arg1) 423b5c07418SJames Feist { 424b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 425b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 426a08b46ccSJason M. Bills arg1); 427f12894f8SJason M. Bills } 428f12894f8SJason M. Bills 429f12894f8SJason M. Bills /** 430f12894f8SJason M. Bills * @internal 431f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 432f12894f8SJason M. Bills * property 433f12894f8SJason M. Bills * 434f12894f8SJason M. Bills * See header file for more information 435f12894f8SJason M. Bills * @endinternal 436f12894f8SJason M. Bills */ 4371668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4381668ce6dSEd Tanous std::string_view arg2) 439f12894f8SJason M. Bills { 440fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4411668ce6dSEd Tanous std::to_array({arg1, arg2})); 442b5c07418SJames Feist } 443b5c07418SJames Feist 4441668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4451668ce6dSEd Tanous std::string_view arg2) 446b5c07418SJames Feist { 447b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 448b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 449f12894f8SJason M. Bills } 450f12894f8SJason M. Bills 451f12894f8SJason M. Bills /** 452f12894f8SJason M. Bills * @internal 453f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList 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 propertyValueNotInList(std::string_view arg1, 4601668ce6dSEd Tanous std::string_view arg2) 461f12894f8SJason M. Bills { 462fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 4631668ce6dSEd Tanous std::to_array({arg1, arg2})); 464b5c07418SJames Feist } 465b5c07418SJames Feist 4661668ce6dSEd Tanous void propertyValueNotInList(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, propertyValueNotInList(arg1, arg2), arg2); 471f4c4dcf4SKowalski, Kamil } 472f4c4dcf4SKowalski, Kamil 473f4c4dcf4SKowalski, Kamil /** 474f4c4dcf4SKowalski, Kamil * @internal 475f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 476f4c4dcf4SKowalski, Kamil * 477f4c4dcf4SKowalski, Kamil * See header file for more information 478f4c4dcf4SKowalski, Kamil * @endinternal 479f4c4dcf4SKowalski, Kamil */ 480ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1) 4811abe55efSEd Tanous { 4821668ce6dSEd Tanous std::string_view arg1str{arg1.data(), arg1.size()}; 483b6cd31e1SEd Tanous return getLog( 484fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 4851668ce6dSEd Tanous std::to_array({arg1str})); 486b5c07418SJames Feist } 487b5c07418SJames Feist 488ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 489ace85d60SEd Tanous const boost::urls::url_view& arg1) 490b5c07418SJames Feist { 491b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 492b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 493f4c4dcf4SKowalski, Kamil } 494f4c4dcf4SKowalski, Kamil 495f4c4dcf4SKowalski, Kamil /** 496f4c4dcf4SKowalski, Kamil * @internal 49781856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 49881856681SAsmitha Karunanithi * 49981856681SAsmitha Karunanithi * See header file for more information 50081856681SAsmitha Karunanithi * @endinternal 50181856681SAsmitha Karunanithi */ 5021668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 50381856681SAsmitha Karunanithi { 504fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5051668ce6dSEd Tanous std::to_array({arg1})); 50681856681SAsmitha Karunanithi } 50781856681SAsmitha Karunanithi 5081668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 50981856681SAsmitha Karunanithi { 51081856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 51181856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 51281856681SAsmitha Karunanithi } 51381856681SAsmitha Karunanithi 51481856681SAsmitha Karunanithi /** 51581856681SAsmitha Karunanithi * @internal 516f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 517f4c4dcf4SKowalski, Kamil * 518f4c4dcf4SKowalski, Kamil * See header file for more information 519f4c4dcf4SKowalski, Kamil * @endinternal 520f4c4dcf4SKowalski, Kamil */ 521b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5221abe55efSEd Tanous { 523fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 524b5c07418SJames Feist } 525b5c07418SJames Feist 526b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 527b5c07418SJames Feist { 528b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 529b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 530f4c4dcf4SKowalski, Kamil } 531f4c4dcf4SKowalski, Kamil 532f4c4dcf4SKowalski, Kamil /** 533f4c4dcf4SKowalski, Kamil * @internal 534f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 535f4c4dcf4SKowalski, Kamil * 536f4c4dcf4SKowalski, Kamil * See header file for more information 537f4c4dcf4SKowalski, Kamil * @endinternal 538f4c4dcf4SKowalski, Kamil */ 539b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 5401abe55efSEd Tanous { 541fffb8c1fSEd Tanous return getLog( 542fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 543b5c07418SJames Feist } 544b5c07418SJames Feist 545b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 546b5c07418SJames Feist { 547789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 548b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 549f4c4dcf4SKowalski, Kamil } 550f4c4dcf4SKowalski, Kamil 551f4c4dcf4SKowalski, Kamil /** 552f4c4dcf4SKowalski, Kamil * @internal 553f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 554f4c4dcf4SKowalski, Kamil * 555f4c4dcf4SKowalski, Kamil * See header file for more information 556f4c4dcf4SKowalski, Kamil * @endinternal 557f4c4dcf4SKowalski, Kamil */ 5581668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 5591668ce6dSEd Tanous std::string_view arg2) 5601abe55efSEd Tanous { 561fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 5621668ce6dSEd Tanous std::to_array({arg1, arg2})); 563b5c07418SJames Feist } 564b5c07418SJames Feist 5651668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 5661668ce6dSEd Tanous std::string_view arg2) 567b5c07418SJames Feist { 568b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 569b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 570f4c4dcf4SKowalski, Kamil } 571f4c4dcf4SKowalski, Kamil 572f4c4dcf4SKowalski, Kamil /** 573f4c4dcf4SKowalski, Kamil * @internal 574f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 575f4c4dcf4SKowalski, Kamil * 576f4c4dcf4SKowalski, Kamil * See header file for more information 577f4c4dcf4SKowalski, Kamil * @endinternal 578f4c4dcf4SKowalski, Kamil */ 5791668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 5801abe55efSEd Tanous { 581b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 582fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 5831668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 584b5c07418SJames Feist } 585b5c07418SJames Feist 5861668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 587b5c07418SJames Feist { 588b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 589b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 590f4c4dcf4SKowalski, Kamil } 591f4c4dcf4SKowalski, Kamil 592f4c4dcf4SKowalski, Kamil /** 593f4c4dcf4SKowalski, Kamil * @internal 594cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 595cc9139ecSJason M. Bills * 596cc9139ecSJason M. Bills * See header file for more information 597cc9139ecSJason M. Bills * @endinternal 598cc9139ecSJason M. Bills */ 599b5c07418SJames Feist nlohmann::json sessionTerminated(void) 600cc9139ecSJason M. Bills { 601fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 602b5c07418SJames Feist } 603b5c07418SJames Feist 604b5c07418SJames Feist void sessionTerminated(crow::Response& res) 605b5c07418SJames Feist { 606b5c07418SJames Feist res.result(boost::beast::http::status::ok); 607b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 608cc9139ecSJason M. Bills } 609cc9139ecSJason M. Bills 610cc9139ecSJason M. Bills /** 611cc9139ecSJason M. Bills * @internal 612684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 613684bb4b8SJason M. Bills * 614684bb4b8SJason M. Bills * See header file for more information 615684bb4b8SJason M. Bills * @endinternal 616684bb4b8SJason M. Bills */ 617684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 618684bb4b8SJason M. Bills { 619fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 620684bb4b8SJason M. Bills } 621684bb4b8SJason M. Bills 622684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 623684bb4b8SJason M. Bills { 624684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 625684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 626684bb4b8SJason M. Bills } 627684bb4b8SJason M. Bills 628684bb4b8SJason M. Bills /** 629684bb4b8SJason M. Bills * @internal 630cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 631cc9139ecSJason M. Bills * 632cc9139ecSJason M. Bills * See header file for more information 633cc9139ecSJason M. Bills * @endinternal 634cc9139ecSJason M. Bills */ 6351668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 6361668ce6dSEd Tanous std::string_view arg2) 637cc9139ecSJason M. Bills { 638fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 6391668ce6dSEd Tanous std::to_array({arg1, arg2})); 640b5c07418SJames Feist } 641b5c07418SJames Feist 6421668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 6431668ce6dSEd Tanous std::string_view arg2) 644b5c07418SJames Feist { 645b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 646b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 647cc9139ecSJason M. Bills } 648cc9139ecSJason M. Bills 649cc9139ecSJason M. Bills /** 650cc9139ecSJason M. Bills * @internal 651684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 652684bb4b8SJason M. Bills * 653684bb4b8SJason M. Bills * See header file for more information 654684bb4b8SJason M. Bills * @endinternal 655684bb4b8SJason M. Bills */ 656ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1, 6571668ce6dSEd Tanous std::string_view arg2) 658684bb4b8SJason M. Bills { 6591668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 660fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 6611668ce6dSEd Tanous std::to_array({arg1str, arg2})); 662684bb4b8SJason M. Bills } 663684bb4b8SJason M. Bills 664ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 6651668ce6dSEd Tanous std::string_view arg2) 666684bb4b8SJason M. Bills { 667684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 668684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 669684bb4b8SJason M. Bills } 670684bb4b8SJason M. Bills 671684bb4b8SJason M. Bills /** 672684bb4b8SJason M. Bills * @internal 673684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 674684bb4b8SJason M. Bills * 675684bb4b8SJason M. Bills * See header file for more information 676684bb4b8SJason M. Bills * @endinternal 677684bb4b8SJason M. Bills */ 6781668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 679684bb4b8SJason M. Bills { 680fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 6811668ce6dSEd Tanous std::to_array({arg1})); 682684bb4b8SJason M. Bills } 683684bb4b8SJason M. Bills 6841668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 685684bb4b8SJason M. Bills { 686684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 687684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 688684bb4b8SJason M. Bills } 689684bb4b8SJason M. Bills 690684bb4b8SJason M. Bills /** 691684bb4b8SJason M. Bills * @internal 692684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 693684bb4b8SJason M. Bills * 694684bb4b8SJason M. Bills * See header file for more information 695684bb4b8SJason M. Bills * @endinternal 696684bb4b8SJason M. Bills */ 6971668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 698684bb4b8SJason M. Bills { 699b6cd31e1SEd Tanous return getLog( 700fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7011668ce6dSEd Tanous std::to_array({arg1})); 702684bb4b8SJason M. Bills } 703684bb4b8SJason M. Bills 7041668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 705684bb4b8SJason M. Bills { 706684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 707684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 708684bb4b8SJason M. Bills } 709684bb4b8SJason M. Bills 710684bb4b8SJason M. Bills /** 711684bb4b8SJason M. Bills * @internal 712684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 713684bb4b8SJason M. Bills * 714684bb4b8SJason M. Bills * See header file for more information 715684bb4b8SJason M. Bills * @endinternal 716684bb4b8SJason M. Bills */ 7171668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7181668ce6dSEd Tanous std::string_view arg2) 719684bb4b8SJason M. Bills { 720fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7211668ce6dSEd Tanous std::to_array({arg1, arg2})); 722684bb4b8SJason M. Bills } 723684bb4b8SJason M. Bills 7241668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7251668ce6dSEd Tanous std::string_view arg2) 726684bb4b8SJason M. Bills { 727684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 728684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 729684bb4b8SJason M. Bills } 730684bb4b8SJason M. Bills 731684bb4b8SJason M. Bills /** 732684bb4b8SJason M. Bills * @internal 733*2a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 734*2a6af81cSRamesh Iyyar * 735*2a6af81cSRamesh Iyyar * See header file for more information 736*2a6af81cSRamesh Iyyar * @endinternal 737*2a6af81cSRamesh Iyyar */ 738*2a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 739*2a6af81cSRamesh Iyyar std::string_view arg2, 740*2a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 741*2a6af81cSRamesh Iyyar { 742*2a6af81cSRamesh Iyyar return getLog( 743*2a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 744*2a6af81cSRamesh Iyyar std::to_array( 745*2a6af81cSRamesh Iyyar {arg1, arg2, std::string_view{arg3.data(), arg3.size()}})); 746*2a6af81cSRamesh Iyyar } 747*2a6af81cSRamesh Iyyar 748*2a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 749*2a6af81cSRamesh Iyyar std::string_view arg2, 750*2a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 751*2a6af81cSRamesh Iyyar { 752*2a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 753*2a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 754*2a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 755*2a6af81cSRamesh Iyyar } 756*2a6af81cSRamesh Iyyar 757*2a6af81cSRamesh Iyyar /** 758*2a6af81cSRamesh Iyyar * @internal 759684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 760684bb4b8SJason M. Bills * 761684bb4b8SJason M. Bills * See header file for more information 762684bb4b8SJason M. Bills * @endinternal 763684bb4b8SJason M. Bills */ 7641668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 7651668ce6dSEd Tanous std::string_view arg2) 766684bb4b8SJason M. Bills { 767fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 7681668ce6dSEd Tanous std::to_array({arg1, arg2})); 769684bb4b8SJason M. Bills } 770684bb4b8SJason M. Bills 7711668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 7721668ce6dSEd Tanous std::string_view arg2) 773684bb4b8SJason M. Bills { 774684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 775684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 776684bb4b8SJason M. Bills } 777684bb4b8SJason M. Bills 778684bb4b8SJason M. Bills /** 779684bb4b8SJason M. Bills * @internal 780684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 781684bb4b8SJason M. Bills * 782684bb4b8SJason M. Bills * See header file for more information 783684bb4b8SJason M. Bills * @endinternal 784684bb4b8SJason M. Bills */ 785ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1) 786684bb4b8SJason M. Bills { 7871668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 788fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 7891668ce6dSEd Tanous std::to_array({arg1str})); 790684bb4b8SJason M. Bills } 791684bb4b8SJason M. Bills 792ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res, 793ace85d60SEd Tanous const boost::urls::url_view& arg1) 794684bb4b8SJason M. Bills { 795684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 796684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 797684bb4b8SJason M. Bills } 798684bb4b8SJason M. Bills 799684bb4b8SJason M. Bills /** 800684bb4b8SJason M. Bills * @internal 801684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 802684bb4b8SJason M. Bills * 803684bb4b8SJason M. Bills * See header file for more information 804684bb4b8SJason M. Bills * @endinternal 805684bb4b8SJason M. Bills */ 806684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 807684bb4b8SJason M. Bills { 808fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 809684bb4b8SJason M. Bills } 810684bb4b8SJason M. Bills 811684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 812684bb4b8SJason M. Bills { 813684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 814684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 815684bb4b8SJason M. Bills } 816684bb4b8SJason M. Bills 817684bb4b8SJason M. Bills /** 818684bb4b8SJason M. Bills * @internal 819684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 820684bb4b8SJason M. Bills * 821684bb4b8SJason M. Bills * See header file for more information 822684bb4b8SJason M. Bills * @endinternal 823684bb4b8SJason M. Bills */ 824684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 825684bb4b8SJason M. Bills { 826fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 827684bb4b8SJason M. Bills } 828684bb4b8SJason M. Bills 829684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 830684bb4b8SJason M. Bills { 8314df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 832684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 833684bb4b8SJason M. Bills } 834684bb4b8SJason M. Bills 835684bb4b8SJason M. Bills /** 836684bb4b8SJason M. Bills * @internal 837684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 838684bb4b8SJason M. Bills * 839684bb4b8SJason M. Bills * See header file for more information 840684bb4b8SJason M. Bills * @endinternal 841684bb4b8SJason M. Bills */ 842684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 843684bb4b8SJason M. Bills { 844fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 845684bb4b8SJason M. Bills } 846684bb4b8SJason M. Bills 847684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 848684bb4b8SJason M. Bills { 849684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 850684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 851684bb4b8SJason M. Bills } 852684bb4b8SJason M. Bills 853684bb4b8SJason M. Bills /** 854684bb4b8SJason M. Bills * @internal 855684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 856684bb4b8SJason M. Bills * 857684bb4b8SJason M. Bills * See header file for more information 858684bb4b8SJason M. Bills * @endinternal 859684bb4b8SJason M. Bills */ 860684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 861684bb4b8SJason M. Bills { 862fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 863684bb4b8SJason M. Bills } 864684bb4b8SJason M. Bills 865684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 866684bb4b8SJason M. Bills { 867684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 868684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 869684bb4b8SJason M. Bills } 870684bb4b8SJason M. Bills 871684bb4b8SJason M. Bills /** 872684bb4b8SJason M. Bills * @internal 873684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 874684bb4b8SJason M. Bills * 875684bb4b8SJason M. Bills * See header file for more information 876684bb4b8SJason M. Bills * @endinternal 877684bb4b8SJason M. Bills */ 878684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 879684bb4b8SJason M. Bills { 880fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 881684bb4b8SJason M. Bills } 882684bb4b8SJason M. Bills 883684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 884684bb4b8SJason M. Bills { 885684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 886684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 887684bb4b8SJason M. Bills } 888684bb4b8SJason M. Bills 889684bb4b8SJason M. Bills /** 890684bb4b8SJason M. Bills * @internal 891f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 892f12894f8SJason M. Bills * property 893f12894f8SJason M. Bills * 894f12894f8SJason M. Bills * See header file for more information 895f12894f8SJason M. Bills * @endinternal 896f12894f8SJason M. Bills */ 8971668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 8981668ce6dSEd Tanous std::string_view arg2) 899f12894f8SJason M. Bills { 900fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9011668ce6dSEd Tanous std::to_array({arg1, arg2})); 902b5c07418SJames Feist } 903b5c07418SJames Feist 9041668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9051668ce6dSEd Tanous std::string_view arg2) 906b5c07418SJames Feist { 907b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 908b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 909f4c4dcf4SKowalski, Kamil } 910f4c4dcf4SKowalski, Kamil 911f4c4dcf4SKowalski, Kamil /** 912f4c4dcf4SKowalski, Kamil * @internal 913b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 914f4c4dcf4SKowalski, Kamil * 915f4c4dcf4SKowalski, Kamil * See header file for more information 916f4c4dcf4SKowalski, Kamil * @endinternal 917f4c4dcf4SKowalski, Kamil */ 9181668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 9191abe55efSEd Tanous { 920fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 9211668ce6dSEd Tanous std::to_array({arg1, arg2})); 922b5c07418SJames Feist } 923b5c07418SJames Feist 9241668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 9251668ce6dSEd Tanous std::string_view arg2) 926b5c07418SJames Feist { 927b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 928b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 929f4c4dcf4SKowalski, Kamil } 930f4c4dcf4SKowalski, Kamil 931f4c4dcf4SKowalski, Kamil /** 932f4c4dcf4SKowalski, Kamil * @internal 933f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 934f4c4dcf4SKowalski, Kamil * 935f4c4dcf4SKowalski, Kamil * See header file for more information 936f4c4dcf4SKowalski, Kamil * @endinternal 937f4c4dcf4SKowalski, Kamil */ 938ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1) 9391abe55efSEd Tanous { 9401668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 941fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 9421668ce6dSEd Tanous std::to_array({arg1str})); 943b5c07418SJames Feist } 944b5c07418SJames Feist 945ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 946ace85d60SEd Tanous const boost::urls::url_view& arg1) 947b5c07418SJames Feist { 948b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 949b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 950f4c4dcf4SKowalski, Kamil } 951f4c4dcf4SKowalski, Kamil 952f4c4dcf4SKowalski, Kamil /** 953f4c4dcf4SKowalski, Kamil * @internal 954f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 955f12894f8SJason M. Bills * property 956f12894f8SJason M. Bills * 957f12894f8SJason M. Bills * See header file for more information 958f12894f8SJason M. Bills * @endinternal 959f12894f8SJason M. Bills */ 9601668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 961f12894f8SJason M. Bills { 962fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 9631668ce6dSEd Tanous std::to_array({arg1})); 964b5c07418SJames Feist } 965b5c07418SJames Feist 9661668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 967b5c07418SJames Feist { 968b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 969b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 970f4c4dcf4SKowalski, Kamil } 971f4c4dcf4SKowalski, Kamil 972f4c4dcf4SKowalski, Kamil /** 973f4c4dcf4SKowalski, Kamil * @internal 974f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 975f4c4dcf4SKowalski, Kamil * 976f4c4dcf4SKowalski, Kamil * See header file for more information 977f4c4dcf4SKowalski, Kamil * @endinternal 978f4c4dcf4SKowalski, Kamil */ 9791668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 9801668ce6dSEd Tanous std::string_view arg2) 9811abe55efSEd Tanous { 982b6cd31e1SEd Tanous return getLog( 983fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 9841668ce6dSEd Tanous std::to_array({arg1, arg2})); 985b5c07418SJames Feist } 986b5c07418SJames Feist 9871668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 9881668ce6dSEd Tanous std::string_view arg2) 989b5c07418SJames Feist { 990b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 991b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 992b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 993f4c4dcf4SKowalski, Kamil } 994f4c4dcf4SKowalski, Kamil 995f4c4dcf4SKowalski, Kamil /** 996f4c4dcf4SKowalski, Kamil * @internal 997f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 998f4c4dcf4SKowalski, Kamil * 999f4c4dcf4SKowalski, Kamil * See header file for more information 1000f4c4dcf4SKowalski, Kamil * @endinternal 1001f4c4dcf4SKowalski, Kamil */ 1002b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10031abe55efSEd Tanous { 1004fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1005b5c07418SJames Feist } 1006b5c07418SJames Feist 1007b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1008b5c07418SJames Feist { 1009b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1010b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1011f4c4dcf4SKowalski, Kamil } 1012f4c4dcf4SKowalski, Kamil 1013f4c4dcf4SKowalski, Kamil /** 1014f4c4dcf4SKowalski, Kamil * @internal 1015f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1016f4c4dcf4SKowalski, Kamil * 1017f4c4dcf4SKowalski, Kamil * See header file for more information 1018f4c4dcf4SKowalski, Kamil * @endinternal 1019f4c4dcf4SKowalski, Kamil */ 10201668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 10211668ce6dSEd Tanous std::string_view arg2) 10221abe55efSEd Tanous { 1023fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 10241668ce6dSEd Tanous std::to_array({arg1, arg2})); 1025b5c07418SJames Feist } 1026b5c07418SJames Feist 10271668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 10281668ce6dSEd Tanous std::string_view arg2) 1029b5c07418SJames Feist { 1030b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1031b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1032f4c4dcf4SKowalski, Kamil } 1033f4c4dcf4SKowalski, Kamil 1034f4c4dcf4SKowalski, Kamil /** 1035f4c4dcf4SKowalski, Kamil * @internal 1036f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1037f4c4dcf4SKowalski, Kamil * 1038f4c4dcf4SKowalski, Kamil * See header file for more information 1039f4c4dcf4SKowalski, Kamil * @endinternal 1040f4c4dcf4SKowalski, Kamil */ 10411668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 10421668ce6dSEd Tanous std::string_view arg2) 10431abe55efSEd Tanous { 1044fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 10451668ce6dSEd Tanous std::to_array({arg1, arg2})); 1046b5c07418SJames Feist } 1047b5c07418SJames Feist 10481668ce6dSEd Tanous void actionParameterNotSupported(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 actionParameterNotSupported(arg1, arg2)); 1054f4c4dcf4SKowalski, Kamil } 1055f4c4dcf4SKowalski, Kamil 1056f4c4dcf4SKowalski, Kamil /** 1057f4c4dcf4SKowalski, Kamil * @internal 1058f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1059f4c4dcf4SKowalski, Kamil * 1060f4c4dcf4SKowalski, Kamil * See header file for more information 1061f4c4dcf4SKowalski, Kamil * @endinternal 1062f4c4dcf4SKowalski, Kamil */ 1063ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 10641668ce6dSEd Tanous std::string_view arg2) 10651abe55efSEd Tanous { 10661668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1067b6cd31e1SEd Tanous return getLog( 1068fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 10691668ce6dSEd Tanous std::to_array({arg1str, arg2})); 1070b5c07418SJames Feist } 1071b5c07418SJames Feist 1072ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1073ace85d60SEd Tanous const boost::urls::url_view& arg1, 10741668ce6dSEd Tanous std::string_view arg2) 1075b5c07418SJames Feist { 1076b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1077b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1078b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1079f4c4dcf4SKowalski, Kamil } 1080f4c4dcf4SKowalski, Kamil 1081f4c4dcf4SKowalski, Kamil /** 1082f4c4dcf4SKowalski, Kamil * @internal 1083f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1084f4c4dcf4SKowalski, Kamil * 1085f4c4dcf4SKowalski, Kamil * See header file for more information 1086f4c4dcf4SKowalski, Kamil * @endinternal 1087f4c4dcf4SKowalski, Kamil */ 1088b5c07418SJames Feist nlohmann::json accountRemoved(void) 10891abe55efSEd Tanous { 1090fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1091b5c07418SJames Feist } 1092b5c07418SJames Feist 1093b5c07418SJames Feist void accountRemoved(crow::Response& res) 1094b5c07418SJames Feist { 1095b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1096b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1097f4c4dcf4SKowalski, Kamil } 1098f4c4dcf4SKowalski, Kamil 1099f4c4dcf4SKowalski, Kamil /** 1100f4c4dcf4SKowalski, Kamil * @internal 1101f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1102f4c4dcf4SKowalski, Kamil * 1103f4c4dcf4SKowalski, Kamil * See header file for more information 1104f4c4dcf4SKowalski, Kamil * @endinternal 1105f4c4dcf4SKowalski, Kamil */ 1106ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1) 11071abe55efSEd Tanous { 11081668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1109fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 11101668ce6dSEd Tanous std::to_array({arg1str})); 1111b5c07418SJames Feist } 1112b5c07418SJames Feist 1113ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1) 1114b5c07418SJames Feist { 1115b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1116b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1117f4c4dcf4SKowalski, Kamil } 1118f4c4dcf4SKowalski, Kamil 1119f4c4dcf4SKowalski, Kamil /** 1120f4c4dcf4SKowalski, Kamil * @internal 1121f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1122f4c4dcf4SKowalski, Kamil * 1123f4c4dcf4SKowalski, Kamil * See header file for more information 1124f4c4dcf4SKowalski, Kamil * @endinternal 1125f4c4dcf4SKowalski, Kamil */ 1126b5c07418SJames Feist nlohmann::json queryNotSupported(void) 11271abe55efSEd Tanous { 1128fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1129b5c07418SJames Feist } 1130b5c07418SJames Feist 1131b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1132b5c07418SJames Feist { 1133b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1134b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1135f4c4dcf4SKowalski, Kamil } 1136f4c4dcf4SKowalski, Kamil 1137f4c4dcf4SKowalski, Kamil /** 1138f4c4dcf4SKowalski, Kamil * @internal 1139f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1140f4c4dcf4SKowalski, Kamil * 1141f4c4dcf4SKowalski, Kamil * See header file for more information 1142f4c4dcf4SKowalski, Kamil * @endinternal 1143f4c4dcf4SKowalski, Kamil */ 1144b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 11451abe55efSEd Tanous { 1146b6cd31e1SEd Tanous return getLog( 1147fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1148b5c07418SJames Feist } 1149b5c07418SJames Feist 1150b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1151b5c07418SJames Feist { 1152b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1153b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1154f4c4dcf4SKowalski, Kamil } 1155f4c4dcf4SKowalski, Kamil 1156f4c4dcf4SKowalski, Kamil /** 1157f4c4dcf4SKowalski, Kamil * @internal 1158f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1159f4c4dcf4SKowalski, Kamil * 1160f4c4dcf4SKowalski, Kamil * See header file for more information 1161f4c4dcf4SKowalski, Kamil * @endinternal 1162f4c4dcf4SKowalski, Kamil */ 1163b5c07418SJames Feist nlohmann::json generalError(void) 11641abe55efSEd Tanous { 1165fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1166b5c07418SJames Feist } 1167b5c07418SJames Feist 1168b5c07418SJames Feist void generalError(crow::Response& res) 1169b5c07418SJames Feist { 1170b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1171b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1172f4c4dcf4SKowalski, Kamil } 1173f4c4dcf4SKowalski, Kamil 1174f4c4dcf4SKowalski, Kamil /** 1175f4c4dcf4SKowalski, Kamil * @internal 1176f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1177f4c4dcf4SKowalski, Kamil * 1178f4c4dcf4SKowalski, Kamil * See header file for more information 1179f4c4dcf4SKowalski, Kamil * @endinternal 1180f4c4dcf4SKowalski, Kamil */ 1181b5c07418SJames Feist nlohmann::json success(void) 11821abe55efSEd Tanous { 1183fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1184b5c07418SJames Feist } 1185b5c07418SJames Feist 1186b5c07418SJames Feist void success(crow::Response& res) 1187b5c07418SJames Feist { 1188b5c07418SJames Feist // don't set res.result here because success is the default and any 1189b5c07418SJames Feist // error should overwrite the default 1190b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1191f12894f8SJason M. Bills } 1192f12894f8SJason M. Bills 1193f12894f8SJason M. Bills /** 1194f12894f8SJason M. Bills * @internal 1195f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1196f4c4dcf4SKowalski, Kamil * 1197f4c4dcf4SKowalski, Kamil * See header file for more information 1198f4c4dcf4SKowalski, Kamil * @endinternal 1199f4c4dcf4SKowalski, Kamil */ 1200b5c07418SJames Feist nlohmann::json created(void) 12011abe55efSEd Tanous { 1202fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1203b5c07418SJames Feist } 1204b5c07418SJames Feist 1205b5c07418SJames Feist void created(crow::Response& res) 1206b5c07418SJames Feist { 1207b5c07418SJames Feist res.result(boost::beast::http::status::created); 1208b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1209f4c4dcf4SKowalski, Kamil } 1210f4c4dcf4SKowalski, Kamil 1211f4c4dcf4SKowalski, Kamil /** 1212f4c4dcf4SKowalski, Kamil * @internal 1213cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1214cc9139ecSJason M. Bills * 1215cc9139ecSJason M. Bills * See header file for more information 1216cc9139ecSJason M. Bills * @endinternal 1217cc9139ecSJason M. Bills */ 1218b5c07418SJames Feist nlohmann::json noOperation(void) 1219cc9139ecSJason M. Bills { 1220fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1221b5c07418SJames Feist } 1222b5c07418SJames Feist 1223b5c07418SJames Feist void noOperation(crow::Response& res) 1224b5c07418SJames Feist { 1225b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1226b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1227cc9139ecSJason M. Bills } 1228cc9139ecSJason M. Bills 1229cc9139ecSJason M. Bills /** 1230cc9139ecSJason M. Bills * @internal 1231b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1232b5c07418SJames Feist * property 1233f12894f8SJason M. Bills * 1234f12894f8SJason M. Bills * See header file for more information 1235f12894f8SJason M. Bills * @endinternal 1236f12894f8SJason M. Bills */ 12371668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1238b5c07418SJames Feist { 1239fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 12401668ce6dSEd Tanous std::to_array({arg1})); 1241b5c07418SJames Feist } 1242b5c07418SJames Feist 12431668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1244f12894f8SJason M. Bills { 1245f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1246b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1); 1247f4c4dcf4SKowalski, Kamil } 1248f4c4dcf4SKowalski, Kamil 1249f4c4dcf4SKowalski, Kamil /** 1250f4c4dcf4SKowalski, Kamil * @internal 1251f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1252f4c4dcf4SKowalski, Kamil * 1253f4c4dcf4SKowalski, Kamil * See header file for more information 1254f4c4dcf4SKowalski, Kamil * @endinternal 1255f4c4dcf4SKowalski, Kamil */ 1256b5c07418SJames Feist nlohmann::json noValidSession(void) 12571abe55efSEd Tanous { 1258fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1259b5c07418SJames Feist } 1260b5c07418SJames Feist 1261b5c07418SJames Feist void noValidSession(crow::Response& res) 1262b5c07418SJames Feist { 1263b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1264b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1265f4c4dcf4SKowalski, Kamil } 1266f4c4dcf4SKowalski, Kamil 1267f4c4dcf4SKowalski, Kamil /** 1268f4c4dcf4SKowalski, Kamil * @internal 1269f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1270f4c4dcf4SKowalski, Kamil * 1271f4c4dcf4SKowalski, Kamil * See header file for more information 1272f4c4dcf4SKowalski, Kamil * @endinternal 1273f4c4dcf4SKowalski, Kamil */ 1274ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1) 12751abe55efSEd Tanous { 12761668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1277fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 12781668ce6dSEd Tanous std::to_array({arg1str})); 1279b5c07418SJames Feist } 1280b5c07418SJames Feist 1281ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1) 1282b5c07418SJames Feist { 1283b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1284b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1285f4c4dcf4SKowalski, Kamil } 1286f4c4dcf4SKowalski, Kamil 1287f4c4dcf4SKowalski, Kamil /** 1288f4c4dcf4SKowalski, Kamil * @internal 1289f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1290f4c4dcf4SKowalski, Kamil * 1291f4c4dcf4SKowalski, Kamil * See header file for more information 1292f4c4dcf4SKowalski, Kamil * @endinternal 1293f4c4dcf4SKowalski, Kamil */ 1294b5c07418SJames Feist nlohmann::json resourceInStandby(void) 12951abe55efSEd Tanous { 1296fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1297b5c07418SJames Feist } 1298b5c07418SJames Feist 1299b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1300b5c07418SJames Feist { 1301b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1302b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1303f4c4dcf4SKowalski, Kamil } 1304f4c4dcf4SKowalski, Kamil 1305f4c4dcf4SKowalski, Kamil /** 1306f4c4dcf4SKowalski, Kamil * @internal 1307f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1308f4c4dcf4SKowalski, Kamil * 1309f4c4dcf4SKowalski, Kamil * See header file for more information 1310f4c4dcf4SKowalski, Kamil * @endinternal 1311f4c4dcf4SKowalski, Kamil */ 13121668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 13131668ce6dSEd Tanous std::string_view arg2, 13141668ce6dSEd Tanous std::string_view arg3) 13151abe55efSEd Tanous { 1316b6cd31e1SEd Tanous return getLog( 1317fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 13181668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1319b5c07418SJames Feist } 1320b5c07418SJames Feist 13211668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 13221668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1323b5c07418SJames Feist { 1324b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1325b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1326b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1327f4c4dcf4SKowalski, Kamil } 1328f4c4dcf4SKowalski, Kamil 1329f4c4dcf4SKowalski, Kamil /** 1330f4c4dcf4SKowalski, Kamil * @internal 1331f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1332f4c4dcf4SKowalski, Kamil * 1333f4c4dcf4SKowalski, Kamil * See header file for more information 1334f4c4dcf4SKowalski, Kamil * @endinternal 1335f4c4dcf4SKowalski, Kamil */ 1336b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 13371abe55efSEd Tanous { 1338fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1339b5c07418SJames Feist } 1340b5c07418SJames Feist 1341b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1342b5c07418SJames Feist { 1343b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1344b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1345f4c4dcf4SKowalski, Kamil } 1346f4c4dcf4SKowalski, Kamil 1347f4c4dcf4SKowalski, Kamil /** 1348f4c4dcf4SKowalski, Kamil * @internal 1349f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1350f4c4dcf4SKowalski, Kamil * 1351f4c4dcf4SKowalski, Kamil * See header file for more information 1352f4c4dcf4SKowalski, Kamil * @endinternal 1353f4c4dcf4SKowalski, Kamil */ 13541668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 13551abe55efSEd Tanous { 1356fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 13571668ce6dSEd Tanous std::to_array({arg1})); 1358b5c07418SJames Feist } 1359b5c07418SJames Feist 13601668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1361b5c07418SJames Feist { 1362b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1363b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1364f4c4dcf4SKowalski, Kamil } 1365f4c4dcf4SKowalski, Kamil 1366f4c4dcf4SKowalski, Kamil /** 1367f4c4dcf4SKowalski, Kamil * @internal 1368f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1369f4c4dcf4SKowalski, Kamil * 1370f4c4dcf4SKowalski, Kamil * See header file for more information 1371f4c4dcf4SKowalski, Kamil * @endinternal 1372f4c4dcf4SKowalski, Kamil */ 13735187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 13741abe55efSEd Tanous { 1375b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1376fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 13771668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1378b5c07418SJames Feist } 1379b5c07418SJames Feist 13805187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1381b5c07418SJames Feist { 1382b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1383b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1384f4c4dcf4SKowalski, Kamil } 1385f4c4dcf4SKowalski, Kamil 1386f4c4dcf4SKowalski, Kamil /** 1387f4c4dcf4SKowalski, Kamil * @internal 1388f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1389f4c4dcf4SKowalski, Kamil * 1390f4c4dcf4SKowalski, Kamil * See header file for more information 1391f4c4dcf4SKowalski, Kamil * @endinternal 1392f4c4dcf4SKowalski, Kamil */ 1393b5c07418SJames Feist nlohmann::json emptyJSON(void) 13941abe55efSEd Tanous { 1395fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1396b5c07418SJames Feist } 1397b5c07418SJames Feist 1398b5c07418SJames Feist void emptyJSON(crow::Response& res) 1399b5c07418SJames Feist { 1400b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1401b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1402f4c4dcf4SKowalski, Kamil } 1403f4c4dcf4SKowalski, Kamil 1404f4c4dcf4SKowalski, Kamil /** 1405f4c4dcf4SKowalski, Kamil * @internal 1406f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1407f4c4dcf4SKowalski, Kamil * 1408f4c4dcf4SKowalski, Kamil * See header file for more information 1409f4c4dcf4SKowalski, Kamil * @endinternal 1410f4c4dcf4SKowalski, Kamil */ 1411b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 14121abe55efSEd Tanous { 1413fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1414b6cd31e1SEd Tanous {}); 1415b5c07418SJames Feist } 1416b5c07418SJames Feist 1417b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1418b5c07418SJames Feist { 1419b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1420b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1421f4c4dcf4SKowalski, Kamil } 1422f4c4dcf4SKowalski, Kamil 1423f4c4dcf4SKowalski, Kamil /** 1424f4c4dcf4SKowalski, Kamil * @internal 1425684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1426684bb4b8SJason M. Bills * 1427684bb4b8SJason M. Bills * See header file for more information 1428684bb4b8SJason M. Bills * @endinternal 1429684bb4b8SJason M. Bills */ 1430684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1431684bb4b8SJason M. Bills { 1432b6cd31e1SEd Tanous return getLog( 1433fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1434684bb4b8SJason M. Bills } 1435684bb4b8SJason M. Bills 1436684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1437684bb4b8SJason M. Bills { 1438684bb4b8SJason M. Bills res.result(boost::beast::http::status::forbidden); 1439684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1440684bb4b8SJason M. Bills } 1441684bb4b8SJason M. Bills 1442684bb4b8SJason M. Bills /** 1443684bb4b8SJason M. Bills * @internal 1444684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1445684bb4b8SJason M. Bills * 1446684bb4b8SJason M. Bills * See header file for more information 1447684bb4b8SJason M. Bills * @endinternal 1448684bb4b8SJason M. Bills */ 1449684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1450684bb4b8SJason M. Bills { 1451fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1452fffb8c1fSEd Tanous {}); 1453684bb4b8SJason M. Bills } 1454684bb4b8SJason M. Bills 1455684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1456684bb4b8SJason M. Bills { 1457684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1458684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1459684bb4b8SJason M. Bills } 1460684bb4b8SJason M. Bills 1461684bb4b8SJason M. Bills /** 1462684bb4b8SJason M. Bills * @internal 1463f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1464f4c4dcf4SKowalski, Kamil * 1465f4c4dcf4SKowalski, Kamil * See header file for more information 1466f4c4dcf4SKowalski, Kamil * @endinternal 1467f4c4dcf4SKowalski, Kamil */ 1468b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 14691abe55efSEd Tanous { 1470fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1471b5c07418SJames Feist } 1472b5c07418SJames Feist 1473b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1474b5c07418SJames Feist { 1475b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1476b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1477f4c4dcf4SKowalski, Kamil } 1478f4c4dcf4SKowalski, Kamil 1479f4c4dcf4SKowalski, Kamil /** 1480f4c4dcf4SKowalski, Kamil * @internal 1481f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1482f4c4dcf4SKowalski, Kamil * 1483f4c4dcf4SKowalski, Kamil * See header file for more information 1484f4c4dcf4SKowalski, Kamil * @endinternal 1485f4c4dcf4SKowalski, Kamil */ 14861668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 14871668ce6dSEd Tanous std::string_view arg2) 1488b5c07418SJames Feist { 1489fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 14901668ce6dSEd Tanous std::to_array({arg1, arg2})); 1491b5c07418SJames Feist } 1492b5c07418SJames Feist 14931668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 14941668ce6dSEd Tanous std::string_view arg2) 14951abe55efSEd Tanous { 1496f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1497b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1498f4c4dcf4SKowalski, Kamil } 1499f4c4dcf4SKowalski, Kamil 1500f4c4dcf4SKowalski, Kamil /** 1501f4c4dcf4SKowalski, Kamil * @internal 1502f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1503f4c4dcf4SKowalski, Kamil * 1504f4c4dcf4SKowalski, Kamil * See header file for more information 1505f4c4dcf4SKowalski, Kamil * @endinternal 1506f4c4dcf4SKowalski, Kamil */ 1507b5c07418SJames Feist nlohmann::json accountNotModified(void) 15081abe55efSEd Tanous { 1509fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1510b5c07418SJames Feist } 1511b5c07418SJames Feist 1512b5c07418SJames Feist void accountNotModified(crow::Response& res) 1513b5c07418SJames Feist { 1514b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1515b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1516f4c4dcf4SKowalski, Kamil } 1517f4c4dcf4SKowalski, Kamil 1518f4c4dcf4SKowalski, Kamil /** 1519f4c4dcf4SKowalski, Kamil * @internal 1520f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1521f4c4dcf4SKowalski, Kamil * 1522f4c4dcf4SKowalski, Kamil * See header file for more information 1523f4c4dcf4SKowalski, Kamil * @endinternal 1524f4c4dcf4SKowalski, Kamil */ 15251668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 15261668ce6dSEd Tanous std::string_view arg2) 15271abe55efSEd Tanous { 1528fffb8c1fSEd Tanous return getLog( 1529fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 15301668ce6dSEd Tanous std::to_array({arg1, arg2})); 1531b5c07418SJames Feist } 1532b5c07418SJames Feist 15331668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 15341668ce6dSEd Tanous std::string_view arg2) 1535b5c07418SJames Feist { 1536b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1537b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1538b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1539f4c4dcf4SKowalski, Kamil } 1540f4c4dcf4SKowalski, Kamil 1541f4c4dcf4SKowalski, Kamil /** 1542f4c4dcf4SKowalski, Kamil * @internal 1543b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1544b5c07418SJames Feist * property 1545f12894f8SJason M. Bills * 1546f12894f8SJason M. Bills * See header file for more information 1547f12894f8SJason M. Bills * @endinternal 1548f12894f8SJason M. Bills */ 15491668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1550f12894f8SJason M. Bills { 1551fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 15521668ce6dSEd Tanous std::to_array({arg1})); 1553b5c07418SJames Feist } 1554b5c07418SJames Feist 15551668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1556b5c07418SJames Feist { 1557b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1558b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1559f4c4dcf4SKowalski, Kamil } 1560f4c4dcf4SKowalski, Kamil 1561f4c4dcf4SKowalski, Kamil /** 1562f4c4dcf4SKowalski, Kamil * @internal 1563f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1564f4c4dcf4SKowalski, Kamil * 1565f4c4dcf4SKowalski, Kamil * See header file for more information 1566f4c4dcf4SKowalski, Kamil * @endinternal 1567f4c4dcf4SKowalski, Kamil */ 15681668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 15691abe55efSEd Tanous { 1570fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 15711668ce6dSEd Tanous std::to_array({arg1})); 1572b5c07418SJames Feist } 1573b5c07418SJames Feist 15741668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1575b5c07418SJames Feist { 1576b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1577b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1578f4c4dcf4SKowalski, Kamil } 1579f4c4dcf4SKowalski, Kamil 1580f4c4dcf4SKowalski, Kamil /** 1581f4c4dcf4SKowalski, Kamil * @internal 1582f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1583f4c4dcf4SKowalski, Kamil * 1584f4c4dcf4SKowalski, Kamil * See header file for more information 1585f4c4dcf4SKowalski, Kamil * @endinternal 1586f4c4dcf4SKowalski, Kamil */ 1587b5c07418SJames Feist nlohmann::json accountModified(void) 15881abe55efSEd Tanous { 1589fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1590b5c07418SJames Feist } 1591b5c07418SJames Feist 1592b5c07418SJames Feist void accountModified(crow::Response& res) 1593b5c07418SJames Feist { 1594b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1595b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1596f4c4dcf4SKowalski, Kamil } 1597f4c4dcf4SKowalski, Kamil 1598f4c4dcf4SKowalski, Kamil /** 1599f4c4dcf4SKowalski, Kamil * @internal 1600f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1601f4c4dcf4SKowalski, Kamil * 1602f4c4dcf4SKowalski, Kamil * See header file for more information 1603f4c4dcf4SKowalski, Kamil * @endinternal 1604f4c4dcf4SKowalski, Kamil */ 16051668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 16061668ce6dSEd Tanous std::string_view arg2, 16071668ce6dSEd Tanous std::string_view arg3) 16081abe55efSEd Tanous { 1609fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 16101668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1611b5c07418SJames Feist } 1612b5c07418SJames Feist 16131668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 16141668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1615b5c07418SJames Feist { 1616b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1617b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1618b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1619f4c4dcf4SKowalski, Kamil } 1620f4c4dcf4SKowalski, Kamil 1621b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1) 1622b6cd31e1SEd Tanous { 16231668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1624fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 16251668ce6dSEd Tanous std::to_array({arg1str})); 1626b6cd31e1SEd Tanous } 1627b6cd31e1SEd Tanous 16283bf4e632SJoseph Reynolds /** 16293bf4e632SJoseph Reynolds * @internal 16303bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 16313bf4e632SJoseph Reynolds * 16323bf4e632SJoseph Reynolds * See header file for more information 16333bf4e632SJoseph Reynolds * @endinternal 16343bf4e632SJoseph Reynolds */ 1635ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res, 1636ace85d60SEd Tanous const boost::urls::url_view& arg1) 16373bf4e632SJoseph Reynolds { 1638b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 16393bf4e632SJoseph Reynolds } 16403bf4e632SJoseph Reynolds 16411668ce6dSEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 16421668ce6dSEd Tanous std::string_view arg2) 16434cde5d90SJames Feist { 16444cde5d90SJames Feist res.result(boost::beast::http::status::bad_request); 16454cde5d90SJames Feist addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 16464cde5d90SJames Feist } 16474cde5d90SJames Feist 16484cde5d90SJames Feist /** 16494cde5d90SJames Feist * @internal 16504cde5d90SJames Feist * @brief Formats Invalid File message into JSON 16514cde5d90SJames Feist * 16524cde5d90SJames Feist * See header file for more information 16534cde5d90SJames Feist * @endinternal 16544cde5d90SJames Feist */ 16551668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 16564cde5d90SJames Feist { 16571668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 16581668ce6dSEd Tanous msg += arg1; 16591668ce6dSEd Tanous msg += ": "; 16601668ce6dSEd Tanous msg += arg2; 16611668ce6dSEd Tanous msg += "."; 16624cde5d90SJames Feist return nlohmann::json{ 16633e082749SAsmitha Karunanithi {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"}, 16644a0bf539SManojkiran Eda {"MessageId", "OpenBMC.0.2.InvalidUpload"}, 16651668ce6dSEd Tanous {"Message", std::move(msg)}, 16664cde5d90SJames Feist {"MessageArgs", {arg1, arg2}}, 1667684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 16684cde5d90SJames Feist {"Resolution", "None."}}; 16694cde5d90SJames Feist } 1670f4c4dcf4SKowalski, Kamil } // namespace messages 1671f4c4dcf4SKowalski, Kamil 1672d425c6f6SEd Tanous } // namespace redfish 1673