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 77f4c4dcf4SKowalski, Kamil // This check could technically be done in 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 89f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 90f12894f8SJason M. Bills const nlohmann::json& message) 911abe55efSEd Tanous { 921abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 931abe55efSEd Tanous { 94f4c4dcf4SKowalski, Kamil // Force object to be an array 9555c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 96f4c4dcf4SKowalski, Kamil } 97f4c4dcf4SKowalski, Kamil 9855c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 99f4c4dcf4SKowalski, Kamil } 100f4c4dcf4SKowalski, Kamil 101f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 102f12894f8SJason M. Bills const nlohmann::json& message, 1031668ce6dSEd Tanous std::string_view fieldPath) 1041abe55efSEd Tanous { 1051668ce6dSEd Tanous std::string extendedInfo(fieldPath); 1061668ce6dSEd Tanous extendedInfo += messages::messageAnnotation; 107f4c4dcf4SKowalski, Kamil 1081668ce6dSEd Tanous nlohmann::json& field = target[extendedInfo]; 1091668ce6dSEd Tanous if (!field.is_array()) 1101abe55efSEd Tanous { 111f4c4dcf4SKowalski, Kamil // Force object to be an array 1121668ce6dSEd Tanous field = nlohmann::json::array(); 113f4c4dcf4SKowalski, Kamil } 114f4c4dcf4SKowalski, Kamil 115f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 1161668ce6dSEd Tanous field.push_back(message); 117f4c4dcf4SKowalski, Kamil } 118f4c4dcf4SKowalski, Kamil 119f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name, 120b6cd31e1SEd Tanous std::span<const std::string_view> args) 121b6cd31e1SEd Tanous { 122b6cd31e1SEd Tanous size_t index = static_cast<size_t>(name); 123fffb8c1fSEd Tanous if (index >= redfish::registries::base::registry.size()) 124b6cd31e1SEd Tanous { 125b6cd31e1SEd Tanous return {}; 126b6cd31e1SEd Tanous } 12765e4f1f7SEd Tanous return getLogFromRegistry(redfish::registries::base::header, 12865e4f1f7SEd Tanous redfish::registries::base::registry, index, args); 129b6cd31e1SEd Tanous } 130b6cd31e1SEd Tanous 131f4c4dcf4SKowalski, Kamil /** 132f4c4dcf4SKowalski, Kamil * @internal 133f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 134f4c4dcf4SKowalski, Kamil * 135f4c4dcf4SKowalski, Kamil * See header file for more information 136f4c4dcf4SKowalski, Kamil * @endinternal 137f4c4dcf4SKowalski, Kamil */ 138b5c07418SJames Feist nlohmann::json resourceInUse(void) 1391abe55efSEd Tanous { 140fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInUse, {}); 141b5c07418SJames Feist } 142b5c07418SJames Feist 143b5c07418SJames Feist void resourceInUse(crow::Response& res) 144b5c07418SJames Feist { 145b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 146b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 147f4c4dcf4SKowalski, Kamil } 148f4c4dcf4SKowalski, Kamil 149f4c4dcf4SKowalski, Kamil /** 150f4c4dcf4SKowalski, Kamil * @internal 151f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 152f4c4dcf4SKowalski, Kamil * 153f4c4dcf4SKowalski, Kamil * See header file for more information 154f4c4dcf4SKowalski, Kamil * @endinternal 155f4c4dcf4SKowalski, Kamil */ 156b5c07418SJames Feist nlohmann::json malformedJSON(void) 1571abe55efSEd Tanous { 158fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::malformedJSON, {}); 159b5c07418SJames Feist } 160b5c07418SJames Feist 161b5c07418SJames Feist void malformedJSON(crow::Response& res) 162b5c07418SJames Feist { 163b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 164b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 165f4c4dcf4SKowalski, Kamil } 166f4c4dcf4SKowalski, Kamil 167f4c4dcf4SKowalski, Kamil /** 168f4c4dcf4SKowalski, Kamil * @internal 169f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 170f4c4dcf4SKowalski, Kamil * 171f4c4dcf4SKowalski, Kamil * See header file for more information 172f4c4dcf4SKowalski, Kamil * @endinternal 173f4c4dcf4SKowalski, Kamil */ 174ace85d60SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1) 1751abe55efSEd Tanous { 176b6cd31e1SEd Tanous std::array<std::string_view, 1> args{ 177b6cd31e1SEd Tanous std::string_view{arg1.data(), arg1.size()}}; 178fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 179b5c07418SJames Feist } 180b5c07418SJames Feist 181ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res, 182ace85d60SEd Tanous const boost::urls::url_view& arg1) 183b5c07418SJames Feist { 184b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 185b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 186f4c4dcf4SKowalski, Kamil } 187f4c4dcf4SKowalski, Kamil 188f4c4dcf4SKowalski, Kamil /** 189f4c4dcf4SKowalski, Kamil * @internal 190f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 191f4c4dcf4SKowalski, Kamil * 192f4c4dcf4SKowalski, Kamil * See header file for more information 193f4c4dcf4SKowalski, Kamil * @endinternal 194f4c4dcf4SKowalski, Kamil */ 1951668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 1961668ce6dSEd Tanous std::string_view arg2, 1971668ce6dSEd Tanous std::string_view arg3) 1981abe55efSEd Tanous { 199fffb8c1fSEd Tanous return getLog( 200fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2011668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 202b5c07418SJames Feist } 203b5c07418SJames Feist 2041668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2051668ce6dSEd Tanous std::string_view arg2, 2061668ce6dSEd Tanous std::string_view arg3) 207b5c07418SJames Feist { 208b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 209b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 210b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 211f4c4dcf4SKowalski, Kamil } 212f4c4dcf4SKowalski, Kamil 213f4c4dcf4SKowalski, Kamil /** 214f4c4dcf4SKowalski, Kamil * @internal 215f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 216f4c4dcf4SKowalski, Kamil * 217f4c4dcf4SKowalski, Kamil * See header file for more information 218f4c4dcf4SKowalski, Kamil * @endinternal 219f4c4dcf4SKowalski, Kamil */ 220b5c07418SJames Feist nlohmann::json internalError(void) 2211abe55efSEd Tanous { 222fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 223b5c07418SJames Feist } 224b5c07418SJames Feist 225df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 226b5c07418SJames Feist { 227df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 228df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 229df5415fcSEd Tanous << location.function_name() << "`: "; 230b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 231b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 232f12894f8SJason M. Bills } 233f12894f8SJason M. Bills 234f12894f8SJason M. Bills /** 235f12894f8SJason M. Bills * @internal 236f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 237f4c4dcf4SKowalski, Kamil * 238f4c4dcf4SKowalski, Kamil * See header file for more information 239f4c4dcf4SKowalski, Kamil * @endinternal 240f4c4dcf4SKowalski, Kamil */ 241b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2421abe55efSEd Tanous { 243fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 244fffb8c1fSEd Tanous {}); 245b5c07418SJames Feist } 246b5c07418SJames Feist 247b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 248b5c07418SJames Feist { 249b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 250b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 251f4c4dcf4SKowalski, Kamil } 252f4c4dcf4SKowalski, Kamil 253f4c4dcf4SKowalski, Kamil /** 254f4c4dcf4SKowalski, Kamil * @internal 255f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 256f4c4dcf4SKowalski, Kamil * 257f4c4dcf4SKowalski, Kamil * See header file for more information 258f4c4dcf4SKowalski, Kamil * @endinternal 259f4c4dcf4SKowalski, Kamil */ 260ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 2611668ce6dSEd Tanous std::string_view arg2) 2621abe55efSEd Tanous { 263b6cd31e1SEd Tanous return getLog( 264fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriUnauthorized, 2651668ce6dSEd Tanous std::to_array({std::string_view{arg1.data(), arg1.size()}, arg2})); 266b5c07418SJames Feist } 267b5c07418SJames Feist 268ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 269ace85d60SEd Tanous const boost::urls::url_view& arg1, 2701668ce6dSEd Tanous std::string_view arg2) 271b5c07418SJames Feist { 272b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 273b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 274f4c4dcf4SKowalski, Kamil } 275f4c4dcf4SKowalski, Kamil 276f4c4dcf4SKowalski, Kamil /** 277f4c4dcf4SKowalski, Kamil * @internal 278f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 279f4c4dcf4SKowalski, Kamil * 280f4c4dcf4SKowalski, Kamil * See header file for more information 281f4c4dcf4SKowalski, Kamil * @endinternal 282f4c4dcf4SKowalski, Kamil */ 2831668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 2841668ce6dSEd Tanous std::string_view arg2) 285b5c07418SJames Feist { 286fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 2871668ce6dSEd Tanous std::to_array({arg1, arg2})); 288b5c07418SJames Feist } 289b5c07418SJames Feist 2901668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 2911668ce6dSEd Tanous std::string_view arg2) 2921abe55efSEd Tanous { 293f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 294b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 295f4c4dcf4SKowalski, Kamil } 296f4c4dcf4SKowalski, Kamil 297f4c4dcf4SKowalski, Kamil /** 298f4c4dcf4SKowalski, Kamil * @internal 299f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 300f4c4dcf4SKowalski, Kamil * 301f4c4dcf4SKowalski, Kamil * See header file for more information 302f4c4dcf4SKowalski, Kamil * @endinternal 303f4c4dcf4SKowalski, Kamil */ 304b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3051abe55efSEd Tanous { 306fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 307fffb8c1fSEd Tanous {}); 308b5c07418SJames Feist } 309b5c07418SJames Feist 310b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 311b5c07418SJames Feist { 312*44c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 313b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 314f4c4dcf4SKowalski, Kamil } 315f4c4dcf4SKowalski, Kamil 316f4c4dcf4SKowalski, Kamil /** 317f4c4dcf4SKowalski, Kamil * @internal 318f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 319f4c4dcf4SKowalski, Kamil * 320f4c4dcf4SKowalski, Kamil * See header file for more information 321f4c4dcf4SKowalski, Kamil * @endinternal 322f4c4dcf4SKowalski, Kamil */ 3231668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3241abe55efSEd Tanous { 325fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3261668ce6dSEd Tanous std::to_array({arg1})); 327b5c07418SJames Feist } 328b5c07418SJames Feist 3291668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 330b5c07418SJames Feist { 331b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 332b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 333f4c4dcf4SKowalski, Kamil } 334f4c4dcf4SKowalski, Kamil 335f4c4dcf4SKowalski, Kamil /** 336f4c4dcf4SKowalski, Kamil * @internal 337f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 338f4c4dcf4SKowalski, Kamil * 339f4c4dcf4SKowalski, Kamil * See header file for more information 340f4c4dcf4SKowalski, Kamil * @endinternal 341f4c4dcf4SKowalski, Kamil */ 3421668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3431abe55efSEd Tanous { 344b6cd31e1SEd Tanous return getLog( 345fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 3461668ce6dSEd Tanous std::to_array({arg1})); 347b5c07418SJames Feist } 348b5c07418SJames Feist 3491668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 350b5c07418SJames Feist { 351d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 352b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 353b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 354f4c4dcf4SKowalski, Kamil } 355f4c4dcf4SKowalski, Kamil 356f4c4dcf4SKowalski, Kamil /** 357f4c4dcf4SKowalski, Kamil * @internal 358f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 359f4c4dcf4SKowalski, Kamil * 360f4c4dcf4SKowalski, Kamil * See header file for more information 361f4c4dcf4SKowalski, Kamil * @endinternal 362f4c4dcf4SKowalski, Kamil */ 3631668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 3641668ce6dSEd Tanous std::string_view arg2, 3651668ce6dSEd Tanous std::string_view arg3) 3661abe55efSEd Tanous { 367fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 3681668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 369b5c07418SJames Feist } 370b5c07418SJames Feist 3711668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 3721668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 373b5c07418SJames Feist { 374b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 375b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 376a08b46ccSJason M. Bills arg2); 377f4c4dcf4SKowalski, Kamil } 378f4c4dcf4SKowalski, Kamil 379f4c4dcf4SKowalski, Kamil /** 380f4c4dcf4SKowalski, Kamil * @internal 381f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 382f4c4dcf4SKowalski, Kamil * 383f4c4dcf4SKowalski, Kamil * See header file for more information 384f4c4dcf4SKowalski, Kamil * @endinternal 385f4c4dcf4SKowalski, Kamil */ 386b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 3871abe55efSEd Tanous { 388fffb8c1fSEd Tanous return getLog( 389fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 390b5c07418SJames Feist } 391b5c07418SJames Feist 392b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 393b5c07418SJames Feist { 394b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 395b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 396f4c4dcf4SKowalski, Kamil } 397f4c4dcf4SKowalski, Kamil 398f4c4dcf4SKowalski, Kamil /** 399f4c4dcf4SKowalski, Kamil * @internal 400f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 401f4c4dcf4SKowalski, Kamil * 402f4c4dcf4SKowalski, Kamil * See header file for more information 403f4c4dcf4SKowalski, Kamil * @endinternal 404f4c4dcf4SKowalski, Kamil */ 4051668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4061abe55efSEd Tanous { 407fffb8c1fSEd Tanous return getLog( 408fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4091668ce6dSEd Tanous std::to_array({arg1})); 410b5c07418SJames Feist } 411b5c07418SJames Feist 412b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4131668ce6dSEd Tanous std::string_view arg1) 414b5c07418SJames Feist { 415b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 416b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 417a08b46ccSJason M. Bills arg1); 418f12894f8SJason M. Bills } 419f12894f8SJason M. Bills 420f12894f8SJason M. Bills /** 421f12894f8SJason M. Bills * @internal 422f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 423f12894f8SJason M. Bills * property 424f12894f8SJason M. Bills * 425f12894f8SJason M. Bills * See header file for more information 426f12894f8SJason M. Bills * @endinternal 427f12894f8SJason M. Bills */ 4281668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4291668ce6dSEd Tanous std::string_view arg2) 430f12894f8SJason M. Bills { 431fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4321668ce6dSEd Tanous std::to_array({arg1, arg2})); 433b5c07418SJames Feist } 434b5c07418SJames Feist 4351668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4361668ce6dSEd Tanous std::string_view arg2) 437b5c07418SJames Feist { 438b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 439b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 440f12894f8SJason M. Bills } 441f12894f8SJason M. Bills 442f12894f8SJason M. Bills /** 443f12894f8SJason M. Bills * @internal 444f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 445f12894f8SJason M. Bills * property 446f12894f8SJason M. Bills * 447f12894f8SJason M. Bills * See header file for more information 448f12894f8SJason M. Bills * @endinternal 449f12894f8SJason M. Bills */ 4501668ce6dSEd Tanous nlohmann::json propertyValueNotInList(std::string_view arg1, 4511668ce6dSEd Tanous std::string_view arg2) 452f12894f8SJason M. Bills { 453fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 4541668ce6dSEd Tanous std::to_array({arg1, arg2})); 455b5c07418SJames Feist } 456b5c07418SJames Feist 4571668ce6dSEd Tanous void propertyValueNotInList(crow::Response& res, std::string_view arg1, 4581668ce6dSEd Tanous std::string_view arg2) 459b5c07418SJames Feist { 460b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 461b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 462f4c4dcf4SKowalski, Kamil } 463f4c4dcf4SKowalski, Kamil 464f4c4dcf4SKowalski, Kamil /** 465f4c4dcf4SKowalski, Kamil * @internal 466227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 467227a2b0aSJiaqing Zhao * 468227a2b0aSJiaqing Zhao * See header file for more information 469227a2b0aSJiaqing Zhao * @endinternal 470227a2b0aSJiaqing Zhao */ 471227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 472227a2b0aSJiaqing Zhao std::string_view arg2) 473227a2b0aSJiaqing Zhao { 474227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 475227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 476227a2b0aSJiaqing Zhao } 477227a2b0aSJiaqing Zhao 478227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 479227a2b0aSJiaqing Zhao std::string_view arg2) 480227a2b0aSJiaqing Zhao { 481227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 482227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 483227a2b0aSJiaqing Zhao } 484227a2b0aSJiaqing Zhao 485227a2b0aSJiaqing Zhao /** 486227a2b0aSJiaqing Zhao * @internal 487f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 488f4c4dcf4SKowalski, Kamil * 489f4c4dcf4SKowalski, Kamil * See header file for more information 490f4c4dcf4SKowalski, Kamil * @endinternal 491f4c4dcf4SKowalski, Kamil */ 492ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1) 4931abe55efSEd Tanous { 4941668ce6dSEd Tanous std::string_view arg1str{arg1.data(), arg1.size()}; 495b6cd31e1SEd Tanous return getLog( 496fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 4971668ce6dSEd Tanous std::to_array({arg1str})); 498b5c07418SJames Feist } 499b5c07418SJames Feist 500ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 501ace85d60SEd Tanous const boost::urls::url_view& arg1) 502b5c07418SJames Feist { 503b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 504b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 505f4c4dcf4SKowalski, Kamil } 506f4c4dcf4SKowalski, Kamil 507f4c4dcf4SKowalski, Kamil /** 508f4c4dcf4SKowalski, Kamil * @internal 50981856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 51081856681SAsmitha Karunanithi * 51181856681SAsmitha Karunanithi * See header file for more information 51281856681SAsmitha Karunanithi * @endinternal 51381856681SAsmitha Karunanithi */ 5141668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 51581856681SAsmitha Karunanithi { 516fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5171668ce6dSEd Tanous std::to_array({arg1})); 51881856681SAsmitha Karunanithi } 51981856681SAsmitha Karunanithi 5201668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 52181856681SAsmitha Karunanithi { 52281856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 52381856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 52481856681SAsmitha Karunanithi } 52581856681SAsmitha Karunanithi 52681856681SAsmitha Karunanithi /** 52781856681SAsmitha Karunanithi * @internal 528f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 529f4c4dcf4SKowalski, Kamil * 530f4c4dcf4SKowalski, Kamil * See header file for more information 531f4c4dcf4SKowalski, Kamil * @endinternal 532f4c4dcf4SKowalski, Kamil */ 533b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5341abe55efSEd Tanous { 535fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 536b5c07418SJames Feist } 537b5c07418SJames Feist 538b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 539b5c07418SJames Feist { 540b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 541b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 542f4c4dcf4SKowalski, Kamil } 543f4c4dcf4SKowalski, Kamil 544f4c4dcf4SKowalski, Kamil /** 545f4c4dcf4SKowalski, Kamil * @internal 546f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 547f4c4dcf4SKowalski, Kamil * 548f4c4dcf4SKowalski, Kamil * See header file for more information 549f4c4dcf4SKowalski, Kamil * @endinternal 550f4c4dcf4SKowalski, Kamil */ 551b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 5521abe55efSEd Tanous { 553fffb8c1fSEd Tanous return getLog( 554fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 555b5c07418SJames Feist } 556b5c07418SJames Feist 557b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 558b5c07418SJames Feist { 559789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 560b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 561f4c4dcf4SKowalski, Kamil } 562f4c4dcf4SKowalski, Kamil 563f4c4dcf4SKowalski, Kamil /** 564f4c4dcf4SKowalski, Kamil * @internal 565f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 566f4c4dcf4SKowalski, Kamil * 567f4c4dcf4SKowalski, Kamil * See header file for more information 568f4c4dcf4SKowalski, Kamil * @endinternal 569f4c4dcf4SKowalski, Kamil */ 5701668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 5711668ce6dSEd Tanous std::string_view arg2) 5721abe55efSEd Tanous { 573fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 5741668ce6dSEd Tanous std::to_array({arg1, arg2})); 575b5c07418SJames Feist } 576b5c07418SJames Feist 5771668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 5781668ce6dSEd Tanous std::string_view arg2) 579b5c07418SJames Feist { 580b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 581b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 582f4c4dcf4SKowalski, Kamil } 583f4c4dcf4SKowalski, Kamil 584f4c4dcf4SKowalski, Kamil /** 585f4c4dcf4SKowalski, Kamil * @internal 586f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 587f4c4dcf4SKowalski, Kamil * 588f4c4dcf4SKowalski, Kamil * See header file for more information 589f4c4dcf4SKowalski, Kamil * @endinternal 590f4c4dcf4SKowalski, Kamil */ 5911668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 5921abe55efSEd Tanous { 593b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 594fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 5951668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 596b5c07418SJames Feist } 597b5c07418SJames Feist 5981668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 599b5c07418SJames Feist { 600b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 601b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 602f4c4dcf4SKowalski, Kamil } 603f4c4dcf4SKowalski, Kamil 604f4c4dcf4SKowalski, Kamil /** 605f4c4dcf4SKowalski, Kamil * @internal 606cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 607cc9139ecSJason M. Bills * 608cc9139ecSJason M. Bills * See header file for more information 609cc9139ecSJason M. Bills * @endinternal 610cc9139ecSJason M. Bills */ 611b5c07418SJames Feist nlohmann::json sessionTerminated(void) 612cc9139ecSJason M. Bills { 613fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 614b5c07418SJames Feist } 615b5c07418SJames Feist 616b5c07418SJames Feist void sessionTerminated(crow::Response& res) 617b5c07418SJames Feist { 618b5c07418SJames Feist res.result(boost::beast::http::status::ok); 619b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 620cc9139ecSJason M. Bills } 621cc9139ecSJason M. Bills 622cc9139ecSJason M. Bills /** 623cc9139ecSJason M. Bills * @internal 624684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 625684bb4b8SJason M. Bills * 626684bb4b8SJason M. Bills * See header file for more information 627684bb4b8SJason M. Bills * @endinternal 628684bb4b8SJason M. Bills */ 629684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 630684bb4b8SJason M. Bills { 631fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 632684bb4b8SJason M. Bills } 633684bb4b8SJason M. Bills 634684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 635684bb4b8SJason M. Bills { 636684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 637684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 638684bb4b8SJason M. Bills } 639684bb4b8SJason M. Bills 640684bb4b8SJason M. Bills /** 641684bb4b8SJason M. Bills * @internal 642cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 643cc9139ecSJason M. Bills * 644cc9139ecSJason M. Bills * See header file for more information 645cc9139ecSJason M. Bills * @endinternal 646cc9139ecSJason M. Bills */ 6471668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 6481668ce6dSEd Tanous std::string_view arg2) 649cc9139ecSJason M. Bills { 650fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 6511668ce6dSEd Tanous std::to_array({arg1, arg2})); 652b5c07418SJames Feist } 653b5c07418SJames Feist 6541668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 6551668ce6dSEd Tanous std::string_view arg2) 656b5c07418SJames Feist { 657b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 658b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 659cc9139ecSJason M. Bills } 660cc9139ecSJason M. Bills 661cc9139ecSJason M. Bills /** 662cc9139ecSJason M. Bills * @internal 663684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 664684bb4b8SJason M. Bills * 665684bb4b8SJason M. Bills * See header file for more information 666684bb4b8SJason M. Bills * @endinternal 667684bb4b8SJason M. Bills */ 668ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1, 6691668ce6dSEd Tanous std::string_view arg2) 670684bb4b8SJason M. Bills { 6711668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 672fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 6731668ce6dSEd Tanous std::to_array({arg1str, arg2})); 674684bb4b8SJason M. Bills } 675684bb4b8SJason M. Bills 676ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 6771668ce6dSEd Tanous std::string_view arg2) 678684bb4b8SJason M. Bills { 679684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 680684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 681684bb4b8SJason M. Bills } 682684bb4b8SJason M. Bills 683684bb4b8SJason M. Bills /** 684684bb4b8SJason M. Bills * @internal 685684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 686684bb4b8SJason M. Bills * 687684bb4b8SJason M. Bills * See header file for more information 688684bb4b8SJason M. Bills * @endinternal 689684bb4b8SJason M. Bills */ 6901668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 691684bb4b8SJason M. Bills { 692fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 6931668ce6dSEd Tanous std::to_array({arg1})); 694684bb4b8SJason M. Bills } 695684bb4b8SJason M. Bills 6961668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 697684bb4b8SJason M. Bills { 698684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 699684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 700684bb4b8SJason M. Bills } 701684bb4b8SJason M. Bills 702684bb4b8SJason M. Bills /** 703684bb4b8SJason M. Bills * @internal 704684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 705684bb4b8SJason M. Bills * 706684bb4b8SJason M. Bills * See header file for more information 707684bb4b8SJason M. Bills * @endinternal 708684bb4b8SJason M. Bills */ 7091668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 710684bb4b8SJason M. Bills { 711b6cd31e1SEd Tanous return getLog( 712fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7131668ce6dSEd Tanous std::to_array({arg1})); 714684bb4b8SJason M. Bills } 715684bb4b8SJason M. Bills 7161668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 717684bb4b8SJason M. Bills { 718684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 719684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 720684bb4b8SJason M. Bills } 721684bb4b8SJason M. Bills 722684bb4b8SJason M. Bills /** 723684bb4b8SJason M. Bills * @internal 724684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 725684bb4b8SJason M. Bills * 726684bb4b8SJason M. Bills * See header file for more information 727684bb4b8SJason M. Bills * @endinternal 728684bb4b8SJason M. Bills */ 7291668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7301668ce6dSEd Tanous std::string_view arg2) 731684bb4b8SJason M. Bills { 732fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7331668ce6dSEd Tanous std::to_array({arg1, arg2})); 734684bb4b8SJason M. Bills } 735684bb4b8SJason M. Bills 7361668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7371668ce6dSEd Tanous std::string_view arg2) 738684bb4b8SJason M. Bills { 739684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 740684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 741684bb4b8SJason M. Bills } 742684bb4b8SJason M. Bills 743684bb4b8SJason M. Bills /** 744684bb4b8SJason M. Bills * @internal 7452a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7462a6af81cSRamesh Iyyar * 7472a6af81cSRamesh Iyyar * See header file for more information 7482a6af81cSRamesh Iyyar * @endinternal 7492a6af81cSRamesh Iyyar */ 7502a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 7512a6af81cSRamesh Iyyar std::string_view arg2, 7522a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7532a6af81cSRamesh Iyyar { 7542a6af81cSRamesh Iyyar return getLog( 7552a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 7562a6af81cSRamesh Iyyar std::to_array( 7572a6af81cSRamesh Iyyar {arg1, arg2, std::string_view{arg3.data(), arg3.size()}})); 7582a6af81cSRamesh Iyyar } 7592a6af81cSRamesh Iyyar 7602a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 7612a6af81cSRamesh Iyyar std::string_view arg2, 7622a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 7632a6af81cSRamesh Iyyar { 7642a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 7652a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 7662a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 7672a6af81cSRamesh Iyyar } 7682a6af81cSRamesh Iyyar 7692a6af81cSRamesh Iyyar /** 7702a6af81cSRamesh Iyyar * @internal 77124861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 77224861a28SRamesh Iyyar * 77324861a28SRamesh Iyyar * See header file for more information 77424861a28SRamesh Iyyar * @endinternal 77524861a28SRamesh Iyyar */ 77624861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 77724861a28SRamesh Iyyar std::string_view arg2) 77824861a28SRamesh Iyyar { 77924861a28SRamesh Iyyar return getLog( 78024861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 78124861a28SRamesh Iyyar std::to_array({arg1, arg2})); 78224861a28SRamesh Iyyar } 78324861a28SRamesh Iyyar 78424861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 78524861a28SRamesh Iyyar std::string_view arg2) 78624861a28SRamesh Iyyar { 78724861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 78824861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 78924861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 79024861a28SRamesh Iyyar } 79124861a28SRamesh Iyyar 79224861a28SRamesh Iyyar /** 79324861a28SRamesh Iyyar * @internal 794684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 795684bb4b8SJason M. Bills * 796684bb4b8SJason M. Bills * See header file for more information 797684bb4b8SJason M. Bills * @endinternal 798684bb4b8SJason M. Bills */ 7991668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8001668ce6dSEd Tanous std::string_view arg2) 801684bb4b8SJason M. Bills { 802fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8031668ce6dSEd Tanous std::to_array({arg1, arg2})); 804684bb4b8SJason M. Bills } 805684bb4b8SJason M. Bills 8061668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8071668ce6dSEd Tanous std::string_view arg2) 808684bb4b8SJason M. Bills { 809684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 810684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 811684bb4b8SJason M. Bills } 812684bb4b8SJason M. Bills 813684bb4b8SJason M. Bills /** 814684bb4b8SJason M. Bills * @internal 815684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 816684bb4b8SJason M. Bills * 817684bb4b8SJason M. Bills * See header file for more information 818684bb4b8SJason M. Bills * @endinternal 819684bb4b8SJason M. Bills */ 820ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1) 821684bb4b8SJason M. Bills { 8221668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 823fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 8241668ce6dSEd Tanous std::to_array({arg1str})); 825684bb4b8SJason M. Bills } 826684bb4b8SJason M. Bills 827ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res, 828ace85d60SEd Tanous const boost::urls::url_view& arg1) 829684bb4b8SJason M. Bills { 830684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 831684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 832684bb4b8SJason M. Bills } 833684bb4b8SJason M. Bills 834684bb4b8SJason M. Bills /** 835684bb4b8SJason M. Bills * @internal 836684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 837684bb4b8SJason M. Bills * 838684bb4b8SJason M. Bills * See header file for more information 839684bb4b8SJason M. Bills * @endinternal 840684bb4b8SJason M. Bills */ 841684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 842684bb4b8SJason M. Bills { 843fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 844684bb4b8SJason M. Bills } 845684bb4b8SJason M. Bills 846684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 847684bb4b8SJason M. Bills { 848684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 849684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 850684bb4b8SJason M. Bills } 851684bb4b8SJason M. Bills 852684bb4b8SJason M. Bills /** 853684bb4b8SJason M. Bills * @internal 854684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 855684bb4b8SJason M. Bills * 856684bb4b8SJason M. Bills * See header file for more information 857684bb4b8SJason M. Bills * @endinternal 858684bb4b8SJason M. Bills */ 859684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 860684bb4b8SJason M. Bills { 861fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 862684bb4b8SJason M. Bills } 863684bb4b8SJason M. Bills 864684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 865684bb4b8SJason M. Bills { 8664df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 867684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 868684bb4b8SJason M. Bills } 869684bb4b8SJason M. Bills 870684bb4b8SJason M. Bills /** 871684bb4b8SJason M. Bills * @internal 872684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 873684bb4b8SJason M. Bills * 874684bb4b8SJason M. Bills * See header file for more information 875684bb4b8SJason M. Bills * @endinternal 876684bb4b8SJason M. Bills */ 877684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 878684bb4b8SJason M. Bills { 879fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 880684bb4b8SJason M. Bills } 881684bb4b8SJason M. Bills 882684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 883684bb4b8SJason M. Bills { 884684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 885684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 886684bb4b8SJason M. Bills } 887684bb4b8SJason M. Bills 888684bb4b8SJason M. Bills /** 889684bb4b8SJason M. Bills * @internal 890684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 891684bb4b8SJason M. Bills * 892684bb4b8SJason M. Bills * See header file for more information 893684bb4b8SJason M. Bills * @endinternal 894684bb4b8SJason M. Bills */ 895684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 896684bb4b8SJason M. Bills { 897fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 898684bb4b8SJason M. Bills } 899684bb4b8SJason M. Bills 900684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 901684bb4b8SJason M. Bills { 9028868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 903684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 904684bb4b8SJason M. Bills } 905684bb4b8SJason M. Bills 906684bb4b8SJason M. Bills /** 907684bb4b8SJason M. Bills * @internal 908684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 909684bb4b8SJason M. Bills * 910684bb4b8SJason M. Bills * See header file for more information 911684bb4b8SJason M. Bills * @endinternal 912684bb4b8SJason M. Bills */ 913684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 914684bb4b8SJason M. Bills { 915fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 916684bb4b8SJason M. Bills } 917684bb4b8SJason M. Bills 918684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 919684bb4b8SJason M. Bills { 920684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 921684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 922684bb4b8SJason M. Bills } 923684bb4b8SJason M. Bills 924684bb4b8SJason M. Bills /** 925684bb4b8SJason M. Bills * @internal 926f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 927f12894f8SJason M. Bills * property 928f12894f8SJason M. Bills * 929f12894f8SJason M. Bills * See header file for more information 930f12894f8SJason M. Bills * @endinternal 931f12894f8SJason M. Bills */ 9321668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 9331668ce6dSEd Tanous std::string_view arg2) 934f12894f8SJason M. Bills { 935fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9361668ce6dSEd Tanous std::to_array({arg1, arg2})); 937b5c07418SJames Feist } 938b5c07418SJames Feist 9391668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9401668ce6dSEd Tanous std::string_view arg2) 941b5c07418SJames Feist { 942b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 943b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 944f4c4dcf4SKowalski, Kamil } 945f4c4dcf4SKowalski, Kamil 946f4c4dcf4SKowalski, Kamil /** 947f4c4dcf4SKowalski, Kamil * @internal 948b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 949f4c4dcf4SKowalski, Kamil * 950f4c4dcf4SKowalski, Kamil * See header file for more information 951f4c4dcf4SKowalski, Kamil * @endinternal 952f4c4dcf4SKowalski, Kamil */ 9531668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 9541abe55efSEd Tanous { 955fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 9561668ce6dSEd Tanous std::to_array({arg1, arg2})); 957b5c07418SJames Feist } 958b5c07418SJames Feist 9591668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 9601668ce6dSEd Tanous std::string_view arg2) 961b5c07418SJames Feist { 962b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 963b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 964f4c4dcf4SKowalski, Kamil } 965f4c4dcf4SKowalski, Kamil 966f4c4dcf4SKowalski, Kamil /** 967f4c4dcf4SKowalski, Kamil * @internal 968f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 969f4c4dcf4SKowalski, Kamil * 970f4c4dcf4SKowalski, Kamil * See header file for more information 971f4c4dcf4SKowalski, Kamil * @endinternal 972f4c4dcf4SKowalski, Kamil */ 973ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1) 9741abe55efSEd Tanous { 9751668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 976fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 9771668ce6dSEd Tanous std::to_array({arg1str})); 978b5c07418SJames Feist } 979b5c07418SJames Feist 980ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 981ace85d60SEd Tanous const boost::urls::url_view& arg1) 982b5c07418SJames Feist { 983b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 984b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 985f4c4dcf4SKowalski, Kamil } 986f4c4dcf4SKowalski, Kamil 987f4c4dcf4SKowalski, Kamil /** 988f4c4dcf4SKowalski, Kamil * @internal 989f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 990f12894f8SJason M. Bills * property 991f12894f8SJason M. Bills * 992f12894f8SJason M. Bills * See header file for more information 993f12894f8SJason M. Bills * @endinternal 994f12894f8SJason M. Bills */ 9951668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 996f12894f8SJason M. Bills { 997fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 9981668ce6dSEd Tanous std::to_array({arg1})); 999b5c07418SJames Feist } 1000b5c07418SJames Feist 10011668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1002b5c07418SJames Feist { 1003b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1004b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1005f4c4dcf4SKowalski, Kamil } 1006f4c4dcf4SKowalski, Kamil 1007f4c4dcf4SKowalski, Kamil /** 1008f4c4dcf4SKowalski, Kamil * @internal 1009f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1010f4c4dcf4SKowalski, Kamil * 1011f4c4dcf4SKowalski, Kamil * See header file for more information 1012f4c4dcf4SKowalski, Kamil * @endinternal 1013f4c4dcf4SKowalski, Kamil */ 10141668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10151668ce6dSEd Tanous std::string_view arg2) 10161abe55efSEd Tanous { 1017b6cd31e1SEd Tanous return getLog( 1018fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10191668ce6dSEd Tanous std::to_array({arg1, arg2})); 1020b5c07418SJames Feist } 1021b5c07418SJames Feist 10221668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10231668ce6dSEd Tanous std::string_view arg2) 1024b5c07418SJames Feist { 1025b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1026b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1027b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1028f4c4dcf4SKowalski, Kamil } 1029f4c4dcf4SKowalski, Kamil 1030f4c4dcf4SKowalski, Kamil /** 1031f4c4dcf4SKowalski, Kamil * @internal 1032f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1033f4c4dcf4SKowalski, Kamil * 1034f4c4dcf4SKowalski, Kamil * See header file for more information 1035f4c4dcf4SKowalski, Kamil * @endinternal 1036f4c4dcf4SKowalski, Kamil */ 1037b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10381abe55efSEd Tanous { 1039fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1040b5c07418SJames Feist } 1041b5c07418SJames Feist 1042b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1043b5c07418SJames Feist { 1044b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1045b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1046f4c4dcf4SKowalski, Kamil } 1047f4c4dcf4SKowalski, Kamil 1048f4c4dcf4SKowalski, Kamil /** 1049f4c4dcf4SKowalski, Kamil * @internal 1050f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1051f4c4dcf4SKowalski, Kamil * 1052f4c4dcf4SKowalski, Kamil * See header file for more information 1053f4c4dcf4SKowalski, Kamil * @endinternal 1054f4c4dcf4SKowalski, Kamil */ 10551668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 10561668ce6dSEd Tanous std::string_view arg2) 10571abe55efSEd Tanous { 1058fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 10591668ce6dSEd Tanous std::to_array({arg1, arg2})); 1060b5c07418SJames Feist } 1061b5c07418SJames Feist 10621668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 10631668ce6dSEd Tanous std::string_view arg2) 1064b5c07418SJames Feist { 1065b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1066b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1067f4c4dcf4SKowalski, Kamil } 1068f4c4dcf4SKowalski, Kamil 1069f4c4dcf4SKowalski, Kamil /** 1070f4c4dcf4SKowalski, Kamil * @internal 1071f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1072f4c4dcf4SKowalski, Kamil * 1073f4c4dcf4SKowalski, Kamil * See header file for more information 1074f4c4dcf4SKowalski, Kamil * @endinternal 1075f4c4dcf4SKowalski, Kamil */ 10761668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 10771668ce6dSEd Tanous std::string_view arg2) 10781abe55efSEd Tanous { 1079fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 10801668ce6dSEd Tanous std::to_array({arg1, arg2})); 1081b5c07418SJames Feist } 1082b5c07418SJames Feist 10831668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 10841668ce6dSEd Tanous std::string_view arg2) 1085b5c07418SJames Feist { 1086b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1087b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1088b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1089f4c4dcf4SKowalski, Kamil } 1090f4c4dcf4SKowalski, Kamil 1091f4c4dcf4SKowalski, Kamil /** 1092f4c4dcf4SKowalski, Kamil * @internal 1093f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1094f4c4dcf4SKowalski, Kamil * 1095f4c4dcf4SKowalski, Kamil * See header file for more information 1096f4c4dcf4SKowalski, Kamil * @endinternal 1097f4c4dcf4SKowalski, Kamil */ 1098ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 10991668ce6dSEd Tanous std::string_view arg2) 11001abe55efSEd Tanous { 11011668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1102b6cd31e1SEd Tanous return getLog( 1103fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 11041668ce6dSEd Tanous std::to_array({arg1str, arg2})); 1105b5c07418SJames Feist } 1106b5c07418SJames Feist 1107ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1108ace85d60SEd Tanous const boost::urls::url_view& arg1, 11091668ce6dSEd Tanous std::string_view arg2) 1110b5c07418SJames Feist { 1111b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1112b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1113b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1114f4c4dcf4SKowalski, Kamil } 1115f4c4dcf4SKowalski, Kamil 1116f4c4dcf4SKowalski, Kamil /** 1117f4c4dcf4SKowalski, Kamil * @internal 1118f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1119f4c4dcf4SKowalski, Kamil * 1120f4c4dcf4SKowalski, Kamil * See header file for more information 1121f4c4dcf4SKowalski, Kamil * @endinternal 1122f4c4dcf4SKowalski, Kamil */ 1123b5c07418SJames Feist nlohmann::json accountRemoved(void) 11241abe55efSEd Tanous { 1125fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1126b5c07418SJames Feist } 1127b5c07418SJames Feist 1128b5c07418SJames Feist void accountRemoved(crow::Response& res) 1129b5c07418SJames Feist { 1130b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1131b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1132f4c4dcf4SKowalski, Kamil } 1133f4c4dcf4SKowalski, Kamil 1134f4c4dcf4SKowalski, Kamil /** 1135f4c4dcf4SKowalski, Kamil * @internal 1136f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1137f4c4dcf4SKowalski, Kamil * 1138f4c4dcf4SKowalski, Kamil * See header file for more information 1139f4c4dcf4SKowalski, Kamil * @endinternal 1140f4c4dcf4SKowalski, Kamil */ 1141ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1) 11421abe55efSEd Tanous { 11431668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1144fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 11451668ce6dSEd Tanous std::to_array({arg1str})); 1146b5c07418SJames Feist } 1147b5c07418SJames Feist 1148ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1) 1149b5c07418SJames Feist { 1150b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1151b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1152f4c4dcf4SKowalski, Kamil } 1153f4c4dcf4SKowalski, Kamil 1154f4c4dcf4SKowalski, Kamil /** 1155f4c4dcf4SKowalski, Kamil * @internal 1156f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1157f4c4dcf4SKowalski, Kamil * 1158f4c4dcf4SKowalski, Kamil * See header file for more information 1159f4c4dcf4SKowalski, Kamil * @endinternal 1160f4c4dcf4SKowalski, Kamil */ 1161b5c07418SJames Feist nlohmann::json queryNotSupported(void) 11621abe55efSEd Tanous { 1163fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1164b5c07418SJames Feist } 1165b5c07418SJames Feist 1166b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1167b5c07418SJames Feist { 1168b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1169b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1170f4c4dcf4SKowalski, Kamil } 1171f4c4dcf4SKowalski, Kamil 1172f4c4dcf4SKowalski, Kamil /** 1173f4c4dcf4SKowalski, Kamil * @internal 1174f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1175f4c4dcf4SKowalski, Kamil * 1176f4c4dcf4SKowalski, Kamil * See header file for more information 1177f4c4dcf4SKowalski, Kamil * @endinternal 1178f4c4dcf4SKowalski, Kamil */ 1179b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 11801abe55efSEd Tanous { 1181b6cd31e1SEd Tanous return getLog( 1182fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1183b5c07418SJames Feist } 1184b5c07418SJames Feist 1185b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1186b5c07418SJames Feist { 1187b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1188b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1189f4c4dcf4SKowalski, Kamil } 1190f4c4dcf4SKowalski, Kamil 1191f4c4dcf4SKowalski, Kamil /** 1192f4c4dcf4SKowalski, Kamil * @internal 1193f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1194f4c4dcf4SKowalski, Kamil * 1195f4c4dcf4SKowalski, Kamil * See header file for more information 1196f4c4dcf4SKowalski, Kamil * @endinternal 1197f4c4dcf4SKowalski, Kamil */ 1198b5c07418SJames Feist nlohmann::json generalError(void) 11991abe55efSEd Tanous { 1200fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1201b5c07418SJames Feist } 1202b5c07418SJames Feist 1203b5c07418SJames Feist void generalError(crow::Response& res) 1204b5c07418SJames Feist { 1205b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1206b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1207f4c4dcf4SKowalski, Kamil } 1208f4c4dcf4SKowalski, Kamil 1209f4c4dcf4SKowalski, Kamil /** 1210f4c4dcf4SKowalski, Kamil * @internal 1211f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1212f4c4dcf4SKowalski, Kamil * 1213f4c4dcf4SKowalski, Kamil * See header file for more information 1214f4c4dcf4SKowalski, Kamil * @endinternal 1215f4c4dcf4SKowalski, Kamil */ 1216b5c07418SJames Feist nlohmann::json success(void) 12171abe55efSEd Tanous { 1218fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1219b5c07418SJames Feist } 1220b5c07418SJames Feist 1221b5c07418SJames Feist void success(crow::Response& res) 1222b5c07418SJames Feist { 1223b5c07418SJames Feist // don't set res.result here because success is the default and any 1224b5c07418SJames Feist // error should overwrite the default 1225b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1226f12894f8SJason M. Bills } 1227f12894f8SJason M. Bills 1228f12894f8SJason M. Bills /** 1229f12894f8SJason M. Bills * @internal 1230f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1231f4c4dcf4SKowalski, Kamil * 1232f4c4dcf4SKowalski, Kamil * See header file for more information 1233f4c4dcf4SKowalski, Kamil * @endinternal 1234f4c4dcf4SKowalski, Kamil */ 1235b5c07418SJames Feist nlohmann::json created(void) 12361abe55efSEd Tanous { 1237fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1238b5c07418SJames Feist } 1239b5c07418SJames Feist 1240b5c07418SJames Feist void created(crow::Response& res) 1241b5c07418SJames Feist { 1242b5c07418SJames Feist res.result(boost::beast::http::status::created); 1243b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1244f4c4dcf4SKowalski, Kamil } 1245f4c4dcf4SKowalski, Kamil 1246f4c4dcf4SKowalski, Kamil /** 1247f4c4dcf4SKowalski, Kamil * @internal 1248cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1249cc9139ecSJason M. Bills * 1250cc9139ecSJason M. Bills * See header file for more information 1251cc9139ecSJason M. Bills * @endinternal 1252cc9139ecSJason M. Bills */ 1253b5c07418SJames Feist nlohmann::json noOperation(void) 1254cc9139ecSJason M. Bills { 1255fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1256b5c07418SJames Feist } 1257b5c07418SJames Feist 1258b5c07418SJames Feist void noOperation(crow::Response& res) 1259b5c07418SJames Feist { 1260b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1261b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1262cc9139ecSJason M. Bills } 1263cc9139ecSJason M. Bills 1264cc9139ecSJason M. Bills /** 1265cc9139ecSJason M. Bills * @internal 1266b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1267b5c07418SJames Feist * property 1268f12894f8SJason M. Bills * 1269f12894f8SJason M. Bills * See header file for more information 1270f12894f8SJason M. Bills * @endinternal 1271f12894f8SJason M. Bills */ 12721668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1273b5c07418SJames Feist { 1274fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 12751668ce6dSEd Tanous std::to_array({arg1})); 1276b5c07418SJames Feist } 1277b5c07418SJames Feist 12781668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1279f12894f8SJason M. Bills { 1280f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 12817b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1282f4c4dcf4SKowalski, Kamil } 1283f4c4dcf4SKowalski, Kamil 1284f4c4dcf4SKowalski, Kamil /** 1285f4c4dcf4SKowalski, Kamil * @internal 1286f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1287f4c4dcf4SKowalski, Kamil * 1288f4c4dcf4SKowalski, Kamil * See header file for more information 1289f4c4dcf4SKowalski, Kamil * @endinternal 1290f4c4dcf4SKowalski, Kamil */ 1291b5c07418SJames Feist nlohmann::json noValidSession(void) 12921abe55efSEd Tanous { 1293fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1294b5c07418SJames Feist } 1295b5c07418SJames Feist 1296b5c07418SJames Feist void noValidSession(crow::Response& res) 1297b5c07418SJames Feist { 1298b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1299b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1300f4c4dcf4SKowalski, Kamil } 1301f4c4dcf4SKowalski, Kamil 1302f4c4dcf4SKowalski, Kamil /** 1303f4c4dcf4SKowalski, Kamil * @internal 1304f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1305f4c4dcf4SKowalski, Kamil * 1306f4c4dcf4SKowalski, Kamil * See header file for more information 1307f4c4dcf4SKowalski, Kamil * @endinternal 1308f4c4dcf4SKowalski, Kamil */ 1309ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1) 13101abe55efSEd Tanous { 13111668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1312fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 13131668ce6dSEd Tanous std::to_array({arg1str})); 1314b5c07418SJames Feist } 1315b5c07418SJames Feist 1316ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1) 1317b5c07418SJames Feist { 1318b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1319b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1320f4c4dcf4SKowalski, Kamil } 1321f4c4dcf4SKowalski, Kamil 1322f4c4dcf4SKowalski, Kamil /** 1323f4c4dcf4SKowalski, Kamil * @internal 1324f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1325f4c4dcf4SKowalski, Kamil * 1326f4c4dcf4SKowalski, Kamil * See header file for more information 1327f4c4dcf4SKowalski, Kamil * @endinternal 1328f4c4dcf4SKowalski, Kamil */ 1329b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13301abe55efSEd Tanous { 1331fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1332b5c07418SJames Feist } 1333b5c07418SJames Feist 1334b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1335b5c07418SJames Feist { 1336b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1337b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1338f4c4dcf4SKowalski, Kamil } 1339f4c4dcf4SKowalski, Kamil 1340f4c4dcf4SKowalski, Kamil /** 1341f4c4dcf4SKowalski, Kamil * @internal 1342f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1343f4c4dcf4SKowalski, Kamil * 1344f4c4dcf4SKowalski, Kamil * See header file for more information 1345f4c4dcf4SKowalski, Kamil * @endinternal 1346f4c4dcf4SKowalski, Kamil */ 13471668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 13481668ce6dSEd Tanous std::string_view arg2, 13491668ce6dSEd Tanous std::string_view arg3) 13501abe55efSEd Tanous { 1351b6cd31e1SEd Tanous return getLog( 1352fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 13531668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1354b5c07418SJames Feist } 1355b5c07418SJames Feist 13561668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 13571668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1358b5c07418SJames Feist { 1359b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1360b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1361b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1362f4c4dcf4SKowalski, Kamil } 1363f4c4dcf4SKowalski, Kamil 1364f4c4dcf4SKowalski, Kamil /** 1365f4c4dcf4SKowalski, Kamil * @internal 1366f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1367f4c4dcf4SKowalski, Kamil * 1368f4c4dcf4SKowalski, Kamil * See header file for more information 1369f4c4dcf4SKowalski, Kamil * @endinternal 1370f4c4dcf4SKowalski, Kamil */ 1371b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 13721abe55efSEd Tanous { 1373fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1374b5c07418SJames Feist } 1375b5c07418SJames Feist 1376b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1377b5c07418SJames Feist { 1378b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1379b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1380f4c4dcf4SKowalski, Kamil } 1381f4c4dcf4SKowalski, Kamil 1382f4c4dcf4SKowalski, Kamil /** 1383f4c4dcf4SKowalski, Kamil * @internal 1384f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1385f4c4dcf4SKowalski, Kamil * 1386f4c4dcf4SKowalski, Kamil * See header file for more information 1387f4c4dcf4SKowalski, Kamil * @endinternal 1388f4c4dcf4SKowalski, Kamil */ 13891668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 13901abe55efSEd Tanous { 1391fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 13921668ce6dSEd Tanous std::to_array({arg1})); 1393b5c07418SJames Feist } 1394b5c07418SJames Feist 13951668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1396b5c07418SJames Feist { 1397b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1398b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1399f4c4dcf4SKowalski, Kamil } 1400f4c4dcf4SKowalski, Kamil 1401f4c4dcf4SKowalski, Kamil /** 1402f4c4dcf4SKowalski, Kamil * @internal 1403f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1404f4c4dcf4SKowalski, Kamil * 1405f4c4dcf4SKowalski, Kamil * See header file for more information 1406f4c4dcf4SKowalski, Kamil * @endinternal 1407f4c4dcf4SKowalski, Kamil */ 14085187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14091abe55efSEd Tanous { 1410b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1411fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14121668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1413b5c07418SJames Feist } 1414b5c07418SJames Feist 14155187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1416b5c07418SJames Feist { 1417b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1418b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1419f4c4dcf4SKowalski, Kamil } 1420f4c4dcf4SKowalski, Kamil 1421f4c4dcf4SKowalski, Kamil /** 1422f4c4dcf4SKowalski, Kamil * @internal 1423f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1424f4c4dcf4SKowalski, Kamil * 1425f4c4dcf4SKowalski, Kamil * See header file for more information 1426f4c4dcf4SKowalski, Kamil * @endinternal 1427f4c4dcf4SKowalski, Kamil */ 1428b5c07418SJames Feist nlohmann::json emptyJSON(void) 14291abe55efSEd Tanous { 1430fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1431b5c07418SJames Feist } 1432b5c07418SJames Feist 1433b5c07418SJames Feist void emptyJSON(crow::Response& res) 1434b5c07418SJames Feist { 1435b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1436b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1437f4c4dcf4SKowalski, Kamil } 1438f4c4dcf4SKowalski, Kamil 1439f4c4dcf4SKowalski, Kamil /** 1440f4c4dcf4SKowalski, Kamil * @internal 1441f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1442f4c4dcf4SKowalski, Kamil * 1443f4c4dcf4SKowalski, Kamil * See header file for more information 1444f4c4dcf4SKowalski, Kamil * @endinternal 1445f4c4dcf4SKowalski, Kamil */ 1446b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 14471abe55efSEd Tanous { 1448fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1449b6cd31e1SEd Tanous {}); 1450b5c07418SJames Feist } 1451b5c07418SJames Feist 1452b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1453b5c07418SJames Feist { 14546a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1455b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1456f4c4dcf4SKowalski, Kamil } 1457f4c4dcf4SKowalski, Kamil 1458f4c4dcf4SKowalski, Kamil /** 1459f4c4dcf4SKowalski, Kamil * @internal 1460684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1461684bb4b8SJason M. Bills * 1462684bb4b8SJason M. Bills * See header file for more information 1463684bb4b8SJason M. Bills * @endinternal 1464684bb4b8SJason M. Bills */ 1465684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1466684bb4b8SJason M. Bills { 1467b6cd31e1SEd Tanous return getLog( 1468fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1469684bb4b8SJason M. Bills } 1470684bb4b8SJason M. Bills 1471684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1472684bb4b8SJason M. Bills { 14736a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1474684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1475684bb4b8SJason M. Bills } 1476684bb4b8SJason M. Bills 1477684bb4b8SJason M. Bills /** 1478684bb4b8SJason M. Bills * @internal 1479684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1480684bb4b8SJason M. Bills * 1481684bb4b8SJason M. Bills * See header file for more information 1482684bb4b8SJason M. Bills * @endinternal 1483684bb4b8SJason M. Bills */ 1484684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1485684bb4b8SJason M. Bills { 1486fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1487fffb8c1fSEd Tanous {}); 1488684bb4b8SJason M. Bills } 1489684bb4b8SJason M. Bills 1490684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1491684bb4b8SJason M. Bills { 1492684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1493684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1494684bb4b8SJason M. Bills } 1495684bb4b8SJason M. Bills 1496684bb4b8SJason M. Bills /** 1497684bb4b8SJason M. Bills * @internal 1498f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1499f4c4dcf4SKowalski, Kamil * 1500f4c4dcf4SKowalski, Kamil * See header file for more information 1501f4c4dcf4SKowalski, Kamil * @endinternal 1502f4c4dcf4SKowalski, Kamil */ 1503b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15041abe55efSEd Tanous { 1505fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1506b5c07418SJames Feist } 1507b5c07418SJames Feist 1508b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1509b5c07418SJames Feist { 1510b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1511b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1512f4c4dcf4SKowalski, Kamil } 1513f4c4dcf4SKowalski, Kamil 1514f4c4dcf4SKowalski, Kamil /** 1515f4c4dcf4SKowalski, Kamil * @internal 1516f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1517f4c4dcf4SKowalski, Kamil * 1518f4c4dcf4SKowalski, Kamil * See header file for more information 1519f4c4dcf4SKowalski, Kamil * @endinternal 1520f4c4dcf4SKowalski, Kamil */ 15211668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15221668ce6dSEd Tanous std::string_view arg2) 1523b5c07418SJames Feist { 1524fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15251668ce6dSEd Tanous std::to_array({arg1, arg2})); 1526b5c07418SJames Feist } 1527b5c07418SJames Feist 15281668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15291668ce6dSEd Tanous std::string_view arg2) 15301abe55efSEd Tanous { 1531f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1532b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1533f4c4dcf4SKowalski, Kamil } 1534f4c4dcf4SKowalski, Kamil 1535f4c4dcf4SKowalski, Kamil /** 1536f4c4dcf4SKowalski, Kamil * @internal 1537f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1538f4c4dcf4SKowalski, Kamil * 1539f4c4dcf4SKowalski, Kamil * See header file for more information 1540f4c4dcf4SKowalski, Kamil * @endinternal 1541f4c4dcf4SKowalski, Kamil */ 1542b5c07418SJames Feist nlohmann::json accountNotModified(void) 15431abe55efSEd Tanous { 1544fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1545b5c07418SJames Feist } 1546b5c07418SJames Feist 1547b5c07418SJames Feist void accountNotModified(crow::Response& res) 1548b5c07418SJames Feist { 1549b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1550b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1551f4c4dcf4SKowalski, Kamil } 1552f4c4dcf4SKowalski, Kamil 1553f4c4dcf4SKowalski, Kamil /** 1554f4c4dcf4SKowalski, Kamil * @internal 1555f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1556f4c4dcf4SKowalski, Kamil * 1557f4c4dcf4SKowalski, Kamil * See header file for more information 1558f4c4dcf4SKowalski, Kamil * @endinternal 1559f4c4dcf4SKowalski, Kamil */ 15601668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 15611668ce6dSEd Tanous std::string_view arg2) 15621abe55efSEd Tanous { 1563fffb8c1fSEd Tanous return getLog( 1564fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 15651668ce6dSEd Tanous std::to_array({arg1, arg2})); 1566b5c07418SJames Feist } 1567b5c07418SJames Feist 15681668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 15691668ce6dSEd Tanous std::string_view arg2) 1570b5c07418SJames Feist { 1571b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1572b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1573b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1574f4c4dcf4SKowalski, Kamil } 1575f4c4dcf4SKowalski, Kamil 1576f4c4dcf4SKowalski, Kamil /** 1577f4c4dcf4SKowalski, Kamil * @internal 1578b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1579b5c07418SJames Feist * property 1580f12894f8SJason M. Bills * 1581f12894f8SJason M. Bills * See header file for more information 1582f12894f8SJason M. Bills * @endinternal 1583f12894f8SJason M. Bills */ 15841668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1585f12894f8SJason M. Bills { 1586fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 15871668ce6dSEd Tanous std::to_array({arg1})); 1588b5c07418SJames Feist } 1589b5c07418SJames Feist 15901668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1591b5c07418SJames Feist { 1592b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1593b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1594f4c4dcf4SKowalski, Kamil } 1595f4c4dcf4SKowalski, Kamil 1596f4c4dcf4SKowalski, Kamil /** 1597f4c4dcf4SKowalski, Kamil * @internal 1598f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1599f4c4dcf4SKowalski, Kamil * 1600f4c4dcf4SKowalski, Kamil * See header file for more information 1601f4c4dcf4SKowalski, Kamil * @endinternal 1602f4c4dcf4SKowalski, Kamil */ 16031668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16041abe55efSEd Tanous { 1605fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16061668ce6dSEd Tanous std::to_array({arg1})); 1607b5c07418SJames Feist } 1608b5c07418SJames Feist 16091668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1610b5c07418SJames Feist { 1611b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1612b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1613f4c4dcf4SKowalski, Kamil } 1614f4c4dcf4SKowalski, Kamil 1615f4c4dcf4SKowalski, Kamil /** 1616f4c4dcf4SKowalski, Kamil * @internal 1617f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1618f4c4dcf4SKowalski, Kamil * 1619f4c4dcf4SKowalski, Kamil * See header file for more information 1620f4c4dcf4SKowalski, Kamil * @endinternal 1621f4c4dcf4SKowalski, Kamil */ 1622b5c07418SJames Feist nlohmann::json accountModified(void) 16231abe55efSEd Tanous { 1624fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1625b5c07418SJames Feist } 1626b5c07418SJames Feist 1627b5c07418SJames Feist void accountModified(crow::Response& res) 1628b5c07418SJames Feist { 1629b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1630b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1631f4c4dcf4SKowalski, Kamil } 1632f4c4dcf4SKowalski, Kamil 1633f4c4dcf4SKowalski, Kamil /** 1634f4c4dcf4SKowalski, Kamil * @internal 1635f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1636f4c4dcf4SKowalski, Kamil * 1637f4c4dcf4SKowalski, Kamil * See header file for more information 1638f4c4dcf4SKowalski, Kamil * @endinternal 1639f4c4dcf4SKowalski, Kamil */ 16401668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 16411668ce6dSEd Tanous std::string_view arg2, 16421668ce6dSEd Tanous std::string_view arg3) 16431abe55efSEd Tanous { 1644fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 16451668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1646b5c07418SJames Feist } 1647b5c07418SJames Feist 16481668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 16491668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1650b5c07418SJames Feist { 1651b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1652b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1653b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1654f4c4dcf4SKowalski, Kamil } 1655f4c4dcf4SKowalski, Kamil 1656b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1) 1657b6cd31e1SEd Tanous { 16581668ce6dSEd Tanous std::string_view arg1str(arg1.data(), arg1.size()); 1659fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 16601668ce6dSEd Tanous std::to_array({arg1str})); 1661b6cd31e1SEd Tanous } 1662b6cd31e1SEd Tanous 16633bf4e632SJoseph Reynolds /** 16643bf4e632SJoseph Reynolds * @internal 16653bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 16663bf4e632SJoseph Reynolds * 16673bf4e632SJoseph Reynolds * See header file for more information 16683bf4e632SJoseph Reynolds * @endinternal 16693bf4e632SJoseph Reynolds */ 1670ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res, 1671ace85d60SEd Tanous const boost::urls::url_view& arg1) 16723bf4e632SJoseph Reynolds { 1673b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 16743bf4e632SJoseph Reynolds } 16753bf4e632SJoseph Reynolds 16764cde5d90SJames Feist /** 16774cde5d90SJames Feist * @internal 1678ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1679ae688313SNan Zhou * 1680ae688313SNan Zhou * See header file for more information 1681ae688313SNan Zhou * @endinternal 1682ae688313SNan Zhou */ 1683ae688313SNan Zhou nlohmann::json insufficientStorage() 1684ae688313SNan Zhou { 1685ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1686ae688313SNan Zhou } 1687ae688313SNan Zhou 1688ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1689ae688313SNan Zhou { 1690ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1691ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1692ae688313SNan Zhou } 1693ae688313SNan Zhou 1694ae688313SNan Zhou /** 1695ae688313SNan Zhou * @internal 1696*44c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 1697*44c70412SEd Tanous * 1698*44c70412SEd Tanous * See header file for more information 1699*44c70412SEd Tanous * @endinternal 1700*44c70412SEd Tanous */ 1701*44c70412SEd Tanous nlohmann::json operationNotAllowed() 1702*44c70412SEd Tanous { 1703*44c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 1704*44c70412SEd Tanous } 1705*44c70412SEd Tanous 1706*44c70412SEd Tanous void operationNotAllowed(crow::Response& res) 1707*44c70412SEd Tanous { 1708*44c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 1709*44c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 1710*44c70412SEd Tanous } 1711*44c70412SEd Tanous 1712*44c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 1713*44c70412SEd Tanous std::string_view arg2) 1714*44c70412SEd Tanous { 1715*44c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 1716*44c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 1717*44c70412SEd Tanous } 1718*44c70412SEd Tanous 1719*44c70412SEd Tanous /** 1720*44c70412SEd Tanous * @internal 17214cde5d90SJames Feist * @brief Formats Invalid File message into JSON 17224cde5d90SJames Feist * 17234cde5d90SJames Feist * See header file for more information 17244cde5d90SJames Feist * @endinternal 17254cde5d90SJames Feist */ 17261668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 17274cde5d90SJames Feist { 17281668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 17291668ce6dSEd Tanous msg += arg1; 17301668ce6dSEd Tanous msg += ": "; 17311668ce6dSEd Tanous msg += arg2; 17321668ce6dSEd Tanous msg += "."; 17334cde5d90SJames Feist return nlohmann::json{ 17343e082749SAsmitha Karunanithi {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"}, 17354a0bf539SManojkiran Eda {"MessageId", "OpenBMC.0.2.InvalidUpload"}, 17361668ce6dSEd Tanous {"Message", std::move(msg)}, 17374cde5d90SJames Feist {"MessageArgs", {arg1, arg2}}, 1738684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 17394cde5d90SJames Feist {"Resolution", "None."}}; 17404cde5d90SJames Feist } 1741ae688313SNan Zhou 1742f4c4dcf4SKowalski, Kamil } // namespace messages 1743f4c4dcf4SKowalski, Kamil 1744d425c6f6SEd Tanous } // namespace redfish 1745