1f4c4dcf4SKowalski, Kamil /* 2f4c4dcf4SKowalski, Kamil // Copyright (c) 2018 Intel Corporation 3f4c4dcf4SKowalski, Kamil // 4f4c4dcf4SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License"); 5f4c4dcf4SKowalski, Kamil // you may not use this file except in compliance with the License. 6f4c4dcf4SKowalski, Kamil // You may obtain a copy of the License at 7f4c4dcf4SKowalski, Kamil // 8f4c4dcf4SKowalski, Kamil // http://www.apache.org/licenses/LICENSE-2.0 9f4c4dcf4SKowalski, Kamil // 10f4c4dcf4SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software 11f4c4dcf4SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS, 12f4c4dcf4SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f4c4dcf4SKowalski, Kamil // See the License for the specific language governing permissions and 14f4c4dcf4SKowalski, Kamil // limitations under the License. 15f4c4dcf4SKowalski, Kamil */ 160442ef92SNan Zhou #include "error_messages.hpp" 179ea15c35SEd Tanous 180442ef92SNan Zhou #include "http_response.hpp" 190442ef92SNan Zhou #include "logging.hpp" 200442ef92SNan Zhou #include "nlohmann/json.hpp" 210442ef92SNan Zhou #include "registries.hpp" 220442ef92SNan Zhou #include "registries/base_message_registry.hpp" 230442ef92SNan Zhou #include "source_location.hpp" 240442ef92SNan Zhou 250442ef92SNan Zhou #include <boost/beast/http/field.hpp> 269ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 27f4c4dcf4SKowalski, Kamil 281668ce6dSEd Tanous #include <array> 290442ef92SNan Zhou #include <cstddef> 300442ef92SNan Zhou #include <span> 310442ef92SNan Zhou #include <string> 320442ef92SNan Zhou #include <utility> 330442ef92SNan Zhou 340442ef92SNan Zhou // IWYU pragma: no_include <stddef.h> 351668ce6dSEd Tanous 361abe55efSEd Tanous namespace redfish 371abe55efSEd Tanous { 381abe55efSEd Tanous 391abe55efSEd Tanous namespace messages 401abe55efSEd Tanous { 41f4c4dcf4SKowalski, Kamil 42f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 431abe55efSEd Tanous const nlohmann::json& message) 441abe55efSEd Tanous { 45f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 46f4c4dcf4SKowalski, Kamil 471abe55efSEd Tanous // If this is the first error message, fill in the information from the 481abe55efSEd Tanous // first error message to the top level struct 491abe55efSEd Tanous if (!error.is_object()) 501abe55efSEd Tanous { 51c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 52c074230bSJason M. Bills if (messageIdIterator == message.end()) 531abe55efSEd Tanous { 541abe55efSEd Tanous BMCWEB_LOG_CRITICAL 551abe55efSEd Tanous << "Attempt to add error message without MessageId"; 56f4c4dcf4SKowalski, Kamil return; 57f4c4dcf4SKowalski, Kamil } 58f4c4dcf4SKowalski, Kamil 59c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 60c074230bSJason M. Bills if (messageFieldIterator == message.end()) 611abe55efSEd Tanous { 621abe55efSEd Tanous BMCWEB_LOG_CRITICAL 631abe55efSEd Tanous << "Attempt to add error message without Message"; 64f4c4dcf4SKowalski, Kamil return; 65f4c4dcf4SKowalski, Kamil } 661476687dSEd Tanous error["code"] = *messageIdIterator; 671476687dSEd Tanous error["message"] = *messageFieldIterator; 681abe55efSEd Tanous } 691abe55efSEd Tanous else 701abe55efSEd Tanous { 71f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 7255c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 73cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 74cc9139ecSJason M. Bills "information on how to resolve the error."; 75f4c4dcf4SKowalski, Kamil } 76f4c4dcf4SKowalski, Kamil 773590bd1dSNan Zhou // This check could technically be done in the default construction 78f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 79f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 80c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 81c074230bSJason M. Bills if (!extendedInfo.is_array()) 821abe55efSEd Tanous { 83c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 84f4c4dcf4SKowalski, Kamil } 85f4c4dcf4SKowalski, Kamil 86c074230bSJason M. Bills extendedInfo.push_back(message); 87f4c4dcf4SKowalski, Kamil } 88f4c4dcf4SKowalski, Kamil 893590bd1dSNan Zhou void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source) 903590bd1dSNan Zhou { 913590bd1dSNan Zhou if (!source.is_object()) 923590bd1dSNan Zhou { 933590bd1dSNan Zhou return; 943590bd1dSNan Zhou } 953590bd1dSNan Zhou auto errorIt = source.find("error"); 963590bd1dSNan Zhou if (errorIt == source.end()) 973590bd1dSNan Zhou { 983590bd1dSNan Zhou // caller puts error message in root 993590bd1dSNan Zhou messages::addMessageToErrorJson(target, source); 1003590bd1dSNan Zhou source.clear(); 1013590bd1dSNan Zhou return; 1023590bd1dSNan Zhou } 1033590bd1dSNan Zhou auto extendedInfoIt = errorIt->find(messages::messageAnnotation); 1043590bd1dSNan Zhou if (extendedInfoIt == errorIt->end()) 1053590bd1dSNan Zhou { 1063590bd1dSNan Zhou return; 1073590bd1dSNan Zhou } 1083590bd1dSNan Zhou const nlohmann::json::array_t* extendedInfo = 1093590bd1dSNan Zhou (*extendedInfoIt).get_ptr<const nlohmann::json::array_t*>(); 1103590bd1dSNan Zhou if (extendedInfo == nullptr) 1113590bd1dSNan Zhou { 1123590bd1dSNan Zhou source.erase(errorIt); 1133590bd1dSNan Zhou return; 1143590bd1dSNan Zhou } 1153590bd1dSNan Zhou for (const nlohmann::json& message : *extendedInfo) 1163590bd1dSNan Zhou { 1173590bd1dSNan Zhou addMessageToErrorJson(target, message); 1183590bd1dSNan Zhou } 1193590bd1dSNan Zhou source.erase(errorIt); 1203590bd1dSNan Zhou } 1213590bd1dSNan Zhou 122f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 123f12894f8SJason M. Bills const nlohmann::json& message) 1241abe55efSEd Tanous { 1251abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 1261abe55efSEd Tanous { 127f4c4dcf4SKowalski, Kamil // Force object to be an array 12855c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 129f4c4dcf4SKowalski, Kamil } 130f4c4dcf4SKowalski, Kamil 13155c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 132f4c4dcf4SKowalski, Kamil } 133f4c4dcf4SKowalski, Kamil 134f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 135f12894f8SJason M. Bills const nlohmann::json& message, 1361668ce6dSEd Tanous std::string_view fieldPath) 1371abe55efSEd Tanous { 1381668ce6dSEd Tanous std::string extendedInfo(fieldPath); 1391668ce6dSEd Tanous extendedInfo += messages::messageAnnotation; 140f4c4dcf4SKowalski, Kamil 1411668ce6dSEd Tanous nlohmann::json& field = target[extendedInfo]; 1421668ce6dSEd Tanous if (!field.is_array()) 1431abe55efSEd Tanous { 144f4c4dcf4SKowalski, Kamil // Force object to be an array 1451668ce6dSEd Tanous field = nlohmann::json::array(); 146f4c4dcf4SKowalski, Kamil } 147f4c4dcf4SKowalski, Kamil 148f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 1491668ce6dSEd Tanous field.push_back(message); 150f4c4dcf4SKowalski, Kamil } 151f4c4dcf4SKowalski, Kamil 152f7725d79SEd Tanous static nlohmann::json getLog(redfish::registries::base::Index name, 153b6cd31e1SEd Tanous std::span<const std::string_view> args) 154b6cd31e1SEd Tanous { 155b6cd31e1SEd Tanous size_t index = static_cast<size_t>(name); 156fffb8c1fSEd Tanous if (index >= redfish::registries::base::registry.size()) 157b6cd31e1SEd Tanous { 158b6cd31e1SEd Tanous return {}; 159b6cd31e1SEd Tanous } 16065e4f1f7SEd Tanous return getLogFromRegistry(redfish::registries::base::header, 16165e4f1f7SEd Tanous redfish::registries::base::registry, index, args); 162b6cd31e1SEd Tanous } 163b6cd31e1SEd Tanous 164f4c4dcf4SKowalski, Kamil /** 165f4c4dcf4SKowalski, Kamil * @internal 166f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 167f4c4dcf4SKowalski, Kamil * 168f4c4dcf4SKowalski, Kamil * See header file for more information 169f4c4dcf4SKowalski, Kamil * @endinternal 170f4c4dcf4SKowalski, Kamil */ 171b5c07418SJames Feist nlohmann::json resourceInUse(void) 1721abe55efSEd Tanous { 173fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInUse, {}); 174b5c07418SJames Feist } 175b5c07418SJames Feist 176b5c07418SJames Feist void resourceInUse(crow::Response& res) 177b5c07418SJames Feist { 178b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 179b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 180f4c4dcf4SKowalski, Kamil } 181f4c4dcf4SKowalski, Kamil 182f4c4dcf4SKowalski, Kamil /** 183f4c4dcf4SKowalski, Kamil * @internal 184f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 185f4c4dcf4SKowalski, Kamil * 186f4c4dcf4SKowalski, Kamil * See header file for more information 187f4c4dcf4SKowalski, Kamil * @endinternal 188f4c4dcf4SKowalski, Kamil */ 189b5c07418SJames Feist nlohmann::json malformedJSON(void) 1901abe55efSEd Tanous { 191fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::malformedJSON, {}); 192b5c07418SJames Feist } 193b5c07418SJames Feist 194b5c07418SJames Feist void malformedJSON(crow::Response& res) 195b5c07418SJames Feist { 196b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 197b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 198f4c4dcf4SKowalski, Kamil } 199f4c4dcf4SKowalski, Kamil 200f4c4dcf4SKowalski, Kamil /** 201f4c4dcf4SKowalski, Kamil * @internal 202f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 203f4c4dcf4SKowalski, Kamil * 204f4c4dcf4SKowalski, Kamil * See header file for more information 205f4c4dcf4SKowalski, Kamil * @endinternal 206f4c4dcf4SKowalski, Kamil */ 207ace85d60SEd Tanous nlohmann::json resourceMissingAtURI(const boost::urls::url_view& arg1) 2081abe55efSEd Tanous { 209079360aeSEd Tanous std::array<std::string_view, 1> args{arg1.buffer()}; 210fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); 211b5c07418SJames Feist } 212b5c07418SJames Feist 213ace85d60SEd Tanous void resourceMissingAtURI(crow::Response& res, 214ace85d60SEd Tanous const boost::urls::url_view& arg1) 215b5c07418SJames Feist { 216b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 217b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 218f4c4dcf4SKowalski, Kamil } 219f4c4dcf4SKowalski, Kamil 220f4c4dcf4SKowalski, Kamil /** 221f4c4dcf4SKowalski, Kamil * @internal 222f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 223f4c4dcf4SKowalski, Kamil * 224f4c4dcf4SKowalski, Kamil * See header file for more information 225f4c4dcf4SKowalski, Kamil * @endinternal 226f4c4dcf4SKowalski, Kamil */ 2271668ce6dSEd Tanous nlohmann::json actionParameterValueFormatError(std::string_view arg1, 2281668ce6dSEd Tanous std::string_view arg2, 2291668ce6dSEd Tanous std::string_view arg3) 2301abe55efSEd Tanous { 231fffb8c1fSEd Tanous return getLog( 232fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueFormatError, 2331668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 234b5c07418SJames Feist } 235b5c07418SJames Feist 2361668ce6dSEd Tanous void actionParameterValueFormatError(crow::Response& res, std::string_view arg1, 2371668ce6dSEd Tanous std::string_view arg2, 2381668ce6dSEd Tanous std::string_view arg3) 239b5c07418SJames Feist { 240b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 241b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 242b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 243f4c4dcf4SKowalski, Kamil } 244f4c4dcf4SKowalski, Kamil 245f4c4dcf4SKowalski, Kamil /** 246f4c4dcf4SKowalski, Kamil * @internal 247*4ef82a15SAlex Schendel * @brief Formats ActionParameterValueNotInList message into JSON 248*4ef82a15SAlex Schendel * 249*4ef82a15SAlex Schendel * See header file for more information 250*4ef82a15SAlex Schendel * @endinternal 251*4ef82a15SAlex Schendel */ 252*4ef82a15SAlex Schendel nlohmann::json actionParameterValueNotInList(std::string_view arg1, 253*4ef82a15SAlex Schendel std::string_view arg2, 254*4ef82a15SAlex Schendel std::string_view arg3) 255*4ef82a15SAlex Schendel { 256*4ef82a15SAlex Schendel return getLog( 257*4ef82a15SAlex Schendel redfish::registries::base::Index::actionParameterValueNotInList, 258*4ef82a15SAlex Schendel std::to_array({arg1, arg2, arg3})); 259*4ef82a15SAlex Schendel } 260*4ef82a15SAlex Schendel 261*4ef82a15SAlex Schendel void actionParameterValueNotInList(crow::Response& res, std::string_view arg1, 262*4ef82a15SAlex Schendel std::string_view arg2, std::string_view arg3) 263*4ef82a15SAlex Schendel { 264*4ef82a15SAlex Schendel res.result(boost::beast::http::status::bad_request); 265*4ef82a15SAlex Schendel addMessageToErrorJson(res.jsonValue, 266*4ef82a15SAlex Schendel actionParameterValueNotInList(arg1, arg2, arg3)); 267*4ef82a15SAlex Schendel } 268*4ef82a15SAlex Schendel 269*4ef82a15SAlex Schendel /** 270*4ef82a15SAlex Schendel * @internal 271f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 272f4c4dcf4SKowalski, Kamil * 273f4c4dcf4SKowalski, Kamil * See header file for more information 274f4c4dcf4SKowalski, Kamil * @endinternal 275f4c4dcf4SKowalski, Kamil */ 276b5c07418SJames Feist nlohmann::json internalError(void) 2771abe55efSEd Tanous { 278fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::internalError, {}); 279b5c07418SJames Feist } 280b5c07418SJames Feist 281df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 282b5c07418SJames Feist { 283df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 284df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 285df5415fcSEd Tanous << location.function_name() << "`: "; 286b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 287b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 288f12894f8SJason M. Bills } 289f12894f8SJason M. Bills 290f12894f8SJason M. Bills /** 291f12894f8SJason M. Bills * @internal 292f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 293f4c4dcf4SKowalski, Kamil * 294f4c4dcf4SKowalski, Kamil * See header file for more information 295f4c4dcf4SKowalski, Kamil * @endinternal 296f4c4dcf4SKowalski, Kamil */ 297b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2981abe55efSEd Tanous { 299fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::unrecognizedRequestBody, 300fffb8c1fSEd Tanous {}); 301b5c07418SJames Feist } 302b5c07418SJames Feist 303b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 304b5c07418SJames Feist { 305b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 306b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 307f4c4dcf4SKowalski, Kamil } 308f4c4dcf4SKowalski, Kamil 309f4c4dcf4SKowalski, Kamil /** 310f4c4dcf4SKowalski, Kamil * @internal 311f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 312f4c4dcf4SKowalski, Kamil * 313f4c4dcf4SKowalski, Kamil * See header file for more information 314f4c4dcf4SKowalski, Kamil * @endinternal 315f4c4dcf4SKowalski, Kamil */ 316ace85d60SEd Tanous nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view& arg1, 3171668ce6dSEd Tanous std::string_view arg2) 3181abe55efSEd Tanous { 319079360aeSEd Tanous return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, 320079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 321b5c07418SJames Feist } 322b5c07418SJames Feist 323ace85d60SEd Tanous void resourceAtUriUnauthorized(crow::Response& res, 324ace85d60SEd Tanous const boost::urls::url_view& arg1, 3251668ce6dSEd Tanous std::string_view arg2) 326b5c07418SJames Feist { 327b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 328b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 329f4c4dcf4SKowalski, Kamil } 330f4c4dcf4SKowalski, Kamil 331f4c4dcf4SKowalski, Kamil /** 332f4c4dcf4SKowalski, Kamil * @internal 333f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 334f4c4dcf4SKowalski, Kamil * 335f4c4dcf4SKowalski, Kamil * See header file for more information 336f4c4dcf4SKowalski, Kamil * @endinternal 337f4c4dcf4SKowalski, Kamil */ 3381668ce6dSEd Tanous nlohmann::json actionParameterUnknown(std::string_view arg1, 3391668ce6dSEd Tanous std::string_view arg2) 340b5c07418SJames Feist { 341fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterUnknown, 3421668ce6dSEd Tanous std::to_array({arg1, arg2})); 343b5c07418SJames Feist } 344b5c07418SJames Feist 3451668ce6dSEd Tanous void actionParameterUnknown(crow::Response& res, std::string_view arg1, 3461668ce6dSEd Tanous std::string_view arg2) 3471abe55efSEd Tanous { 348f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 349b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 350f4c4dcf4SKowalski, Kamil } 351f4c4dcf4SKowalski, Kamil 352f4c4dcf4SKowalski, Kamil /** 353f4c4dcf4SKowalski, Kamil * @internal 354f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 355f4c4dcf4SKowalski, Kamil * 356f4c4dcf4SKowalski, Kamil * See header file for more information 357f4c4dcf4SKowalski, Kamil * @endinternal 358f4c4dcf4SKowalski, Kamil */ 359b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3601abe55efSEd Tanous { 361fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCannotBeDeleted, 362fffb8c1fSEd Tanous {}); 363b5c07418SJames Feist } 364b5c07418SJames Feist 365b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 366b5c07418SJames Feist { 36744c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 368b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 369f4c4dcf4SKowalski, Kamil } 370f4c4dcf4SKowalski, Kamil 371f4c4dcf4SKowalski, Kamil /** 372f4c4dcf4SKowalski, Kamil * @internal 373f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 374f4c4dcf4SKowalski, Kamil * 375f4c4dcf4SKowalski, Kamil * See header file for more information 376f4c4dcf4SKowalski, Kamil * @endinternal 377f4c4dcf4SKowalski, Kamil */ 3781668ce6dSEd Tanous nlohmann::json propertyDuplicate(std::string_view arg1) 3791abe55efSEd Tanous { 380fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyDuplicate, 3811668ce6dSEd Tanous std::to_array({arg1})); 382b5c07418SJames Feist } 383b5c07418SJames Feist 3841668ce6dSEd Tanous void propertyDuplicate(crow::Response& res, std::string_view arg1) 385b5c07418SJames Feist { 386b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 387b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 388f4c4dcf4SKowalski, Kamil } 389f4c4dcf4SKowalski, Kamil 390f4c4dcf4SKowalski, Kamil /** 391f4c4dcf4SKowalski, Kamil * @internal 392f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 393f4c4dcf4SKowalski, Kamil * 394f4c4dcf4SKowalski, Kamil * See header file for more information 395f4c4dcf4SKowalski, Kamil * @endinternal 396f4c4dcf4SKowalski, Kamil */ 3971668ce6dSEd Tanous nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1) 3981abe55efSEd Tanous { 399b6cd31e1SEd Tanous return getLog( 400fffb8c1fSEd Tanous redfish::registries::base::Index::serviceTemporarilyUnavailable, 4011668ce6dSEd Tanous std::to_array({arg1})); 402b5c07418SJames Feist } 403b5c07418SJames Feist 4041668ce6dSEd Tanous void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1) 405b5c07418SJames Feist { 406d9f6c621SEd Tanous res.addHeader(boost::beast::http::field::retry_after, arg1); 407b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 408b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 409f4c4dcf4SKowalski, Kamil } 410f4c4dcf4SKowalski, Kamil 411f4c4dcf4SKowalski, Kamil /** 412f4c4dcf4SKowalski, Kamil * @internal 413f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 414f4c4dcf4SKowalski, Kamil * 415f4c4dcf4SKowalski, Kamil * See header file for more information 416f4c4dcf4SKowalski, Kamil * @endinternal 417f4c4dcf4SKowalski, Kamil */ 4181668ce6dSEd Tanous nlohmann::json resourceAlreadyExists(std::string_view arg1, 4191668ce6dSEd Tanous std::string_view arg2, 4201668ce6dSEd Tanous std::string_view arg3) 4211abe55efSEd Tanous { 422fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceAlreadyExists, 4231668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 424b5c07418SJames Feist } 425b5c07418SJames Feist 4261668ce6dSEd Tanous void resourceAlreadyExists(crow::Response& res, std::string_view arg1, 4271668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 428b5c07418SJames Feist { 429b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 430b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 431a08b46ccSJason M. Bills arg2); 432f4c4dcf4SKowalski, Kamil } 433f4c4dcf4SKowalski, Kamil 434f4c4dcf4SKowalski, Kamil /** 435f4c4dcf4SKowalski, Kamil * @internal 436f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 437f4c4dcf4SKowalski, Kamil * 438f4c4dcf4SKowalski, Kamil * See header file for more information 439f4c4dcf4SKowalski, Kamil * @endinternal 440f4c4dcf4SKowalski, Kamil */ 441b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4421abe55efSEd Tanous { 443fffb8c1fSEd Tanous return getLog( 444fffb8c1fSEd Tanous redfish::registries::base::Index::accountForSessionNoLongerExists, {}); 445b5c07418SJames Feist } 446b5c07418SJames Feist 447b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 448b5c07418SJames Feist { 449b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 450b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 451f4c4dcf4SKowalski, Kamil } 452f4c4dcf4SKowalski, Kamil 453f4c4dcf4SKowalski, Kamil /** 454f4c4dcf4SKowalski, Kamil * @internal 455f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 456f4c4dcf4SKowalski, Kamil * 457f4c4dcf4SKowalski, Kamil * See header file for more information 458f4c4dcf4SKowalski, Kamil * @endinternal 459f4c4dcf4SKowalski, Kamil */ 4601668ce6dSEd Tanous nlohmann::json createFailedMissingReqProperties(std::string_view arg1) 4611abe55efSEd Tanous { 462fffb8c1fSEd Tanous return getLog( 463fffb8c1fSEd Tanous redfish::registries::base::Index::createFailedMissingReqProperties, 4641668ce6dSEd Tanous std::to_array({arg1})); 465b5c07418SJames Feist } 466b5c07418SJames Feist 467b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 4681668ce6dSEd Tanous std::string_view arg1) 469b5c07418SJames Feist { 470b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 471b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 472a08b46ccSJason M. Bills arg1); 473f12894f8SJason M. Bills } 474f12894f8SJason M. Bills 475f12894f8SJason M. Bills /** 476f12894f8SJason M. Bills * @internal 477f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 478f12894f8SJason M. Bills * property 479f12894f8SJason M. Bills * 480f12894f8SJason M. Bills * See header file for more information 481f12894f8SJason M. Bills * @endinternal 482f12894f8SJason M. Bills */ 4831668ce6dSEd Tanous nlohmann::json propertyValueFormatError(std::string_view arg1, 4841668ce6dSEd Tanous std::string_view arg2) 485f12894f8SJason M. Bills { 486fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueFormatError, 4871668ce6dSEd Tanous std::to_array({arg1, arg2})); 488b5c07418SJames Feist } 489b5c07418SJames Feist 4901668ce6dSEd Tanous void propertyValueFormatError(crow::Response& res, std::string_view arg1, 4911668ce6dSEd Tanous std::string_view arg2) 492b5c07418SJames Feist { 493b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 494b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 495f12894f8SJason M. Bills } 496f12894f8SJason M. Bills 497f12894f8SJason M. Bills /** 498f12894f8SJason M. Bills * @internal 499f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 500f12894f8SJason M. Bills * property 501f12894f8SJason M. Bills * 502f12894f8SJason M. Bills * See header file for more information 503f12894f8SJason M. Bills * @endinternal 504f12894f8SJason M. Bills */ 5051668ce6dSEd Tanous nlohmann::json propertyValueNotInList(std::string_view arg1, 5061668ce6dSEd Tanous std::string_view arg2) 507f12894f8SJason M. Bills { 508fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueNotInList, 5091668ce6dSEd Tanous std::to_array({arg1, arg2})); 510b5c07418SJames Feist } 511b5c07418SJames Feist 5121668ce6dSEd Tanous void propertyValueNotInList(crow::Response& res, std::string_view arg1, 5131668ce6dSEd Tanous std::string_view arg2) 514b5c07418SJames Feist { 515b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 516b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 517f4c4dcf4SKowalski, Kamil } 518f4c4dcf4SKowalski, Kamil 519f4c4dcf4SKowalski, Kamil /** 520f4c4dcf4SKowalski, Kamil * @internal 521227a2b0aSJiaqing Zhao * @brief Formats PropertyValueOutOfRange message into JSON 522227a2b0aSJiaqing Zhao * 523227a2b0aSJiaqing Zhao * See header file for more information 524227a2b0aSJiaqing Zhao * @endinternal 525227a2b0aSJiaqing Zhao */ 526227a2b0aSJiaqing Zhao nlohmann::json propertyValueOutOfRange(std::string_view arg1, 527227a2b0aSJiaqing Zhao std::string_view arg2) 528227a2b0aSJiaqing Zhao { 529227a2b0aSJiaqing Zhao return getLog(redfish::registries::base::Index::propertyValueOutOfRange, 530227a2b0aSJiaqing Zhao std::to_array({arg1, arg2})); 531227a2b0aSJiaqing Zhao } 532227a2b0aSJiaqing Zhao 533227a2b0aSJiaqing Zhao void propertyValueOutOfRange(crow::Response& res, std::string_view arg1, 534227a2b0aSJiaqing Zhao std::string_view arg2) 535227a2b0aSJiaqing Zhao { 536227a2b0aSJiaqing Zhao res.result(boost::beast::http::status::bad_request); 537227a2b0aSJiaqing Zhao addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2)); 538227a2b0aSJiaqing Zhao } 539227a2b0aSJiaqing Zhao 540227a2b0aSJiaqing Zhao /** 541227a2b0aSJiaqing Zhao * @internal 542f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 543f4c4dcf4SKowalski, Kamil * 544f4c4dcf4SKowalski, Kamil * See header file for more information 545f4c4dcf4SKowalski, Kamil * @endinternal 546f4c4dcf4SKowalski, Kamil */ 547ace85d60SEd Tanous nlohmann::json resourceAtUriInUnknownFormat(const boost::urls::url_view& arg1) 5481abe55efSEd Tanous { 549b6cd31e1SEd Tanous return getLog( 550fffb8c1fSEd Tanous redfish::registries::base::Index::resourceAtUriInUnknownFormat, 551079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 552b5c07418SJames Feist } 553b5c07418SJames Feist 554ace85d60SEd Tanous void resourceAtUriInUnknownFormat(crow::Response& res, 555ace85d60SEd Tanous const boost::urls::url_view& arg1) 556b5c07418SJames Feist { 557b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 558b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 559f4c4dcf4SKowalski, Kamil } 560f4c4dcf4SKowalski, Kamil 561f4c4dcf4SKowalski, Kamil /** 562f4c4dcf4SKowalski, Kamil * @internal 56381856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 56481856681SAsmitha Karunanithi * 56581856681SAsmitha Karunanithi * See header file for more information 56681856681SAsmitha Karunanithi * @endinternal 56781856681SAsmitha Karunanithi */ 5681668ce6dSEd Tanous nlohmann::json serviceDisabled(std::string_view arg1) 56981856681SAsmitha Karunanithi { 570fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceDisabled, 5711668ce6dSEd Tanous std::to_array({arg1})); 57281856681SAsmitha Karunanithi } 57381856681SAsmitha Karunanithi 5741668ce6dSEd Tanous void serviceDisabled(crow::Response& res, std::string_view arg1) 57581856681SAsmitha Karunanithi { 57681856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 57781856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 57881856681SAsmitha Karunanithi } 57981856681SAsmitha Karunanithi 58081856681SAsmitha Karunanithi /** 58181856681SAsmitha Karunanithi * @internal 582f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 583f4c4dcf4SKowalski, Kamil * 584f4c4dcf4SKowalski, Kamil * See header file for more information 585f4c4dcf4SKowalski, Kamil * @endinternal 586f4c4dcf4SKowalski, Kamil */ 587b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 5881abe55efSEd Tanous { 589fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceInUnknownState, {}); 590b5c07418SJames Feist } 591b5c07418SJames Feist 592b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 593b5c07418SJames Feist { 594b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 595b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 596f4c4dcf4SKowalski, Kamil } 597f4c4dcf4SKowalski, Kamil 598f4c4dcf4SKowalski, Kamil /** 599f4c4dcf4SKowalski, Kamil * @internal 600f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 601f4c4dcf4SKowalski, Kamil * 602f4c4dcf4SKowalski, Kamil * See header file for more information 603f4c4dcf4SKowalski, Kamil * @endinternal 604f4c4dcf4SKowalski, Kamil */ 605b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 6061abe55efSEd Tanous { 607fffb8c1fSEd Tanous return getLog( 608fffb8c1fSEd Tanous redfish::registries::base::Index::eventSubscriptionLimitExceeded, {}); 609b5c07418SJames Feist } 610b5c07418SJames Feist 611b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 612b5c07418SJames Feist { 613789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 614b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 615f4c4dcf4SKowalski, Kamil } 616f4c4dcf4SKowalski, Kamil 617f4c4dcf4SKowalski, Kamil /** 618f4c4dcf4SKowalski, Kamil * @internal 619f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 620f4c4dcf4SKowalski, Kamil * 621f4c4dcf4SKowalski, Kamil * See header file for more information 622f4c4dcf4SKowalski, Kamil * @endinternal 623f4c4dcf4SKowalski, Kamil */ 6241668ce6dSEd Tanous nlohmann::json actionParameterMissing(std::string_view arg1, 6251668ce6dSEd Tanous std::string_view arg2) 6261abe55efSEd Tanous { 627fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterMissing, 6281668ce6dSEd Tanous std::to_array({arg1, arg2})); 629b5c07418SJames Feist } 630b5c07418SJames Feist 6311668ce6dSEd Tanous void actionParameterMissing(crow::Response& res, std::string_view arg1, 6321668ce6dSEd Tanous std::string_view arg2) 633b5c07418SJames Feist { 634b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 635b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 636f4c4dcf4SKowalski, Kamil } 637f4c4dcf4SKowalski, Kamil 638f4c4dcf4SKowalski, Kamil /** 639f4c4dcf4SKowalski, Kamil * @internal 640f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 641f4c4dcf4SKowalski, Kamil * 642f4c4dcf4SKowalski, Kamil * See header file for more information 643f4c4dcf4SKowalski, Kamil * @endinternal 644f4c4dcf4SKowalski, Kamil */ 6451668ce6dSEd Tanous nlohmann::json stringValueTooLong(std::string_view arg1, int arg2) 6461abe55efSEd Tanous { 647b6cd31e1SEd Tanous std::string arg2String = std::to_string(arg2); 648fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::stringValueTooLong, 6491668ce6dSEd Tanous std::to_array({arg1, std::string_view(arg2String)})); 650b5c07418SJames Feist } 651b5c07418SJames Feist 6521668ce6dSEd Tanous void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2) 653b5c07418SJames Feist { 654b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 655b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 656f4c4dcf4SKowalski, Kamil } 657f4c4dcf4SKowalski, Kamil 658f4c4dcf4SKowalski, Kamil /** 659f4c4dcf4SKowalski, Kamil * @internal 660cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 661cc9139ecSJason M. Bills * 662cc9139ecSJason M. Bills * See header file for more information 663cc9139ecSJason M. Bills * @endinternal 664cc9139ecSJason M. Bills */ 665b5c07418SJames Feist nlohmann::json sessionTerminated(void) 666cc9139ecSJason M. Bills { 667fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionTerminated, {}); 668b5c07418SJames Feist } 669b5c07418SJames Feist 670b5c07418SJames Feist void sessionTerminated(crow::Response& res) 671b5c07418SJames Feist { 672b5c07418SJames Feist res.result(boost::beast::http::status::ok); 673b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 674cc9139ecSJason M. Bills } 675cc9139ecSJason M. Bills 676cc9139ecSJason M. Bills /** 677cc9139ecSJason M. Bills * @internal 678684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 679684bb4b8SJason M. Bills * 680684bb4b8SJason M. Bills * See header file for more information 681684bb4b8SJason M. Bills * @endinternal 682684bb4b8SJason M. Bills */ 683684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 684684bb4b8SJason M. Bills { 685fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::subscriptionTerminated, {}); 686684bb4b8SJason M. Bills } 687684bb4b8SJason M. Bills 688684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 689684bb4b8SJason M. Bills { 690684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 691684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 692684bb4b8SJason M. Bills } 693684bb4b8SJason M. Bills 694684bb4b8SJason M. Bills /** 695684bb4b8SJason M. Bills * @internal 696cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 697cc9139ecSJason M. Bills * 698cc9139ecSJason M. Bills * See header file for more information 699cc9139ecSJason M. Bills * @endinternal 700cc9139ecSJason M. Bills */ 7011668ce6dSEd Tanous nlohmann::json resourceTypeIncompatible(std::string_view arg1, 7021668ce6dSEd Tanous std::string_view arg2) 703cc9139ecSJason M. Bills { 704fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceTypeIncompatible, 7051668ce6dSEd Tanous std::to_array({arg1, arg2})); 706b5c07418SJames Feist } 707b5c07418SJames Feist 7081668ce6dSEd Tanous void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, 7091668ce6dSEd Tanous std::string_view arg2) 710b5c07418SJames Feist { 711b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 712b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 713cc9139ecSJason M. Bills } 714cc9139ecSJason M. Bills 715cc9139ecSJason M. Bills /** 716cc9139ecSJason M. Bills * @internal 717684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 718684bb4b8SJason M. Bills * 719684bb4b8SJason M. Bills * See header file for more information 720684bb4b8SJason M. Bills * @endinternal 721684bb4b8SJason M. Bills */ 722ace85d60SEd Tanous nlohmann::json resetRequired(const boost::urls::url_view& arg1, 7231668ce6dSEd Tanous std::string_view arg2) 724684bb4b8SJason M. Bills { 725fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 726079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 727684bb4b8SJason M. Bills } 728684bb4b8SJason M. Bills 729ace85d60SEd Tanous void resetRequired(crow::Response& res, const boost::urls::url_view& arg1, 7301668ce6dSEd Tanous std::string_view arg2) 731684bb4b8SJason M. Bills { 732684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 733684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 734684bb4b8SJason M. Bills } 735684bb4b8SJason M. Bills 736684bb4b8SJason M. Bills /** 737684bb4b8SJason M. Bills * @internal 738684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 739684bb4b8SJason M. Bills * 740684bb4b8SJason M. Bills * See header file for more information 741684bb4b8SJason M. Bills * @endinternal 742684bb4b8SJason M. Bills */ 7431668ce6dSEd Tanous nlohmann::json chassisPowerStateOnRequired(std::string_view arg1) 744684bb4b8SJason M. Bills { 745fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resetRequired, 7461668ce6dSEd Tanous std::to_array({arg1})); 747684bb4b8SJason M. Bills } 748684bb4b8SJason M. Bills 7491668ce6dSEd Tanous void chassisPowerStateOnRequired(crow::Response& res, std::string_view arg1) 750684bb4b8SJason M. Bills { 751684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 752684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 753684bb4b8SJason M. Bills } 754684bb4b8SJason M. Bills 755684bb4b8SJason M. Bills /** 756684bb4b8SJason M. Bills * @internal 757684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 758684bb4b8SJason M. Bills * 759684bb4b8SJason M. Bills * See header file for more information 760684bb4b8SJason M. Bills * @endinternal 761684bb4b8SJason M. Bills */ 7621668ce6dSEd Tanous nlohmann::json chassisPowerStateOffRequired(std::string_view arg1) 763684bb4b8SJason M. Bills { 764b6cd31e1SEd Tanous return getLog( 765fffb8c1fSEd Tanous redfish::registries::base::Index::chassisPowerStateOffRequired, 7661668ce6dSEd Tanous std::to_array({arg1})); 767684bb4b8SJason M. Bills } 768684bb4b8SJason M. Bills 7691668ce6dSEd Tanous void chassisPowerStateOffRequired(crow::Response& res, std::string_view arg1) 770684bb4b8SJason M. Bills { 771684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 772684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 773684bb4b8SJason M. Bills } 774684bb4b8SJason M. Bills 775684bb4b8SJason M. Bills /** 776684bb4b8SJason M. Bills * @internal 777684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 778684bb4b8SJason M. Bills * 779684bb4b8SJason M. Bills * See header file for more information 780684bb4b8SJason M. Bills * @endinternal 781684bb4b8SJason M. Bills */ 7821668ce6dSEd Tanous nlohmann::json propertyValueConflict(std::string_view arg1, 7831668ce6dSEd Tanous std::string_view arg2) 784684bb4b8SJason M. Bills { 785fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueConflict, 7861668ce6dSEd Tanous std::to_array({arg1, arg2})); 787684bb4b8SJason M. Bills } 788684bb4b8SJason M. Bills 7891668ce6dSEd Tanous void propertyValueConflict(crow::Response& res, std::string_view arg1, 7901668ce6dSEd Tanous std::string_view arg2) 791684bb4b8SJason M. Bills { 792684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 793684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 794684bb4b8SJason M. Bills } 795684bb4b8SJason M. Bills 796684bb4b8SJason M. Bills /** 797684bb4b8SJason M. Bills * @internal 7982a6af81cSRamesh Iyyar * @brief Formats PropertyValueResourceConflict message into JSON 7992a6af81cSRamesh Iyyar * 8002a6af81cSRamesh Iyyar * See header file for more information 8012a6af81cSRamesh Iyyar * @endinternal 8022a6af81cSRamesh Iyyar */ 8032a6af81cSRamesh Iyyar nlohmann::json propertyValueResourceConflict(std::string_view arg1, 8042a6af81cSRamesh Iyyar std::string_view arg2, 8052a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 8062a6af81cSRamesh Iyyar { 8072a6af81cSRamesh Iyyar return getLog( 8082a6af81cSRamesh Iyyar redfish::registries::base::Index::propertyValueResourceConflict, 809079360aeSEd Tanous std::to_array<std::string_view>({arg1, arg2, arg3.buffer()})); 8102a6af81cSRamesh Iyyar } 8112a6af81cSRamesh Iyyar 8122a6af81cSRamesh Iyyar void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, 8132a6af81cSRamesh Iyyar std::string_view arg2, 8142a6af81cSRamesh Iyyar const boost::urls::url_view& arg3) 8152a6af81cSRamesh Iyyar { 8162a6af81cSRamesh Iyyar res.result(boost::beast::http::status::conflict); 8172a6af81cSRamesh Iyyar addMessageToErrorJson(res.jsonValue, 8182a6af81cSRamesh Iyyar propertyValueResourceConflict(arg1, arg2, arg3)); 8192a6af81cSRamesh Iyyar } 8202a6af81cSRamesh Iyyar 8212a6af81cSRamesh Iyyar /** 8222a6af81cSRamesh Iyyar * @internal 82324861a28SRamesh Iyyar * @brief Formats PropertyValueExternalConflict message into JSON 82424861a28SRamesh Iyyar * 82524861a28SRamesh Iyyar * See header file for more information 82624861a28SRamesh Iyyar * @endinternal 82724861a28SRamesh Iyyar */ 82824861a28SRamesh Iyyar nlohmann::json propertyValueExternalConflict(std::string_view arg1, 82924861a28SRamesh Iyyar std::string_view arg2) 83024861a28SRamesh Iyyar { 83124861a28SRamesh Iyyar return getLog( 83224861a28SRamesh Iyyar redfish::registries::base::Index::propertyValueExternalConflict, 83324861a28SRamesh Iyyar std::to_array({arg1, arg2})); 83424861a28SRamesh Iyyar } 83524861a28SRamesh Iyyar 83624861a28SRamesh Iyyar void propertyValueExternalConflict(crow::Response& res, std::string_view arg1, 83724861a28SRamesh Iyyar std::string_view arg2) 83824861a28SRamesh Iyyar { 83924861a28SRamesh Iyyar res.result(boost::beast::http::status::conflict); 84024861a28SRamesh Iyyar addMessageToErrorJson(res.jsonValue, 84124861a28SRamesh Iyyar propertyValueExternalConflict(arg1, arg2)); 84224861a28SRamesh Iyyar } 84324861a28SRamesh Iyyar 84424861a28SRamesh Iyyar /** 84524861a28SRamesh Iyyar * @internal 846684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 847684bb4b8SJason M. Bills * 848684bb4b8SJason M. Bills * See header file for more information 849684bb4b8SJason M. Bills * @endinternal 850684bb4b8SJason M. Bills */ 8511668ce6dSEd Tanous nlohmann::json propertyValueIncorrect(std::string_view arg1, 8521668ce6dSEd Tanous std::string_view arg2) 853684bb4b8SJason M. Bills { 854fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueIncorrect, 8551668ce6dSEd Tanous std::to_array({arg1, arg2})); 856684bb4b8SJason M. Bills } 857684bb4b8SJason M. Bills 8581668ce6dSEd Tanous void propertyValueIncorrect(crow::Response& res, std::string_view arg1, 8591668ce6dSEd Tanous std::string_view arg2) 860684bb4b8SJason M. Bills { 861684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 862684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 863684bb4b8SJason M. Bills } 864684bb4b8SJason M. Bills 865684bb4b8SJason M. Bills /** 866684bb4b8SJason M. Bills * @internal 867684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 868684bb4b8SJason M. Bills * 869684bb4b8SJason M. Bills * See header file for more information 870684bb4b8SJason M. Bills * @endinternal 871684bb4b8SJason M. Bills */ 872ace85d60SEd Tanous nlohmann::json resourceCreationConflict(const boost::urls::url_view& arg1) 873684bb4b8SJason M. Bills { 874fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceCreationConflict, 875079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 876684bb4b8SJason M. Bills } 877684bb4b8SJason M. Bills 878ace85d60SEd Tanous void resourceCreationConflict(crow::Response& res, 879ace85d60SEd Tanous const boost::urls::url_view& arg1) 880684bb4b8SJason M. Bills { 881684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 882684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 883684bb4b8SJason M. Bills } 884684bb4b8SJason M. Bills 885684bb4b8SJason M. Bills /** 886684bb4b8SJason M. Bills * @internal 887684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 888684bb4b8SJason M. Bills * 889684bb4b8SJason M. Bills * See header file for more information 890684bb4b8SJason M. Bills * @endinternal 891684bb4b8SJason M. Bills */ 892684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 893684bb4b8SJason M. Bills { 894fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::maximumErrorsExceeded, {}); 895684bb4b8SJason M. Bills } 896684bb4b8SJason M. Bills 897684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 898684bb4b8SJason M. Bills { 899684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 900684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 901684bb4b8SJason M. Bills } 902684bb4b8SJason M. Bills 903684bb4b8SJason M. Bills /** 904684bb4b8SJason M. Bills * @internal 905684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 906684bb4b8SJason M. Bills * 907684bb4b8SJason M. Bills * See header file for more information 908684bb4b8SJason M. Bills * @endinternal 909684bb4b8SJason M. Bills */ 910684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 911684bb4b8SJason M. Bills { 912fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionFailed, {}); 913684bb4b8SJason M. Bills } 914684bb4b8SJason M. Bills 915684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 916684bb4b8SJason M. Bills { 9174df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 918684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 919684bb4b8SJason M. Bills } 920684bb4b8SJason M. Bills 921684bb4b8SJason M. Bills /** 922684bb4b8SJason M. Bills * @internal 923684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 924684bb4b8SJason M. Bills * 925684bb4b8SJason M. Bills * See header file for more information 926684bb4b8SJason M. Bills * @endinternal 927684bb4b8SJason M. Bills */ 928684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 929684bb4b8SJason M. Bills { 930fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::preconditionRequired, {}); 931684bb4b8SJason M. Bills } 932684bb4b8SJason M. Bills 933684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 934684bb4b8SJason M. Bills { 935684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 936684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 937684bb4b8SJason M. Bills } 938684bb4b8SJason M. Bills 939684bb4b8SJason M. Bills /** 940684bb4b8SJason M. Bills * @internal 941684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 942684bb4b8SJason M. Bills * 943684bb4b8SJason M. Bills * See header file for more information 944684bb4b8SJason M. Bills * @endinternal 945684bb4b8SJason M. Bills */ 946684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 947684bb4b8SJason M. Bills { 948fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationFailed, {}); 949684bb4b8SJason M. Bills } 950684bb4b8SJason M. Bills 951684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 952684bb4b8SJason M. Bills { 9538868776eSEd Tanous res.result(boost::beast::http::status::bad_gateway); 954684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 955684bb4b8SJason M. Bills } 956684bb4b8SJason M. Bills 957684bb4b8SJason M. Bills /** 958684bb4b8SJason M. Bills * @internal 959684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 960684bb4b8SJason M. Bills * 961684bb4b8SJason M. Bills * See header file for more information 962684bb4b8SJason M. Bills * @endinternal 963684bb4b8SJason M. Bills */ 964684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 965684bb4b8SJason M. Bills { 966fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::operationTimeout, {}); 967684bb4b8SJason M. Bills } 968684bb4b8SJason M. Bills 969684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 970684bb4b8SJason M. Bills { 971684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 972684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 973684bb4b8SJason M. Bills } 974684bb4b8SJason M. Bills 975684bb4b8SJason M. Bills /** 976684bb4b8SJason M. Bills * @internal 977f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 978f12894f8SJason M. Bills * property 979f12894f8SJason M. Bills * 980f12894f8SJason M. Bills * See header file for more information 981f12894f8SJason M. Bills * @endinternal 982f12894f8SJason M. Bills */ 9831668ce6dSEd Tanous nlohmann::json propertyValueTypeError(std::string_view arg1, 9841668ce6dSEd Tanous std::string_view arg2) 985f12894f8SJason M. Bills { 986fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueTypeError, 9871668ce6dSEd Tanous std::to_array({arg1, arg2})); 988b5c07418SJames Feist } 989b5c07418SJames Feist 9901668ce6dSEd Tanous void propertyValueTypeError(crow::Response& res, std::string_view arg1, 9911668ce6dSEd Tanous std::string_view arg2) 992b5c07418SJames Feist { 993b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 994b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 995f4c4dcf4SKowalski, Kamil } 996f4c4dcf4SKowalski, Kamil 997f4c4dcf4SKowalski, Kamil /** 998f4c4dcf4SKowalski, Kamil * @internal 999b6cd31e1SEd Tanous * @brief Formats ResourceNotFound message into JSONd 1000f4c4dcf4SKowalski, Kamil * 1001f4c4dcf4SKowalski, Kamil * See header file for more information 1002f4c4dcf4SKowalski, Kamil * @endinternal 1003f4c4dcf4SKowalski, Kamil */ 10041668ce6dSEd Tanous nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2) 10051abe55efSEd Tanous { 1006fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceNotFound, 10071668ce6dSEd Tanous std::to_array({arg1, arg2})); 1008b5c07418SJames Feist } 1009b5c07418SJames Feist 10101668ce6dSEd Tanous void resourceNotFound(crow::Response& res, std::string_view arg1, 10111668ce6dSEd Tanous std::string_view arg2) 1012b5c07418SJames Feist { 1013b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1014b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1015f4c4dcf4SKowalski, Kamil } 1016f4c4dcf4SKowalski, Kamil 1017f4c4dcf4SKowalski, Kamil /** 1018f4c4dcf4SKowalski, Kamil * @internal 1019f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1020f4c4dcf4SKowalski, Kamil * 1021f4c4dcf4SKowalski, Kamil * See header file for more information 1022f4c4dcf4SKowalski, Kamil * @endinternal 1023f4c4dcf4SKowalski, Kamil */ 1024ace85d60SEd Tanous nlohmann::json couldNotEstablishConnection(const boost::urls::url_view& arg1) 10251abe55efSEd Tanous { 1026fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::couldNotEstablishConnection, 1027079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1028b5c07418SJames Feist } 1029b5c07418SJames Feist 1030ace85d60SEd Tanous void couldNotEstablishConnection(crow::Response& res, 1031ace85d60SEd Tanous const boost::urls::url_view& arg1) 1032b5c07418SJames Feist { 1033b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1034b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1035f4c4dcf4SKowalski, Kamil } 1036f4c4dcf4SKowalski, Kamil 1037f4c4dcf4SKowalski, Kamil /** 1038f4c4dcf4SKowalski, Kamil * @internal 1039f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1040f12894f8SJason M. Bills * property 1041f12894f8SJason M. Bills * 1042f12894f8SJason M. Bills * See header file for more information 1043f12894f8SJason M. Bills * @endinternal 1044f12894f8SJason M. Bills */ 10451668ce6dSEd Tanous nlohmann::json propertyNotWritable(std::string_view arg1) 1046f12894f8SJason M. Bills { 1047fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyNotWritable, 10481668ce6dSEd Tanous std::to_array({arg1})); 1049b5c07418SJames Feist } 1050b5c07418SJames Feist 10511668ce6dSEd Tanous void propertyNotWritable(crow::Response& res, std::string_view arg1) 1052b5c07418SJames Feist { 1053b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1054b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1055f4c4dcf4SKowalski, Kamil } 1056f4c4dcf4SKowalski, Kamil 1057f4c4dcf4SKowalski, Kamil /** 1058f4c4dcf4SKowalski, Kamil * @internal 1059f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1060f4c4dcf4SKowalski, Kamil * 1061f4c4dcf4SKowalski, Kamil * See header file for more information 1062f4c4dcf4SKowalski, Kamil * @endinternal 1063f4c4dcf4SKowalski, Kamil */ 10641668ce6dSEd Tanous nlohmann::json queryParameterValueTypeError(std::string_view arg1, 10651668ce6dSEd Tanous std::string_view arg2) 10661abe55efSEd Tanous { 1067b6cd31e1SEd Tanous return getLog( 1068fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueTypeError, 10691668ce6dSEd Tanous std::to_array({arg1, arg2})); 1070b5c07418SJames Feist } 1071b5c07418SJames Feist 10721668ce6dSEd Tanous void queryParameterValueTypeError(crow::Response& res, std::string_view arg1, 10731668ce6dSEd Tanous std::string_view arg2) 1074b5c07418SJames Feist { 1075b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1076b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1077b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1078f4c4dcf4SKowalski, Kamil } 1079f4c4dcf4SKowalski, Kamil 1080f4c4dcf4SKowalski, Kamil /** 1081f4c4dcf4SKowalski, Kamil * @internal 1082f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1083f4c4dcf4SKowalski, Kamil * 1084f4c4dcf4SKowalski, Kamil * See header file for more information 1085f4c4dcf4SKowalski, Kamil * @endinternal 1086f4c4dcf4SKowalski, Kamil */ 1087b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 10881abe55efSEd Tanous { 1089fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::serviceShuttingDown, {}); 1090b5c07418SJames Feist } 1091b5c07418SJames Feist 1092b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1093b5c07418SJames Feist { 1094b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1095b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1096f4c4dcf4SKowalski, Kamil } 1097f4c4dcf4SKowalski, Kamil 1098f4c4dcf4SKowalski, Kamil /** 1099f4c4dcf4SKowalski, Kamil * @internal 1100f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1101f4c4dcf4SKowalski, Kamil * 1102f4c4dcf4SKowalski, Kamil * See header file for more information 1103f4c4dcf4SKowalski, Kamil * @endinternal 1104f4c4dcf4SKowalski, Kamil */ 11051668ce6dSEd Tanous nlohmann::json actionParameterDuplicate(std::string_view arg1, 11061668ce6dSEd Tanous std::string_view arg2) 11071abe55efSEd Tanous { 1108fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterDuplicate, 11091668ce6dSEd Tanous std::to_array({arg1, arg2})); 1110b5c07418SJames Feist } 1111b5c07418SJames Feist 11121668ce6dSEd Tanous void actionParameterDuplicate(crow::Response& res, std::string_view arg1, 11131668ce6dSEd Tanous std::string_view arg2) 1114b5c07418SJames Feist { 1115b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1116b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1117f4c4dcf4SKowalski, Kamil } 1118f4c4dcf4SKowalski, Kamil 1119f4c4dcf4SKowalski, Kamil /** 1120f4c4dcf4SKowalski, Kamil * @internal 1121f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1122f4c4dcf4SKowalski, Kamil * 1123f4c4dcf4SKowalski, Kamil * See header file for more information 1124f4c4dcf4SKowalski, Kamil * @endinternal 1125f4c4dcf4SKowalski, Kamil */ 11261668ce6dSEd Tanous nlohmann::json actionParameterNotSupported(std::string_view arg1, 11271668ce6dSEd Tanous std::string_view arg2) 11281abe55efSEd Tanous { 1129fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionParameterNotSupported, 11301668ce6dSEd Tanous std::to_array({arg1, arg2})); 1131b5c07418SJames Feist } 1132b5c07418SJames Feist 11331668ce6dSEd Tanous void actionParameterNotSupported(crow::Response& res, std::string_view arg1, 11341668ce6dSEd Tanous std::string_view arg2) 1135b5c07418SJames Feist { 1136b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1137b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1138b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1139f4c4dcf4SKowalski, Kamil } 1140f4c4dcf4SKowalski, Kamil 1141f4c4dcf4SKowalski, Kamil /** 1142f4c4dcf4SKowalski, Kamil * @internal 1143f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1144f4c4dcf4SKowalski, Kamil * 1145f4c4dcf4SKowalski, Kamil * See header file for more information 1146f4c4dcf4SKowalski, Kamil * @endinternal 1147f4c4dcf4SKowalski, Kamil */ 1148ace85d60SEd Tanous nlohmann::json sourceDoesNotSupportProtocol(const boost::urls::url_view& arg1, 11491668ce6dSEd Tanous std::string_view arg2) 11501abe55efSEd Tanous { 1151b6cd31e1SEd Tanous return getLog( 1152fffb8c1fSEd Tanous redfish::registries::base::Index::sourceDoesNotSupportProtocol, 1153079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer(), arg2})); 1154b5c07418SJames Feist } 1155b5c07418SJames Feist 1156ace85d60SEd Tanous void sourceDoesNotSupportProtocol(crow::Response& res, 1157ace85d60SEd Tanous const boost::urls::url_view& arg1, 11581668ce6dSEd Tanous std::string_view arg2) 1159b5c07418SJames Feist { 1160b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1161b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1162b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1163f4c4dcf4SKowalski, Kamil } 1164f4c4dcf4SKowalski, Kamil 1165f4c4dcf4SKowalski, Kamil /** 1166f4c4dcf4SKowalski, Kamil * @internal 1167b4ad4c05SShantappa Teekappanavar * @brief Formats StrictAccountTypes message into JSON 1168b4ad4c05SShantappa Teekappanavar * 1169b4ad4c05SShantappa Teekappanavar * See header file for more information 1170b4ad4c05SShantappa Teekappanavar * @endinternal 1171b4ad4c05SShantappa Teekappanavar */ 1172b4ad4c05SShantappa Teekappanavar nlohmann::json strictAccountTypes(std::string_view arg1) 1173b4ad4c05SShantappa Teekappanavar { 1174b4ad4c05SShantappa Teekappanavar return getLog(redfish::registries::base::Index::strictAccountTypes, 1175b4ad4c05SShantappa Teekappanavar std::to_array({arg1})); 1176b4ad4c05SShantappa Teekappanavar } 1177b4ad4c05SShantappa Teekappanavar 1178b4ad4c05SShantappa Teekappanavar void strictAccountTypes(crow::Response& res, std::string_view arg1) 1179b4ad4c05SShantappa Teekappanavar { 1180b4ad4c05SShantappa Teekappanavar res.result(boost::beast::http::status::bad_request); 1181b4ad4c05SShantappa Teekappanavar addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); 1182b4ad4c05SShantappa Teekappanavar } 1183b4ad4c05SShantappa Teekappanavar 1184b4ad4c05SShantappa Teekappanavar /** 1185b4ad4c05SShantappa Teekappanavar * @internal 1186f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1187f4c4dcf4SKowalski, Kamil * 1188f4c4dcf4SKowalski, Kamil * See header file for more information 1189f4c4dcf4SKowalski, Kamil * @endinternal 1190f4c4dcf4SKowalski, Kamil */ 1191b5c07418SJames Feist nlohmann::json accountRemoved(void) 11921abe55efSEd Tanous { 1193fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountRemoved, {}); 1194b5c07418SJames Feist } 1195b5c07418SJames Feist 1196b5c07418SJames Feist void accountRemoved(crow::Response& res) 1197b5c07418SJames Feist { 1198b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1199b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1200f4c4dcf4SKowalski, Kamil } 1201f4c4dcf4SKowalski, Kamil 1202f4c4dcf4SKowalski, Kamil /** 1203f4c4dcf4SKowalski, Kamil * @internal 1204f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1205f4c4dcf4SKowalski, Kamil * 1206f4c4dcf4SKowalski, Kamil * See header file for more information 1207f4c4dcf4SKowalski, Kamil * @endinternal 1208f4c4dcf4SKowalski, Kamil */ 1209ace85d60SEd Tanous nlohmann::json accessDenied(const boost::urls::url_view& arg1) 12101abe55efSEd Tanous { 1211fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accessDenied, 1212079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1213b5c07418SJames Feist } 1214b5c07418SJames Feist 1215ace85d60SEd Tanous void accessDenied(crow::Response& res, const boost::urls::url_view& arg1) 1216b5c07418SJames Feist { 1217b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1218b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1219f4c4dcf4SKowalski, Kamil } 1220f4c4dcf4SKowalski, Kamil 1221f4c4dcf4SKowalski, Kamil /** 1222f4c4dcf4SKowalski, Kamil * @internal 1223f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1224f4c4dcf4SKowalski, Kamil * 1225f4c4dcf4SKowalski, Kamil * See header file for more information 1226f4c4dcf4SKowalski, Kamil * @endinternal 1227f4c4dcf4SKowalski, Kamil */ 1228b5c07418SJames Feist nlohmann::json queryNotSupported(void) 12291abe55efSEd Tanous { 1230fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupported, {}); 1231b5c07418SJames Feist } 1232b5c07418SJames Feist 1233b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1234b5c07418SJames Feist { 1235b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1236b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1237f4c4dcf4SKowalski, Kamil } 1238f4c4dcf4SKowalski, Kamil 1239f4c4dcf4SKowalski, Kamil /** 1240f4c4dcf4SKowalski, Kamil * @internal 1241f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1242f4c4dcf4SKowalski, Kamil * 1243f4c4dcf4SKowalski, Kamil * See header file for more information 1244f4c4dcf4SKowalski, Kamil * @endinternal 1245f4c4dcf4SKowalski, Kamil */ 1246b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 12471abe55efSEd Tanous { 1248b6cd31e1SEd Tanous return getLog( 1249fffb8c1fSEd Tanous redfish::registries::base::Index::createLimitReachedForResource, {}); 1250b5c07418SJames Feist } 1251b5c07418SJames Feist 1252b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1253b5c07418SJames Feist { 1254b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1255b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1256f4c4dcf4SKowalski, Kamil } 1257f4c4dcf4SKowalski, Kamil 1258f4c4dcf4SKowalski, Kamil /** 1259f4c4dcf4SKowalski, Kamil * @internal 1260f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1261f4c4dcf4SKowalski, Kamil * 1262f4c4dcf4SKowalski, Kamil * See header file for more information 1263f4c4dcf4SKowalski, Kamil * @endinternal 1264f4c4dcf4SKowalski, Kamil */ 1265b5c07418SJames Feist nlohmann::json generalError(void) 12661abe55efSEd Tanous { 1267fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::generalError, {}); 1268b5c07418SJames Feist } 1269b5c07418SJames Feist 1270b5c07418SJames Feist void generalError(crow::Response& res) 1271b5c07418SJames Feist { 1272b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1273b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1274f4c4dcf4SKowalski, Kamil } 1275f4c4dcf4SKowalski, Kamil 1276f4c4dcf4SKowalski, Kamil /** 1277f4c4dcf4SKowalski, Kamil * @internal 1278f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1279f4c4dcf4SKowalski, Kamil * 1280f4c4dcf4SKowalski, Kamil * See header file for more information 1281f4c4dcf4SKowalski, Kamil * @endinternal 1282f4c4dcf4SKowalski, Kamil */ 1283b5c07418SJames Feist nlohmann::json success(void) 12841abe55efSEd Tanous { 1285fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::success, {}); 1286b5c07418SJames Feist } 1287b5c07418SJames Feist 1288b5c07418SJames Feist void success(crow::Response& res) 1289b5c07418SJames Feist { 1290b5c07418SJames Feist // don't set res.result here because success is the default and any 1291b5c07418SJames Feist // error should overwrite the default 1292b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1293f12894f8SJason M. Bills } 1294f12894f8SJason M. Bills 1295f12894f8SJason M. Bills /** 1296f12894f8SJason M. Bills * @internal 1297f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1298f4c4dcf4SKowalski, Kamil * 1299f4c4dcf4SKowalski, Kamil * See header file for more information 1300f4c4dcf4SKowalski, Kamil * @endinternal 1301f4c4dcf4SKowalski, Kamil */ 1302b5c07418SJames Feist nlohmann::json created(void) 13031abe55efSEd Tanous { 1304fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::created, {}); 1305b5c07418SJames Feist } 1306b5c07418SJames Feist 1307b5c07418SJames Feist void created(crow::Response& res) 1308b5c07418SJames Feist { 1309b5c07418SJames Feist res.result(boost::beast::http::status::created); 1310b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1311f4c4dcf4SKowalski, Kamil } 1312f4c4dcf4SKowalski, Kamil 1313f4c4dcf4SKowalski, Kamil /** 1314f4c4dcf4SKowalski, Kamil * @internal 1315cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1316cc9139ecSJason M. Bills * 1317cc9139ecSJason M. Bills * See header file for more information 1318cc9139ecSJason M. Bills * @endinternal 1319cc9139ecSJason M. Bills */ 1320b5c07418SJames Feist nlohmann::json noOperation(void) 1321cc9139ecSJason M. Bills { 1322fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noOperation, {}); 1323b5c07418SJames Feist } 1324b5c07418SJames Feist 1325b5c07418SJames Feist void noOperation(crow::Response& res) 1326b5c07418SJames Feist { 1327b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1328b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1329cc9139ecSJason M. Bills } 1330cc9139ecSJason M. Bills 1331cc9139ecSJason M. Bills /** 1332cc9139ecSJason M. Bills * @internal 1333b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1334b5c07418SJames Feist * property 1335f12894f8SJason M. Bills * 1336f12894f8SJason M. Bills * See header file for more information 1337f12894f8SJason M. Bills * @endinternal 1338f12894f8SJason M. Bills */ 13391668ce6dSEd Tanous nlohmann::json propertyUnknown(std::string_view arg1) 1340b5c07418SJames Feist { 1341fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyUnknown, 13421668ce6dSEd Tanous std::to_array({arg1})); 1343b5c07418SJames Feist } 1344b5c07418SJames Feist 13451668ce6dSEd Tanous void propertyUnknown(crow::Response& res, std::string_view arg1) 1346f12894f8SJason M. Bills { 1347f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 13487b1dd2f9SEd Tanous addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1)); 1349f4c4dcf4SKowalski, Kamil } 1350f4c4dcf4SKowalski, Kamil 1351f4c4dcf4SKowalski, Kamil /** 1352f4c4dcf4SKowalski, Kamil * @internal 1353f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1354f4c4dcf4SKowalski, Kamil * 1355f4c4dcf4SKowalski, Kamil * See header file for more information 1356f4c4dcf4SKowalski, Kamil * @endinternal 1357f4c4dcf4SKowalski, Kamil */ 1358b5c07418SJames Feist nlohmann::json noValidSession(void) 13591abe55efSEd Tanous { 1360fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::noValidSession, {}); 1361b5c07418SJames Feist } 1362b5c07418SJames Feist 1363b5c07418SJames Feist void noValidSession(crow::Response& res) 1364b5c07418SJames Feist { 1365b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1366b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1367f4c4dcf4SKowalski, Kamil } 1368f4c4dcf4SKowalski, Kamil 1369f4c4dcf4SKowalski, Kamil /** 1370f4c4dcf4SKowalski, Kamil * @internal 1371f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1372f4c4dcf4SKowalski, Kamil * 1373f4c4dcf4SKowalski, Kamil * See header file for more information 1374f4c4dcf4SKowalski, Kamil * @endinternal 1375f4c4dcf4SKowalski, Kamil */ 1376ace85d60SEd Tanous nlohmann::json invalidObject(const boost::urls::url_view& arg1) 13771abe55efSEd Tanous { 1378fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidObject, 1379079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1380b5c07418SJames Feist } 1381b5c07418SJames Feist 1382ace85d60SEd Tanous void invalidObject(crow::Response& res, const boost::urls::url_view& arg1) 1383b5c07418SJames Feist { 1384b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1385b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1386f4c4dcf4SKowalski, Kamil } 1387f4c4dcf4SKowalski, Kamil 1388f4c4dcf4SKowalski, Kamil /** 1389f4c4dcf4SKowalski, Kamil * @internal 1390f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1391f4c4dcf4SKowalski, Kamil * 1392f4c4dcf4SKowalski, Kamil * See header file for more information 1393f4c4dcf4SKowalski, Kamil * @endinternal 1394f4c4dcf4SKowalski, Kamil */ 1395b5c07418SJames Feist nlohmann::json resourceInStandby(void) 13961abe55efSEd Tanous { 1397fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceInStandby, {}); 1398b5c07418SJames Feist } 1399b5c07418SJames Feist 1400b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1401b5c07418SJames Feist { 1402b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1403b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1404f4c4dcf4SKowalski, Kamil } 1405f4c4dcf4SKowalski, Kamil 1406f4c4dcf4SKowalski, Kamil /** 1407f4c4dcf4SKowalski, Kamil * @internal 1408f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1409f4c4dcf4SKowalski, Kamil * 1410f4c4dcf4SKowalski, Kamil * See header file for more information 1411f4c4dcf4SKowalski, Kamil * @endinternal 1412f4c4dcf4SKowalski, Kamil */ 14131668ce6dSEd Tanous nlohmann::json actionParameterValueTypeError(std::string_view arg1, 14141668ce6dSEd Tanous std::string_view arg2, 14151668ce6dSEd Tanous std::string_view arg3) 14161abe55efSEd Tanous { 1417b6cd31e1SEd Tanous return getLog( 1418fffb8c1fSEd Tanous redfish::registries::base::Index::actionParameterValueTypeError, 14191668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1420b5c07418SJames Feist } 1421b5c07418SJames Feist 14221668ce6dSEd Tanous void actionParameterValueTypeError(crow::Response& res, std::string_view arg1, 14231668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1424b5c07418SJames Feist { 1425b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1426b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1427b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1428f4c4dcf4SKowalski, Kamil } 1429f4c4dcf4SKowalski, Kamil 1430f4c4dcf4SKowalski, Kamil /** 1431f4c4dcf4SKowalski, Kamil * @internal 1432f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1433f4c4dcf4SKowalski, Kamil * 1434f4c4dcf4SKowalski, Kamil * See header file for more information 1435f4c4dcf4SKowalski, Kamil * @endinternal 1436f4c4dcf4SKowalski, Kamil */ 1437b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 14381abe55efSEd Tanous { 1439fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::sessionLimitExceeded, {}); 1440b5c07418SJames Feist } 1441b5c07418SJames Feist 1442b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1443b5c07418SJames Feist { 1444b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1445b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1446f4c4dcf4SKowalski, Kamil } 1447f4c4dcf4SKowalski, Kamil 1448f4c4dcf4SKowalski, Kamil /** 1449f4c4dcf4SKowalski, Kamil * @internal 1450f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1451f4c4dcf4SKowalski, Kamil * 1452f4c4dcf4SKowalski, Kamil * See header file for more information 1453f4c4dcf4SKowalski, Kamil * @endinternal 1454f4c4dcf4SKowalski, Kamil */ 14551668ce6dSEd Tanous nlohmann::json actionNotSupported(std::string_view arg1) 14561abe55efSEd Tanous { 1457fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::actionNotSupported, 14581668ce6dSEd Tanous std::to_array({arg1})); 1459b5c07418SJames Feist } 1460b5c07418SJames Feist 14611668ce6dSEd Tanous void actionNotSupported(crow::Response& res, std::string_view arg1) 1462b5c07418SJames Feist { 1463b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1464b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1465f4c4dcf4SKowalski, Kamil } 1466f4c4dcf4SKowalski, Kamil 1467f4c4dcf4SKowalski, Kamil /** 1468f4c4dcf4SKowalski, Kamil * @internal 1469f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1470f4c4dcf4SKowalski, Kamil * 1471f4c4dcf4SKowalski, Kamil * See header file for more information 1472f4c4dcf4SKowalski, Kamil * @endinternal 1473f4c4dcf4SKowalski, Kamil */ 14745187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 14751abe55efSEd Tanous { 1476b6cd31e1SEd Tanous std::string arg1Str = std::to_string(arg1); 1477fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::invalidIndex, 14781668ce6dSEd Tanous std::to_array<std::string_view>({arg1Str})); 1479b5c07418SJames Feist } 1480b5c07418SJames Feist 14815187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1482b5c07418SJames Feist { 1483b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1484b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1485f4c4dcf4SKowalski, Kamil } 1486f4c4dcf4SKowalski, Kamil 1487f4c4dcf4SKowalski, Kamil /** 1488f4c4dcf4SKowalski, Kamil * @internal 1489f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1490f4c4dcf4SKowalski, Kamil * 1491f4c4dcf4SKowalski, Kamil * See header file for more information 1492f4c4dcf4SKowalski, Kamil * @endinternal 1493f4c4dcf4SKowalski, Kamil */ 1494b5c07418SJames Feist nlohmann::json emptyJSON(void) 14951abe55efSEd Tanous { 1496fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::emptyJSON, {}); 1497b5c07418SJames Feist } 1498b5c07418SJames Feist 1499b5c07418SJames Feist void emptyJSON(crow::Response& res) 1500b5c07418SJames Feist { 1501b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1502b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1503f4c4dcf4SKowalski, Kamil } 1504f4c4dcf4SKowalski, Kamil 1505f4c4dcf4SKowalski, Kamil /** 1506f4c4dcf4SKowalski, Kamil * @internal 1507f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1508f4c4dcf4SKowalski, Kamil * 1509f4c4dcf4SKowalski, Kamil * See header file for more information 1510f4c4dcf4SKowalski, Kamil * @endinternal 1511f4c4dcf4SKowalski, Kamil */ 1512b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 15131abe55efSEd Tanous { 1514fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryNotSupportedOnResource, 1515b6cd31e1SEd Tanous {}); 1516b5c07418SJames Feist } 1517b5c07418SJames Feist 1518b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1519b5c07418SJames Feist { 15206a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1521b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1522f4c4dcf4SKowalski, Kamil } 1523f4c4dcf4SKowalski, Kamil 1524f4c4dcf4SKowalski, Kamil /** 1525f4c4dcf4SKowalski, Kamil * @internal 1526684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1527684bb4b8SJason M. Bills * 1528684bb4b8SJason M. Bills * See header file for more information 1529684bb4b8SJason M. Bills * @endinternal 1530684bb4b8SJason M. Bills */ 1531684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1532684bb4b8SJason M. Bills { 1533b6cd31e1SEd Tanous return getLog( 1534fffb8c1fSEd Tanous redfish::registries::base::Index::queryNotSupportedOnOperation, {}); 1535684bb4b8SJason M. Bills } 1536684bb4b8SJason M. Bills 1537684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1538684bb4b8SJason M. Bills { 15396a409c12SEd Tanous res.result(boost::beast::http::status::bad_request); 1540684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1541684bb4b8SJason M. Bills } 1542684bb4b8SJason M. Bills 1543684bb4b8SJason M. Bills /** 1544684bb4b8SJason M. Bills * @internal 1545684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1546684bb4b8SJason M. Bills * 1547684bb4b8SJason M. Bills * See header file for more information 1548684bb4b8SJason M. Bills * @endinternal 1549684bb4b8SJason M. Bills */ 1550684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1551684bb4b8SJason M. Bills { 1552fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryCombinationInvalid, 1553fffb8c1fSEd Tanous {}); 1554684bb4b8SJason M. Bills } 1555684bb4b8SJason M. Bills 1556684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1557684bb4b8SJason M. Bills { 1558684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1559684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1560684bb4b8SJason M. Bills } 1561684bb4b8SJason M. Bills 1562684bb4b8SJason M. Bills /** 1563684bb4b8SJason M. Bills * @internal 1564f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1565f4c4dcf4SKowalski, Kamil * 1566f4c4dcf4SKowalski, Kamil * See header file for more information 1567f4c4dcf4SKowalski, Kamil * @endinternal 1568f4c4dcf4SKowalski, Kamil */ 1569b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 15701abe55efSEd Tanous { 1571fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::insufficientPrivilege, {}); 1572b5c07418SJames Feist } 1573b5c07418SJames Feist 1574b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1575b5c07418SJames Feist { 1576b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1577b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1578f4c4dcf4SKowalski, Kamil } 1579f4c4dcf4SKowalski, Kamil 1580f4c4dcf4SKowalski, Kamil /** 1581f4c4dcf4SKowalski, Kamil * @internal 1582f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1583f4c4dcf4SKowalski, Kamil * 1584f4c4dcf4SKowalski, Kamil * See header file for more information 1585f4c4dcf4SKowalski, Kamil * @endinternal 1586f4c4dcf4SKowalski, Kamil */ 15871668ce6dSEd Tanous nlohmann::json propertyValueModified(std::string_view arg1, 15881668ce6dSEd Tanous std::string_view arg2) 1589b5c07418SJames Feist { 1590fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyValueModified, 15911668ce6dSEd Tanous std::to_array({arg1, arg2})); 1592b5c07418SJames Feist } 1593b5c07418SJames Feist 15941668ce6dSEd Tanous void propertyValueModified(crow::Response& res, std::string_view arg1, 15951668ce6dSEd Tanous std::string_view arg2) 15961abe55efSEd Tanous { 1597f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1598b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1599f4c4dcf4SKowalski, Kamil } 1600f4c4dcf4SKowalski, Kamil 1601f4c4dcf4SKowalski, Kamil /** 1602f4c4dcf4SKowalski, Kamil * @internal 1603f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1604f4c4dcf4SKowalski, Kamil * 1605f4c4dcf4SKowalski, Kamil * See header file for more information 1606f4c4dcf4SKowalski, Kamil * @endinternal 1607f4c4dcf4SKowalski, Kamil */ 1608b5c07418SJames Feist nlohmann::json accountNotModified(void) 16091abe55efSEd Tanous { 1610fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountNotModified, {}); 1611b5c07418SJames Feist } 1612b5c07418SJames Feist 1613b5c07418SJames Feist void accountNotModified(crow::Response& res) 1614b5c07418SJames Feist { 1615b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1616b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1617f4c4dcf4SKowalski, Kamil } 1618f4c4dcf4SKowalski, Kamil 1619f4c4dcf4SKowalski, Kamil /** 1620f4c4dcf4SKowalski, Kamil * @internal 1621f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1622f4c4dcf4SKowalski, Kamil * 1623f4c4dcf4SKowalski, Kamil * See header file for more information 1624f4c4dcf4SKowalski, Kamil * @endinternal 1625f4c4dcf4SKowalski, Kamil */ 16261668ce6dSEd Tanous nlohmann::json queryParameterValueFormatError(std::string_view arg1, 16271668ce6dSEd Tanous std::string_view arg2) 16281abe55efSEd Tanous { 1629fffb8c1fSEd Tanous return getLog( 1630fffb8c1fSEd Tanous redfish::registries::base::Index::queryParameterValueFormatError, 16311668ce6dSEd Tanous std::to_array({arg1, arg2})); 1632b5c07418SJames Feist } 1633b5c07418SJames Feist 16341668ce6dSEd Tanous void queryParameterValueFormatError(crow::Response& res, std::string_view arg1, 16351668ce6dSEd Tanous std::string_view arg2) 1636b5c07418SJames Feist { 1637b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1638b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1639b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1640f4c4dcf4SKowalski, Kamil } 1641f4c4dcf4SKowalski, Kamil 1642f4c4dcf4SKowalski, Kamil /** 1643f4c4dcf4SKowalski, Kamil * @internal 1644b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1645b5c07418SJames Feist * property 1646f12894f8SJason M. Bills * 1647f12894f8SJason M. Bills * See header file for more information 1648f12894f8SJason M. Bills * @endinternal 1649f12894f8SJason M. Bills */ 16501668ce6dSEd Tanous nlohmann::json propertyMissing(std::string_view arg1) 1651f12894f8SJason M. Bills { 1652fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::propertyMissing, 16531668ce6dSEd Tanous std::to_array({arg1})); 1654b5c07418SJames Feist } 1655b5c07418SJames Feist 16561668ce6dSEd Tanous void propertyMissing(crow::Response& res, std::string_view arg1) 1657b5c07418SJames Feist { 1658b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1659b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 1660f4c4dcf4SKowalski, Kamil } 1661f4c4dcf4SKowalski, Kamil 1662f4c4dcf4SKowalski, Kamil /** 1663f4c4dcf4SKowalski, Kamil * @internal 1664f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 1665f4c4dcf4SKowalski, Kamil * 1666f4c4dcf4SKowalski, Kamil * See header file for more information 1667f4c4dcf4SKowalski, Kamil * @endinternal 1668f4c4dcf4SKowalski, Kamil */ 16691668ce6dSEd Tanous nlohmann::json resourceExhaustion(std::string_view arg1) 16701abe55efSEd Tanous { 1671fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::resourceExhaustion, 16721668ce6dSEd Tanous std::to_array({arg1})); 1673b5c07418SJames Feist } 1674b5c07418SJames Feist 16751668ce6dSEd Tanous void resourceExhaustion(crow::Response& res, std::string_view arg1) 1676b5c07418SJames Feist { 1677b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1678b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 1679f4c4dcf4SKowalski, Kamil } 1680f4c4dcf4SKowalski, Kamil 1681f4c4dcf4SKowalski, Kamil /** 1682f4c4dcf4SKowalski, Kamil * @internal 1683f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 1684f4c4dcf4SKowalski, Kamil * 1685f4c4dcf4SKowalski, Kamil * See header file for more information 1686f4c4dcf4SKowalski, Kamil * @endinternal 1687f4c4dcf4SKowalski, Kamil */ 1688b5c07418SJames Feist nlohmann::json accountModified(void) 16891abe55efSEd Tanous { 1690fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::accountModified, {}); 1691b5c07418SJames Feist } 1692b5c07418SJames Feist 1693b5c07418SJames Feist void accountModified(crow::Response& res) 1694b5c07418SJames Feist { 1695b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1696b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 1697f4c4dcf4SKowalski, Kamil } 1698f4c4dcf4SKowalski, Kamil 1699f4c4dcf4SKowalski, Kamil /** 1700f4c4dcf4SKowalski, Kamil * @internal 1701f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 1702f4c4dcf4SKowalski, Kamil * 1703f4c4dcf4SKowalski, Kamil * See header file for more information 1704f4c4dcf4SKowalski, Kamil * @endinternal 1705f4c4dcf4SKowalski, Kamil */ 17061668ce6dSEd Tanous nlohmann::json queryParameterOutOfRange(std::string_view arg1, 17071668ce6dSEd Tanous std::string_view arg2, 17081668ce6dSEd Tanous std::string_view arg3) 17091abe55efSEd Tanous { 1710fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::queryParameterOutOfRange, 17111668ce6dSEd Tanous std::to_array({arg1, arg2, arg3})); 1712b5c07418SJames Feist } 1713b5c07418SJames Feist 17141668ce6dSEd Tanous void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, 17151668ce6dSEd Tanous std::string_view arg2, std::string_view arg3) 1716b5c07418SJames Feist { 1717b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1718b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1719b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 1720f4c4dcf4SKowalski, Kamil } 1721f4c4dcf4SKowalski, Kamil 1722b6cd31e1SEd Tanous nlohmann::json passwordChangeRequired(const boost::urls::url_view& arg1) 1723b6cd31e1SEd Tanous { 1724fffb8c1fSEd Tanous return getLog(redfish::registries::base::Index::passwordChangeRequired, 1725079360aeSEd Tanous std::to_array<std::string_view>({arg1.buffer()})); 1726b6cd31e1SEd Tanous } 1727b6cd31e1SEd Tanous 17283bf4e632SJoseph Reynolds /** 17293bf4e632SJoseph Reynolds * @internal 17303bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 17313bf4e632SJoseph Reynolds * 17323bf4e632SJoseph Reynolds * See header file for more information 17333bf4e632SJoseph Reynolds * @endinternal 17343bf4e632SJoseph Reynolds */ 1735ace85d60SEd Tanous void passwordChangeRequired(crow::Response& res, 1736ace85d60SEd Tanous const boost::urls::url_view& arg1) 17373bf4e632SJoseph Reynolds { 1738b6cd31e1SEd Tanous messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); 17393bf4e632SJoseph Reynolds } 17403bf4e632SJoseph Reynolds 17414cde5d90SJames Feist /** 17424cde5d90SJames Feist * @internal 1743ae688313SNan Zhou * @brief Formats InsufficientStorage message into JSON 1744ae688313SNan Zhou * 1745ae688313SNan Zhou * See header file for more information 1746ae688313SNan Zhou * @endinternal 1747ae688313SNan Zhou */ 1748ae688313SNan Zhou nlohmann::json insufficientStorage() 1749ae688313SNan Zhou { 1750ae688313SNan Zhou return getLog(redfish::registries::base::Index::insufficientStorage, {}); 1751ae688313SNan Zhou } 1752ae688313SNan Zhou 1753ae688313SNan Zhou void insufficientStorage(crow::Response& res) 1754ae688313SNan Zhou { 1755ae688313SNan Zhou res.result(boost::beast::http::status::insufficient_storage); 1756ae688313SNan Zhou addMessageToErrorJson(res.jsonValue, insufficientStorage()); 1757ae688313SNan Zhou } 1758ae688313SNan Zhou 1759ae688313SNan Zhou /** 1760ae688313SNan Zhou * @internal 176144c70412SEd Tanous * @brief Formats OperationNotAllowed message into JSON 176244c70412SEd Tanous * 176344c70412SEd Tanous * See header file for more information 176444c70412SEd Tanous * @endinternal 176544c70412SEd Tanous */ 176644c70412SEd Tanous nlohmann::json operationNotAllowed() 176744c70412SEd Tanous { 176844c70412SEd Tanous return getLog(redfish::registries::base::Index::operationNotAllowed, {}); 176944c70412SEd Tanous } 177044c70412SEd Tanous 177144c70412SEd Tanous void operationNotAllowed(crow::Response& res) 177244c70412SEd Tanous { 177344c70412SEd Tanous res.result(boost::beast::http::status::method_not_allowed); 177444c70412SEd Tanous addMessageToErrorJson(res.jsonValue, operationNotAllowed()); 177544c70412SEd Tanous } 177644c70412SEd Tanous 177744c70412SEd Tanous void invalidUpload(crow::Response& res, std::string_view arg1, 177844c70412SEd Tanous std::string_view arg2) 177944c70412SEd Tanous { 178044c70412SEd Tanous res.result(boost::beast::http::status::bad_request); 178144c70412SEd Tanous addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 178244c70412SEd Tanous } 178344c70412SEd Tanous 178444c70412SEd Tanous /** 178544c70412SEd Tanous * @internal 17864cde5d90SJames Feist * @brief Formats Invalid File message into JSON 17874cde5d90SJames Feist * 17884cde5d90SJames Feist * See header file for more information 17894cde5d90SJames Feist * @endinternal 17904cde5d90SJames Feist */ 17911668ce6dSEd Tanous nlohmann::json invalidUpload(std::string_view arg1, std::string_view arg2) 17924cde5d90SJames Feist { 17931668ce6dSEd Tanous std::string msg = "Invalid file uploaded to "; 17941668ce6dSEd Tanous msg += arg1; 17951668ce6dSEd Tanous msg += ": "; 17961668ce6dSEd Tanous msg += arg2; 17971668ce6dSEd Tanous msg += "."; 1798613dabeaSEd Tanous 1799613dabeaSEd Tanous nlohmann::json::object_t ret; 1800613dabeaSEd Tanous ret["@odata.type"] = "/redfish/v1/$metadata#Message.v1_1_1.Message"; 1801613dabeaSEd Tanous ret["MessageId"] = "OpenBMC.0.2.InvalidUpload"; 1802613dabeaSEd Tanous ret["Message"] = std::move(msg); 1803613dabeaSEd Tanous nlohmann::json::array_t args; 1804613dabeaSEd Tanous args.push_back(arg1); 1805613dabeaSEd Tanous args.push_back(arg2); 1806613dabeaSEd Tanous ret["MessageArgs"] = std::move(args); 1807613dabeaSEd Tanous ret["MessageSeverity"] = "Warning"; 1808613dabeaSEd Tanous ret["Resolution"] = "None."; 1809613dabeaSEd Tanous return ret; 18104cde5d90SJames Feist } 1811ae688313SNan Zhou 1812f4c4dcf4SKowalski, Kamil } // namespace messages 1813f4c4dcf4SKowalski, Kamil 1814d425c6f6SEd Tanous } // namespace redfish 1815