1f4c4dcf4SKowalski, Kamil /* 2f4c4dcf4SKowalski, Kamil // Copyright (c) 2018 Intel Corporation 3f4c4dcf4SKowalski, Kamil // 4f4c4dcf4SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License"); 5f4c4dcf4SKowalski, Kamil // you may not use this file except in compliance with the License. 6f4c4dcf4SKowalski, Kamil // You may obtain a copy of the License at 7f4c4dcf4SKowalski, Kamil // 8f4c4dcf4SKowalski, Kamil // http://www.apache.org/licenses/LICENSE-2.0 9f4c4dcf4SKowalski, Kamil // 10f4c4dcf4SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software 11f4c4dcf4SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS, 12f4c4dcf4SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f4c4dcf4SKowalski, Kamil // See the License for the specific language governing permissions and 14f4c4dcf4SKowalski, Kamil // limitations under the License. 15f4c4dcf4SKowalski, Kamil */ 169ea15c35SEd Tanous #include "http_response.hpp" 179ea15c35SEd Tanous 189ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 191abe55efSEd Tanous #include <error_messages.hpp> 2004e438cbSEd Tanous #include <logging.hpp> 219ea15c35SEd Tanous #include <nlohmann/json.hpp> 22f4c4dcf4SKowalski, Kamil 231abe55efSEd Tanous namespace redfish 241abe55efSEd Tanous { 251abe55efSEd Tanous 261abe55efSEd Tanous namespace messages 271abe55efSEd Tanous { 28f4c4dcf4SKowalski, Kamil 29f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 301abe55efSEd Tanous const nlohmann::json& message) 311abe55efSEd Tanous { 32f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 33f4c4dcf4SKowalski, Kamil 341abe55efSEd Tanous // If this is the first error message, fill in the information from the 351abe55efSEd Tanous // first error message to the top level struct 361abe55efSEd Tanous if (!error.is_object()) 371abe55efSEd Tanous { 38c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 39c074230bSJason M. Bills if (messageIdIterator == message.end()) 401abe55efSEd Tanous { 411abe55efSEd Tanous BMCWEB_LOG_CRITICAL 421abe55efSEd Tanous << "Attempt to add error message without MessageId"; 43f4c4dcf4SKowalski, Kamil return; 44f4c4dcf4SKowalski, Kamil } 45f4c4dcf4SKowalski, Kamil 46c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 47c074230bSJason M. Bills if (messageFieldIterator == message.end()) 481abe55efSEd Tanous { 491abe55efSEd Tanous BMCWEB_LOG_CRITICAL 501abe55efSEd Tanous << "Attempt to add error message without Message"; 51f4c4dcf4SKowalski, Kamil return; 52f4c4dcf4SKowalski, Kamil } 53c21055aaSEd Tanous error = {{"code", *messageIdIterator}, 54c21055aaSEd Tanous {"message", *messageFieldIterator}}; 551abe55efSEd Tanous } 561abe55efSEd Tanous else 571abe55efSEd Tanous { 58f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 5955c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 60cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 61cc9139ecSJason M. Bills "information on how to resolve the error."; 62f4c4dcf4SKowalski, Kamil } 63f4c4dcf4SKowalski, Kamil 64f4c4dcf4SKowalski, Kamil // This check could technically be done in in the default construction 65f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 66f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 67c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 68c074230bSJason M. Bills if (!extendedInfo.is_array()) 691abe55efSEd Tanous { 70c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 71f4c4dcf4SKowalski, Kamil } 72f4c4dcf4SKowalski, Kamil 73c074230bSJason M. Bills extendedInfo.push_back(message); 74f4c4dcf4SKowalski, Kamil } 75f4c4dcf4SKowalski, Kamil 76f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 77f12894f8SJason M. Bills const nlohmann::json& message) 781abe55efSEd Tanous { 791abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 801abe55efSEd Tanous { 81f4c4dcf4SKowalski, Kamil // Force object to be an array 8255c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 83f4c4dcf4SKowalski, Kamil } 84f4c4dcf4SKowalski, Kamil 8555c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 86f4c4dcf4SKowalski, Kamil } 87f4c4dcf4SKowalski, Kamil 88f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 89f12894f8SJason M. Bills const nlohmann::json& message, 901abe55efSEd Tanous const std::string& fieldPath) 911abe55efSEd Tanous { 92a08b46ccSJason M. Bills std::string extendedInfo(fieldPath + messages::messageAnnotation); 93f4c4dcf4SKowalski, Kamil 941abe55efSEd Tanous if (!target[extendedInfo].is_array()) 951abe55efSEd Tanous { 96f4c4dcf4SKowalski, Kamil // Force object to be an array 97f4c4dcf4SKowalski, Kamil target[extendedInfo] = nlohmann::json::array(); 98f4c4dcf4SKowalski, Kamil } 99f4c4dcf4SKowalski, Kamil 100f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 101f4c4dcf4SKowalski, Kamil target[extendedInfo].push_back(message); 102f4c4dcf4SKowalski, Kamil } 103f4c4dcf4SKowalski, Kamil 104f4c4dcf4SKowalski, Kamil /** 105f4c4dcf4SKowalski, Kamil * @internal 106f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 107f4c4dcf4SKowalski, Kamil * 108f4c4dcf4SKowalski, Kamil * See header file for more information 109f4c4dcf4SKowalski, Kamil * @endinternal 110f4c4dcf4SKowalski, Kamil */ 111b5c07418SJames Feist nlohmann::json resourceInUse(void) 1121abe55efSEd Tanous { 113b5c07418SJames Feist return nlohmann::json{ 1143e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 115684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceInUse"}, 11666ac2b8cSJason M. Bills {"Message", "The change to the requested resource failed because " 11766ac2b8cSJason M. Bills "the resource is in use or in transition."}, 11885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 119684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 12066ac2b8cSJason M. Bills {"Resolution", "Remove the condition and resubmit the request if " 121b5c07418SJames Feist "the operation failed."}}; 122b5c07418SJames Feist } 123b5c07418SJames Feist 124b5c07418SJames Feist void resourceInUse(crow::Response& res) 125b5c07418SJames Feist { 126b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 127b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 128f4c4dcf4SKowalski, Kamil } 129f4c4dcf4SKowalski, Kamil 130f4c4dcf4SKowalski, Kamil /** 131f4c4dcf4SKowalski, Kamil * @internal 132f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 133f4c4dcf4SKowalski, Kamil * 134f4c4dcf4SKowalski, Kamil * See header file for more information 135f4c4dcf4SKowalski, Kamil * @endinternal 136f4c4dcf4SKowalski, Kamil */ 137b5c07418SJames Feist nlohmann::json malformedJSON(void) 1381abe55efSEd Tanous { 139b5c07418SJames Feist return nlohmann::json{ 1403e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 141684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.MalformedJSON"}, 14266ac2b8cSJason M. Bills {"Message", "The request body submitted was malformed JSON and " 14366ac2b8cSJason M. Bills "could not be parsed by the receiving service."}, 14485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 145684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1461abe55efSEd Tanous {"Resolution", "Ensure that the request body is valid JSON and " 147b5c07418SJames Feist "resubmit the request."}}; 148b5c07418SJames Feist } 149b5c07418SJames Feist 150b5c07418SJames Feist void malformedJSON(crow::Response& res) 151b5c07418SJames Feist { 152b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 153b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 154f4c4dcf4SKowalski, Kamil } 155f4c4dcf4SKowalski, Kamil 156f4c4dcf4SKowalski, Kamil /** 157f4c4dcf4SKowalski, Kamil * @internal 158f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 159f4c4dcf4SKowalski, Kamil * 160f4c4dcf4SKowalski, Kamil * See header file for more information 161f4c4dcf4SKowalski, Kamil * @endinternal 162f4c4dcf4SKowalski, Kamil */ 163b5c07418SJames Feist nlohmann::json resourceMissingAtURI(const std::string& arg1) 1641abe55efSEd Tanous { 165b5c07418SJames Feist return nlohmann::json{ 1663e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 167684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceMissingAtURI"}, 168f4c4dcf4SKowalski, Kamil {"Message", "The resource at the URI " + arg1 + " was not found."}, 16985659adfSJason M. Bills {"MessageArgs", {arg1}}, 170684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 17166ac2b8cSJason M. Bills {"Resolution", "Place a valid resource at the URI or correct the " 172b5c07418SJames Feist "URI and resubmit the request."}}; 173b5c07418SJames Feist } 174b5c07418SJames Feist 175b5c07418SJames Feist void resourceMissingAtURI(crow::Response& res, const std::string& arg1) 176b5c07418SJames Feist { 177b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 178b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 179f4c4dcf4SKowalski, Kamil } 180f4c4dcf4SKowalski, Kamil 181f4c4dcf4SKowalski, Kamil /** 182f4c4dcf4SKowalski, Kamil * @internal 183f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 184f4c4dcf4SKowalski, Kamil * 185f4c4dcf4SKowalski, Kamil * See header file for more information 186f4c4dcf4SKowalski, Kamil * @endinternal 187f4c4dcf4SKowalski, Kamil */ 188b5c07418SJames Feist nlohmann::json actionParameterValueFormatError(const std::string& arg1, 189f4c4dcf4SKowalski, Kamil const std::string& arg2, 1901abe55efSEd Tanous const std::string& arg3) 1911abe55efSEd Tanous { 192b5c07418SJames Feist return nlohmann::json{ 1933e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 194684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterValueFormatError"}, 195f4c4dcf4SKowalski, Kamil {"Message", 1961abe55efSEd Tanous "The value " + arg1 + " for the parameter " + arg2 + 1971abe55efSEd Tanous " in the action " + arg3 + 1981abe55efSEd Tanous " is of a different format than the parameter can accept."}, 19985659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 200684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 20166ac2b8cSJason M. Bills {"Resolution", 20266ac2b8cSJason M. Bills "Correct the value for the parameter in the request body and " 203b5c07418SJames Feist "resubmit the request if the operation failed."}}; 204b5c07418SJames Feist } 205b5c07418SJames Feist 206b5c07418SJames Feist void actionParameterValueFormatError(crow::Response& res, 207b5c07418SJames Feist const std::string& arg1, 208b5c07418SJames Feist const std::string& arg2, 209b5c07418SJames Feist const std::string& arg3) 210b5c07418SJames Feist { 211b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 212b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 213b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 214f4c4dcf4SKowalski, Kamil } 215f4c4dcf4SKowalski, Kamil 216f4c4dcf4SKowalski, Kamil /** 217f4c4dcf4SKowalski, Kamil * @internal 218f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 219f4c4dcf4SKowalski, Kamil * 220f4c4dcf4SKowalski, Kamil * See header file for more information 221f4c4dcf4SKowalski, Kamil * @endinternal 222f4c4dcf4SKowalski, Kamil */ 223b5c07418SJames Feist nlohmann::json internalError(void) 2241abe55efSEd Tanous { 225b5c07418SJames Feist return nlohmann::json{ 2263e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 227684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InternalError"}, 228f12894f8SJason M. Bills {"Message", "The request failed due to an internal service error. " 22966ac2b8cSJason M. Bills "The service is still operational."}, 23085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 231684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 2321abe55efSEd Tanous {"Resolution", "Resubmit the request. If the problem persists, " 233b5c07418SJames Feist "consider resetting the service."}}; 234b5c07418SJames Feist } 235b5c07418SJames Feist 236df5415fcSEd Tanous void internalError(crow::Response& res, const bmcweb::source_location location) 237b5c07418SJames Feist { 238df5415fcSEd Tanous BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "(" 239df5415fcSEd Tanous << location.line() << ":" << location.column() << ") `" 240df5415fcSEd Tanous << location.function_name() << "`: "; 241b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 242b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 243f12894f8SJason M. Bills } 244f12894f8SJason M. Bills 245f12894f8SJason M. Bills /** 246f12894f8SJason M. Bills * @internal 247f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 248f4c4dcf4SKowalski, Kamil * 249f4c4dcf4SKowalski, Kamil * See header file for more information 250f4c4dcf4SKowalski, Kamil * @endinternal 251f4c4dcf4SKowalski, Kamil */ 252b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2531abe55efSEd Tanous { 254b5c07418SJames Feist return nlohmann::json{ 2553e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 256684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.UnrecognizedRequestBody"}, 257f12894f8SJason M. Bills {"Message", "The service detected a malformed request body that it " 25866ac2b8cSJason M. Bills "was unable to interpret."}, 25985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 260684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 261f12894f8SJason M. Bills {"Resolution", "Correct the request body and resubmit the request " 262b5c07418SJames Feist "if it failed."}}; 263b5c07418SJames Feist } 264b5c07418SJames Feist 265b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 266b5c07418SJames Feist { 267b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 268b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 269f4c4dcf4SKowalski, Kamil } 270f4c4dcf4SKowalski, Kamil 271f4c4dcf4SKowalski, Kamil /** 272f4c4dcf4SKowalski, Kamil * @internal 273f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 274f4c4dcf4SKowalski, Kamil * 275f4c4dcf4SKowalski, Kamil * See header file for more information 276f4c4dcf4SKowalski, Kamil * @endinternal 277f4c4dcf4SKowalski, Kamil */ 278b5c07418SJames Feist nlohmann::json resourceAtUriUnauthorized(const std::string& arg1, 2791abe55efSEd Tanous const std::string& arg2) 2801abe55efSEd Tanous { 281b5c07418SJames Feist return nlohmann::json{ 2823e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 283684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAtUriUnauthorized"}, 284f4c4dcf4SKowalski, Kamil {"Message", "While accessing the resource at " + arg1 + 2851abe55efSEd Tanous ", the service received an authorization error " + 2861abe55efSEd Tanous arg2 + "."}, 28785659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 288684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 289f12894f8SJason M. Bills {"Resolution", "Ensure that the appropriate access is provided for " 290b5c07418SJames Feist "the service in order for it to access the URI."}}; 291b5c07418SJames Feist } 292b5c07418SJames Feist 293b5c07418SJames Feist void resourceAtUriUnauthorized(crow::Response& res, const std::string& arg1, 294b5c07418SJames Feist const std::string& arg2) 295b5c07418SJames Feist { 296b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 297b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 298f4c4dcf4SKowalski, Kamil } 299f4c4dcf4SKowalski, Kamil 300f4c4dcf4SKowalski, Kamil /** 301f4c4dcf4SKowalski, Kamil * @internal 302f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 303f4c4dcf4SKowalski, Kamil * 304f4c4dcf4SKowalski, Kamil * See header file for more information 305f4c4dcf4SKowalski, Kamil * @endinternal 306f4c4dcf4SKowalski, Kamil */ 307b5c07418SJames Feist nlohmann::json actionParameterUnknown(const std::string& arg1, 308b5c07418SJames Feist const std::string& arg2) 309b5c07418SJames Feist { 310b5c07418SJames Feist return nlohmann::json{ 3113e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 312684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterUnknown"}, 313b5c07418SJames Feist {"Message", "The action " + arg1 + 314b5c07418SJames Feist " was submitted with the invalid parameter " + arg2 + 315b5c07418SJames Feist "."}, 316b5c07418SJames Feist {"MessageArgs", {arg1, arg2}}, 317684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 318b5c07418SJames Feist {"Resolution", "Correct the invalid parameter and resubmit the " 319b5c07418SJames Feist "request if the operation failed."}}; 320b5c07418SJames Feist } 321b5c07418SJames Feist 322f12894f8SJason M. Bills void actionParameterUnknown(crow::Response& res, const std::string& arg1, 3231abe55efSEd Tanous const std::string& arg2) 3241abe55efSEd Tanous { 325f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 326b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 327f4c4dcf4SKowalski, Kamil } 328f4c4dcf4SKowalski, Kamil 329f4c4dcf4SKowalski, Kamil /** 330f4c4dcf4SKowalski, Kamil * @internal 331f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 332f4c4dcf4SKowalski, Kamil * 333f4c4dcf4SKowalski, Kamil * See header file for more information 334f4c4dcf4SKowalski, Kamil * @endinternal 335f4c4dcf4SKowalski, Kamil */ 336b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3371abe55efSEd Tanous { 338b5c07418SJames Feist return nlohmann::json{ 3393e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 340684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceCannotBeDeleted"}, 341f12894f8SJason M. Bills {"Message", "The delete request failed because the resource " 34266ac2b8cSJason M. Bills "requested cannot be deleted."}, 34385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 344684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 345b5c07418SJames Feist {"Resolution", "Do not attempt to delete a non-deletable resource."}}; 346b5c07418SJames Feist } 347b5c07418SJames Feist 348b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 349b5c07418SJames Feist { 350b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 351b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 352f4c4dcf4SKowalski, Kamil } 353f4c4dcf4SKowalski, Kamil 354f4c4dcf4SKowalski, Kamil /** 355f4c4dcf4SKowalski, Kamil * @internal 356f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 357f4c4dcf4SKowalski, Kamil * 358f4c4dcf4SKowalski, Kamil * See header file for more information 359f4c4dcf4SKowalski, Kamil * @endinternal 360f4c4dcf4SKowalski, Kamil */ 361b5c07418SJames Feist nlohmann::json propertyDuplicate(const std::string& arg1) 3621abe55efSEd Tanous { 363b5c07418SJames Feist return nlohmann::json{ 3643e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 365684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyDuplicate"}, 366b5c07418SJames Feist {"Message", "The property " + arg1 + " was duplicated in the request."}, 36785659adfSJason M. Bills {"MessageArgs", {arg1}}, 368684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 36966ac2b8cSJason M. Bills {"Resolution", 37066ac2b8cSJason M. Bills "Remove the duplicate property from the request body and resubmit " 371b5c07418SJames Feist "the request if the operation failed."}}; 372b5c07418SJames Feist } 373b5c07418SJames Feist 374b5c07418SJames Feist void propertyDuplicate(crow::Response& res, const std::string& arg1) 375b5c07418SJames Feist { 376b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 377b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 378f4c4dcf4SKowalski, Kamil } 379f4c4dcf4SKowalski, Kamil 380f4c4dcf4SKowalski, Kamil /** 381f4c4dcf4SKowalski, Kamil * @internal 382f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 383f4c4dcf4SKowalski, Kamil * 384f4c4dcf4SKowalski, Kamil * See header file for more information 385f4c4dcf4SKowalski, Kamil * @endinternal 386f4c4dcf4SKowalski, Kamil */ 387b5c07418SJames Feist nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1) 3881abe55efSEd Tanous { 389b5c07418SJames Feist return nlohmann::json{ 3903e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 391684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceTemporarilyUnavailable"}, 3921abe55efSEd Tanous {"Message", "The service is temporarily unavailable. Retry in " + 3931abe55efSEd Tanous arg1 + " seconds."}, 39485659adfSJason M. Bills {"MessageArgs", {arg1}}, 395684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 396f12894f8SJason M. Bills {"Resolution", "Wait for the indicated retry duration and retry " 397b5c07418SJames Feist "the operation."}}; 398b5c07418SJames Feist } 399b5c07418SJames Feist 400b5c07418SJames Feist void serviceTemporarilyUnavailable(crow::Response& res, const std::string& arg1) 401b5c07418SJames Feist { 402b5c07418SJames Feist res.addHeader("Retry-After", arg1); 403b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 404b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 405f4c4dcf4SKowalski, Kamil } 406f4c4dcf4SKowalski, Kamil 407f4c4dcf4SKowalski, Kamil /** 408f4c4dcf4SKowalski, Kamil * @internal 409f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 410f4c4dcf4SKowalski, Kamil * 411f4c4dcf4SKowalski, Kamil * See header file for more information 412f4c4dcf4SKowalski, Kamil * @endinternal 413f4c4dcf4SKowalski, Kamil */ 414b5c07418SJames Feist nlohmann::json resourceAlreadyExists(const std::string& arg1, 415b5c07418SJames Feist const std::string& arg2, 416b5c07418SJames Feist const std::string& arg3) 4171abe55efSEd Tanous { 418b5c07418SJames Feist return nlohmann::json{ 4193e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 420684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAlreadyExists"}, 421f4c4dcf4SKowalski, Kamil {"Message", "The requested resource of type " + arg1 + 4221abe55efSEd Tanous " with the property " + arg2 + " with the value " + 4231abe55efSEd Tanous arg3 + " already exists."}, 42485659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 425684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 426f12894f8SJason M. Bills {"Resolution", "Do not repeat the create operation as the resource " 427b5c07418SJames Feist "has already been created."}}; 428b5c07418SJames Feist } 429b5c07418SJames Feist 430b5c07418SJames Feist void resourceAlreadyExists(crow::Response& res, const std::string& arg1, 431b5c07418SJames Feist const std::string& arg2, const std::string& arg3) 432b5c07418SJames Feist { 433b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 434b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 435a08b46ccSJason M. Bills arg2); 436f4c4dcf4SKowalski, Kamil } 437f4c4dcf4SKowalski, Kamil 438f4c4dcf4SKowalski, Kamil /** 439f4c4dcf4SKowalski, Kamil * @internal 440f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 441f4c4dcf4SKowalski, Kamil * 442f4c4dcf4SKowalski, Kamil * See header file for more information 443f4c4dcf4SKowalski, Kamil * @endinternal 444f4c4dcf4SKowalski, Kamil */ 445b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4461abe55efSEd Tanous { 447b5c07418SJames Feist return nlohmann::json{ 4483e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 449684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountForSessionNoLongerExists"}, 4501abe55efSEd Tanous {"Message", "The account for the current session has been removed, " 45166ac2b8cSJason M. Bills "thus the current session has been removed as well."}, 45285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 453684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 454b5c07418SJames Feist {"Resolution", "Attempt to connect with a valid account."}}; 455b5c07418SJames Feist } 456b5c07418SJames Feist 457b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 458b5c07418SJames Feist { 459b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 460b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 461f4c4dcf4SKowalski, Kamil } 462f4c4dcf4SKowalski, Kamil 463f4c4dcf4SKowalski, Kamil /** 464f4c4dcf4SKowalski, Kamil * @internal 465f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 466f4c4dcf4SKowalski, Kamil * 467f4c4dcf4SKowalski, Kamil * See header file for more information 468f4c4dcf4SKowalski, Kamil * @endinternal 469f4c4dcf4SKowalski, Kamil */ 470b5c07418SJames Feist nlohmann::json createFailedMissingReqProperties(const std::string& arg1) 4711abe55efSEd Tanous { 472b5c07418SJames Feist return nlohmann::json{ 4733e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 474684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CreateFailedMissingReqProperties"}, 4751abe55efSEd Tanous {"Message", 476b5c07418SJames Feist "The create operation failed because the required property " + arg1 + 477b5c07418SJames Feist " was missing from the request."}, 47885659adfSJason M. Bills {"MessageArgs", {arg1}}, 479684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 480f4c4dcf4SKowalski, Kamil {"Resolution", 481f12894f8SJason M. Bills "Correct the body to include the required property with a valid " 482b5c07418SJames Feist "value and resubmit the request if the operation failed."}}; 483b5c07418SJames Feist } 484b5c07418SJames Feist 485b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 486b5c07418SJames Feist const std::string& arg1) 487b5c07418SJames Feist { 488b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 489b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 490a08b46ccSJason M. Bills arg1); 491f12894f8SJason M. Bills } 492f12894f8SJason M. Bills 493f12894f8SJason M. Bills /** 494f12894f8SJason M. Bills * @internal 495f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 496f12894f8SJason M. Bills * property 497f12894f8SJason M. Bills * 498f12894f8SJason M. Bills * See header file for more information 499f12894f8SJason M. Bills * @endinternal 500f12894f8SJason M. Bills */ 501b5c07418SJames Feist nlohmann::json propertyValueFormatError(const std::string& arg1, 502a08b46ccSJason M. Bills const std::string& arg2) 503f12894f8SJason M. Bills { 504b5c07418SJames Feist return nlohmann::json{ 5053e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 506684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueFormatError"}, 507f12894f8SJason M. Bills {"Message", 508f12894f8SJason M. Bills "The value " + arg1 + " for the property " + arg2 + 509f12894f8SJason M. Bills " is of a different format than the property can accept."}, 51085659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 511684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 51266ac2b8cSJason M. Bills {"Resolution", 51366ac2b8cSJason M. Bills "Correct the value for the property in the request body and " 514b5c07418SJames Feist "resubmit the request if the operation failed."}}; 515b5c07418SJames Feist } 516b5c07418SJames Feist 517b5c07418SJames Feist void propertyValueFormatError(crow::Response& res, const std::string& arg1, 518b5c07418SJames Feist const std::string& arg2) 519b5c07418SJames Feist { 520b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 521b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 522f12894f8SJason M. Bills } 523f12894f8SJason M. Bills 524f12894f8SJason M. Bills /** 525f12894f8SJason M. Bills * @internal 526f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 527f12894f8SJason M. Bills * property 528f12894f8SJason M. Bills * 529f12894f8SJason M. Bills * See header file for more information 530f12894f8SJason M. Bills * @endinternal 531f12894f8SJason M. Bills */ 532b5c07418SJames Feist nlohmann::json propertyValueNotInList(const std::string& arg1, 533a08b46ccSJason M. Bills const std::string& arg2) 534f12894f8SJason M. Bills { 535b5c07418SJames Feist return nlohmann::json{ 5363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 537684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueNotInList"}, 538f12894f8SJason M. Bills {"Message", "The value " + arg1 + " for the property " + arg2 + 539f12894f8SJason M. Bills " is not in the list of acceptable values."}, 54085659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 541684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 542b5c07418SJames Feist {"Resolution", "Choose a value from the enumeration list that " 543b5c07418SJames Feist "the implementation " 544b5c07418SJames Feist "can support and resubmit the request if the " 545b5c07418SJames Feist "operation failed."}}; 546b5c07418SJames Feist } 547b5c07418SJames Feist 548b5c07418SJames Feist void propertyValueNotInList(crow::Response& res, const std::string& arg1, 549b5c07418SJames Feist const std::string& arg2) 550b5c07418SJames Feist { 551b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 552b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 553f4c4dcf4SKowalski, Kamil } 554f4c4dcf4SKowalski, Kamil 555f4c4dcf4SKowalski, Kamil /** 556f4c4dcf4SKowalski, Kamil * @internal 557f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 558f4c4dcf4SKowalski, Kamil * 559f4c4dcf4SKowalski, Kamil * See header file for more information 560f4c4dcf4SKowalski, Kamil * @endinternal 561f4c4dcf4SKowalski, Kamil */ 562b5c07418SJames Feist nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1) 5631abe55efSEd Tanous { 564b5c07418SJames Feist return nlohmann::json{ 5653e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 566684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAtUriInUnknownFormat"}, 567f4c4dcf4SKowalski, Kamil {"Message", "The resource at " + arg1 + 568f4c4dcf4SKowalski, Kamil " is in a format not recognized by the service."}, 56985659adfSJason M. Bills {"MessageArgs", {arg1}}, 570684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 571f12894f8SJason M. Bills {"Resolution", "Place an image or resource or file that is " 572b5c07418SJames Feist "recognized by the service at the URI."}}; 573b5c07418SJames Feist } 574b5c07418SJames Feist 575b5c07418SJames Feist void resourceAtUriInUnknownFormat(crow::Response& res, const std::string& arg1) 576b5c07418SJames Feist { 577b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 578b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 579f4c4dcf4SKowalski, Kamil } 580f4c4dcf4SKowalski, Kamil 581f4c4dcf4SKowalski, Kamil /** 582f4c4dcf4SKowalski, Kamil * @internal 58381856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 58481856681SAsmitha Karunanithi * 58581856681SAsmitha Karunanithi * See header file for more information 58681856681SAsmitha Karunanithi * @endinternal 58781856681SAsmitha Karunanithi */ 58881856681SAsmitha Karunanithi nlohmann::json serviceDisabled(const std::string& arg1) 58981856681SAsmitha Karunanithi { 59081856681SAsmitha Karunanithi return nlohmann::json{ 59181856681SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 59281856681SAsmitha Karunanithi {"MessageId", "Base.1.11.0.ServiceDisabled"}, 59381856681SAsmitha Karunanithi {"Message", "The operation failed because the service at " + arg1 + 59481856681SAsmitha Karunanithi " is disabled and cannot accept requests."}, 59581856681SAsmitha Karunanithi {"MessageArgs", {arg1}}, 59681856681SAsmitha Karunanithi {"MessageSeverity", "Warning"}, 59781856681SAsmitha Karunanithi {"Resolution", "Enable the service and resubmit the request if the " 59881856681SAsmitha Karunanithi "operation failed."}}; 59981856681SAsmitha Karunanithi } 60081856681SAsmitha Karunanithi 60181856681SAsmitha Karunanithi void serviceDisabled(crow::Response& res, const std::string& arg1) 60281856681SAsmitha Karunanithi { 60381856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 60481856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 60581856681SAsmitha Karunanithi } 60681856681SAsmitha Karunanithi 60781856681SAsmitha Karunanithi /** 60881856681SAsmitha Karunanithi * @internal 609f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 610f4c4dcf4SKowalski, Kamil * 611f4c4dcf4SKowalski, Kamil * See header file for more information 612f4c4dcf4SKowalski, Kamil * @endinternal 613f4c4dcf4SKowalski, Kamil */ 614b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 6151abe55efSEd Tanous { 616b5c07418SJames Feist return nlohmann::json{ 6173e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 618684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceInUnknownState"}, 61966ac2b8cSJason M. Bills {"Message", 62066ac2b8cSJason M. Bills "The operation failed because the service is in an unknown state " 62166ac2b8cSJason M. Bills "and can no longer take incoming requests."}, 62285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 623684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 62466ac2b8cSJason M. Bills {"Resolution", "Restart the service and resubmit the request if " 625b5c07418SJames Feist "the operation failed."}}; 626b5c07418SJames Feist } 627b5c07418SJames Feist 628b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 629b5c07418SJames Feist { 630b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 631b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 632f4c4dcf4SKowalski, Kamil } 633f4c4dcf4SKowalski, Kamil 634f4c4dcf4SKowalski, Kamil /** 635f4c4dcf4SKowalski, Kamil * @internal 636f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 637f4c4dcf4SKowalski, Kamil * 638f4c4dcf4SKowalski, Kamil * See header file for more information 639f4c4dcf4SKowalski, Kamil * @endinternal 640f4c4dcf4SKowalski, Kamil */ 641b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 6421abe55efSEd Tanous { 643b5c07418SJames Feist return nlohmann::json{ 6443e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 645684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.EventSubscriptionLimitExceeded"}, 646f4c4dcf4SKowalski, Kamil {"Message", 647f4c4dcf4SKowalski, Kamil "The event subscription failed due to the number of simultaneous " 648f4c4dcf4SKowalski, Kamil "subscriptions exceeding the limit of the implementation."}, 64985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 650684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 651f4c4dcf4SKowalski, Kamil {"Resolution", 652f12894f8SJason M. Bills "Reduce the number of other subscriptions before trying to " 65366ac2b8cSJason M. Bills "establish the event subscription or increase the limit of " 654b5c07418SJames Feist "simultaneous subscriptions (if supported)."}}; 655b5c07418SJames Feist } 656b5c07418SJames Feist 657b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 658b5c07418SJames Feist { 659789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 660b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 661f4c4dcf4SKowalski, Kamil } 662f4c4dcf4SKowalski, Kamil 663f4c4dcf4SKowalski, Kamil /** 664f4c4dcf4SKowalski, Kamil * @internal 665f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 666f4c4dcf4SKowalski, Kamil * 667f4c4dcf4SKowalski, Kamil * See header file for more information 668f4c4dcf4SKowalski, Kamil * @endinternal 669f4c4dcf4SKowalski, Kamil */ 670b5c07418SJames Feist nlohmann::json actionParameterMissing(const std::string& arg1, 6711abe55efSEd Tanous const std::string& arg2) 6721abe55efSEd Tanous { 673b5c07418SJames Feist return nlohmann::json{ 6743e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 675684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterMissing"}, 676b5c07418SJames Feist {"Message", "The action " + arg1 + " requires the parameter " + arg2 + 677b5c07418SJames Feist " to be present in the request body."}, 67885659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 679684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 680f12894f8SJason M. Bills {"Resolution", 68166ac2b8cSJason M. Bills "Supply the action with the required parameter in the request " 682b5c07418SJames Feist "body when the request is resubmitted."}}; 683b5c07418SJames Feist } 684b5c07418SJames Feist 685b5c07418SJames Feist void actionParameterMissing(crow::Response& res, const std::string& arg1, 686b5c07418SJames Feist const std::string& arg2) 687b5c07418SJames Feist { 688b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 689b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 690f4c4dcf4SKowalski, Kamil } 691f4c4dcf4SKowalski, Kamil 692f4c4dcf4SKowalski, Kamil /** 693f4c4dcf4SKowalski, Kamil * @internal 694f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 695f4c4dcf4SKowalski, Kamil * 696f4c4dcf4SKowalski, Kamil * See header file for more information 697f4c4dcf4SKowalski, Kamil * @endinternal 698f4c4dcf4SKowalski, Kamil */ 699*331b2017SEd Tanous nlohmann::json stringValueTooLong(const std::string& arg1, int arg2) 7001abe55efSEd Tanous { 701b5c07418SJames Feist return nlohmann::json{ 7023e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 703684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.StringValueTooLong"}, 704f4c4dcf4SKowalski, Kamil {"Message", "The string " + arg1 + " exceeds the length limit " + 705f4c4dcf4SKowalski, Kamil std::to_string(arg2) + "."}, 70685659adfSJason M. Bills {"MessageArgs", {arg1, std::to_string(arg2)}}, 707684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 708f4c4dcf4SKowalski, Kamil {"Resolution", 709b5c07418SJames Feist "Resubmit the request with an appropriate string length."}}; 710b5c07418SJames Feist } 711b5c07418SJames Feist 712*331b2017SEd Tanous void stringValueTooLong(crow::Response& res, const std::string& arg1, int arg2) 713b5c07418SJames Feist { 714b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 715b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 716f4c4dcf4SKowalski, Kamil } 717f4c4dcf4SKowalski, Kamil 718f4c4dcf4SKowalski, Kamil /** 719f4c4dcf4SKowalski, Kamil * @internal 720cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 721cc9139ecSJason M. Bills * 722cc9139ecSJason M. Bills * See header file for more information 723cc9139ecSJason M. Bills * @endinternal 724cc9139ecSJason M. Bills */ 725b5c07418SJames Feist nlohmann::json sessionTerminated(void) 726cc9139ecSJason M. Bills { 727b5c07418SJames Feist return nlohmann::json{ 7283e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 729684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionTerminated"}, 730cc9139ecSJason M. Bills {"Message", "The session was successfully terminated."}, 73185659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 732684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 733b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 734b5c07418SJames Feist } 735b5c07418SJames Feist 736b5c07418SJames Feist void sessionTerminated(crow::Response& res) 737b5c07418SJames Feist { 738b5c07418SJames Feist res.result(boost::beast::http::status::ok); 739b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 740cc9139ecSJason M. Bills } 741cc9139ecSJason M. Bills 742cc9139ecSJason M. Bills /** 743cc9139ecSJason M. Bills * @internal 744684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 745684bb4b8SJason M. Bills * 746684bb4b8SJason M. Bills * See header file for more information 747684bb4b8SJason M. Bills * @endinternal 748684bb4b8SJason M. Bills */ 749684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 750684bb4b8SJason M. Bills { 751684bb4b8SJason M. Bills return nlohmann::json{ 7523e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 753684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SubscriptionTerminated"}, 754684bb4b8SJason M. Bills {"Message", "The event subscription has been terminated."}, 755684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 756684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 757684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 758684bb4b8SJason M. Bills } 759684bb4b8SJason M. Bills 760684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 761684bb4b8SJason M. Bills { 762684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 763684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 764684bb4b8SJason M. Bills } 765684bb4b8SJason M. Bills 766684bb4b8SJason M. Bills /** 767684bb4b8SJason M. Bills * @internal 768cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 769cc9139ecSJason M. Bills * 770cc9139ecSJason M. Bills * See header file for more information 771cc9139ecSJason M. Bills * @endinternal 772cc9139ecSJason M. Bills */ 773b5c07418SJames Feist nlohmann::json resourceTypeIncompatible(const std::string& arg1, 774cc9139ecSJason M. Bills const std::string& arg2) 775cc9139ecSJason M. Bills { 776b5c07418SJames Feist return nlohmann::json{ 7773e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 778684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceTypeIncompatible"}, 779cc9139ecSJason M. Bills {"Message", "The @odata.type of the request body " + arg1 + 780cc9139ecSJason M. Bills " is incompatible with the @odata.type of the " 781cc9139ecSJason M. Bills "resource which is " + 782cc9139ecSJason M. Bills arg2 + "."}, 78385659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 784684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 785cc9139ecSJason M. Bills {"Resolution", "Resubmit the request with a payload compatible " 786b5c07418SJames Feist "with the resource's schema."}}; 787b5c07418SJames Feist } 788b5c07418SJames Feist 789b5c07418SJames Feist void resourceTypeIncompatible(crow::Response& res, const std::string& arg1, 790b5c07418SJames Feist const std::string& arg2) 791b5c07418SJames Feist { 792b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 793b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 794cc9139ecSJason M. Bills } 795cc9139ecSJason M. Bills 796cc9139ecSJason M. Bills /** 797cc9139ecSJason M. Bills * @internal 798684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 799684bb4b8SJason M. Bills * 800684bb4b8SJason M. Bills * See header file for more information 801684bb4b8SJason M. Bills * @endinternal 802684bb4b8SJason M. Bills */ 803684bb4b8SJason M. Bills nlohmann::json resetRequired(const std::string& arg1, const std::string& arg2) 804684bb4b8SJason M. Bills { 805684bb4b8SJason M. Bills return nlohmann::json{ 8063e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 807684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResetRequired"}, 808684bb4b8SJason M. Bills {"Message", "In order to complete the operation, a component reset is " 809684bb4b8SJason M. Bills "required with the Reset action URI '" + 810684bb4b8SJason M. Bills arg1 + "' and ResetType '" + arg2 + "'."}, 811684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 812684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 813684bb4b8SJason M. Bills {"Resolution", 814684bb4b8SJason M. Bills "Perform the required Reset action on the specified component."}}; 815684bb4b8SJason M. Bills } 816684bb4b8SJason M. Bills 817684bb4b8SJason M. Bills void resetRequired(crow::Response& res, const std::string& arg1, 818684bb4b8SJason M. Bills const std::string& arg2) 819684bb4b8SJason M. Bills { 820684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 821684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 822684bb4b8SJason M. Bills } 823684bb4b8SJason M. Bills 824684bb4b8SJason M. Bills /** 825684bb4b8SJason M. Bills * @internal 826684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 827684bb4b8SJason M. Bills * 828684bb4b8SJason M. Bills * See header file for more information 829684bb4b8SJason M. Bills * @endinternal 830684bb4b8SJason M. Bills */ 831684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOnRequired(const std::string& arg1) 832684bb4b8SJason M. Bills { 833684bb4b8SJason M. Bills return nlohmann::json{ 8343e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 835684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOnRequired"}, 836684bb4b8SJason M. Bills {"Message", "The Chassis with Id '" + arg1 + 837684bb4b8SJason M. Bills "' requires to be powered on to perform this request."}, 838684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 839684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 840684bb4b8SJason M. Bills {"Resolution", 841684bb4b8SJason M. Bills "Power on the specified Chassis and resubmit the request."}}; 842684bb4b8SJason M. Bills } 843684bb4b8SJason M. Bills 844684bb4b8SJason M. Bills void chassisPowerStateOnRequired(crow::Response& res, const std::string& arg1) 845684bb4b8SJason M. Bills { 846684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 847684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 848684bb4b8SJason M. Bills } 849684bb4b8SJason M. Bills 850684bb4b8SJason M. Bills /** 851684bb4b8SJason M. Bills * @internal 852684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 853684bb4b8SJason M. Bills * 854684bb4b8SJason M. Bills * See header file for more information 855684bb4b8SJason M. Bills * @endinternal 856684bb4b8SJason M. Bills */ 857684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOffRequired(const std::string& arg1) 858684bb4b8SJason M. Bills { 859684bb4b8SJason M. Bills return nlohmann::json{ 8603e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 861684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOffRequired"}, 862684bb4b8SJason M. Bills {"Message", 863684bb4b8SJason M. Bills "The Chassis with Id '" + arg1 + 864684bb4b8SJason M. Bills "' requires to be powered off to perform this request."}, 865684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 866684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 867684bb4b8SJason M. Bills {"Resolution", 868684bb4b8SJason M. Bills "Power off the specified Chassis and resubmit the request."}}; 869684bb4b8SJason M. Bills } 870684bb4b8SJason M. Bills 871684bb4b8SJason M. Bills void chassisPowerStateOffRequired(crow::Response& res, const std::string& arg1) 872684bb4b8SJason M. Bills { 873684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 874684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 875684bb4b8SJason M. Bills } 876684bb4b8SJason M. Bills 877684bb4b8SJason M. Bills /** 878684bb4b8SJason M. Bills * @internal 879684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 880684bb4b8SJason M. Bills * 881684bb4b8SJason M. Bills * See header file for more information 882684bb4b8SJason M. Bills * @endinternal 883684bb4b8SJason M. Bills */ 884684bb4b8SJason M. Bills nlohmann::json propertyValueConflict(const std::string& arg1, 885684bb4b8SJason M. Bills const std::string& arg2) 886684bb4b8SJason M. Bills { 887684bb4b8SJason M. Bills return nlohmann::json{ 8883e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 889684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueConflict"}, 890684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 891684bb4b8SJason M. Bills "' could not be written because its value would " 892684bb4b8SJason M. Bills "conflict with the value of the '" + 893684bb4b8SJason M. Bills arg2 + "' property."}, 894684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 895684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 896684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 897684bb4b8SJason M. Bills } 898684bb4b8SJason M. Bills 899684bb4b8SJason M. Bills void propertyValueConflict(crow::Response& res, const std::string& arg1, 900684bb4b8SJason M. Bills const std::string& arg2) 901684bb4b8SJason M. Bills { 902684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 903684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 904684bb4b8SJason M. Bills } 905684bb4b8SJason M. Bills 906684bb4b8SJason M. Bills /** 907684bb4b8SJason M. Bills * @internal 908684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect 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 propertyValueIncorrect(const std::string& arg1, 914684bb4b8SJason M. Bills const std::string& arg2) 915684bb4b8SJason M. Bills { 916684bb4b8SJason M. Bills return nlohmann::json{ 9173e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 918684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueIncorrect"}, 919684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 920684bb4b8SJason M. Bills "' with the requested value of '" + arg2 + 921684bb4b8SJason M. Bills "' could not be written because the value does not " 922684bb4b8SJason M. Bills "meet the constraints of the implementation."}, 923684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 924684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 925684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 926684bb4b8SJason M. Bills } 927684bb4b8SJason M. Bills 928684bb4b8SJason M. Bills void propertyValueIncorrect(crow::Response& res, const std::string& arg1, 929684bb4b8SJason M. Bills const std::string& arg2) 930684bb4b8SJason M. Bills { 931684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 932684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 933684bb4b8SJason M. Bills } 934684bb4b8SJason M. Bills 935684bb4b8SJason M. Bills /** 936684bb4b8SJason M. Bills * @internal 937684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 938684bb4b8SJason M. Bills * 939684bb4b8SJason M. Bills * See header file for more information 940684bb4b8SJason M. Bills * @endinternal 941684bb4b8SJason M. Bills */ 942684bb4b8SJason M. Bills nlohmann::json resourceCreationConflict(const std::string& arg1) 943684bb4b8SJason M. Bills { 944684bb4b8SJason M. Bills return nlohmann::json{ 9453e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 946684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceCreationConflict"}, 947684bb4b8SJason M. Bills {"Message", "The resource could not be created. The service has a " 948684bb4b8SJason M. Bills "resource at URI '" + 949684bb4b8SJason M. Bills arg1 + "' that conflicts with the creation request."}, 950684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 951684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 952684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 953684bb4b8SJason M. Bills } 954684bb4b8SJason M. Bills 955684bb4b8SJason M. Bills void resourceCreationConflict(crow::Response& res, const std::string& arg1) 956684bb4b8SJason M. Bills { 957684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 958684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 959684bb4b8SJason M. Bills } 960684bb4b8SJason M. Bills 961684bb4b8SJason M. Bills /** 962684bb4b8SJason M. Bills * @internal 963684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 964684bb4b8SJason M. Bills * 965684bb4b8SJason M. Bills * See header file for more information 966684bb4b8SJason M. Bills * @endinternal 967684bb4b8SJason M. Bills */ 968684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 969684bb4b8SJason M. Bills { 970684bb4b8SJason M. Bills return nlohmann::json{ 9713e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 972684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.MaximumErrorsExceeded"}, 973684bb4b8SJason M. Bills {"Message", "Too many errors have occurred to report them all."}, 974684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 975684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 976684bb4b8SJason M. Bills {"Resolution", 977684bb4b8SJason M. Bills "Resolve other reported errors and retry the current operation."}}; 978684bb4b8SJason M. Bills } 979684bb4b8SJason M. Bills 980684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 981684bb4b8SJason M. Bills { 982684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 983684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 984684bb4b8SJason M. Bills } 985684bb4b8SJason M. Bills 986684bb4b8SJason M. Bills /** 987684bb4b8SJason M. Bills * @internal 988684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 989684bb4b8SJason M. Bills * 990684bb4b8SJason M. Bills * See header file for more information 991684bb4b8SJason M. Bills * @endinternal 992684bb4b8SJason M. Bills */ 993684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 994684bb4b8SJason M. Bills { 995684bb4b8SJason M. Bills return nlohmann::json{ 9963e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 997684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionFailed"}, 998684bb4b8SJason M. Bills {"Message", "The ETag supplied did not match the ETag required to " 999684bb4b8SJason M. Bills "change this resource."}, 1000684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1001684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1002684bb4b8SJason M. Bills {"Resolution", "Try the operation again using the appropriate ETag."}}; 1003684bb4b8SJason M. Bills } 1004684bb4b8SJason M. Bills 1005684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 1006684bb4b8SJason M. Bills { 10074df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 1008684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1009684bb4b8SJason M. Bills } 1010684bb4b8SJason M. Bills 1011684bb4b8SJason M. Bills /** 1012684bb4b8SJason M. Bills * @internal 1013684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 1014684bb4b8SJason M. Bills * 1015684bb4b8SJason M. Bills * See header file for more information 1016684bb4b8SJason M. Bills * @endinternal 1017684bb4b8SJason M. Bills */ 1018684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 1019684bb4b8SJason M. Bills { 1020684bb4b8SJason M. Bills return nlohmann::json{ 10213e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1022684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionRequired"}, 1023684bb4b8SJason M. Bills {"Message", "A precondition header or annotation is required to change " 1024684bb4b8SJason M. Bills "this resource."}, 1025684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1026684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1027684bb4b8SJason M. Bills {"Resolution", "Try the operation again using an If-Match or " 1028684bb4b8SJason M. Bills "If-None-Match header and appropriate ETag."}}; 1029684bb4b8SJason M. Bills } 1030684bb4b8SJason M. Bills 1031684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 1032684bb4b8SJason M. Bills { 1033684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1034684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1035684bb4b8SJason M. Bills } 1036684bb4b8SJason M. Bills 1037684bb4b8SJason M. Bills /** 1038684bb4b8SJason M. Bills * @internal 1039684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 1040684bb4b8SJason M. Bills * 1041684bb4b8SJason M. Bills * See header file for more information 1042684bb4b8SJason M. Bills * @endinternal 1043684bb4b8SJason M. Bills */ 1044684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 1045684bb4b8SJason M. Bills { 1046684bb4b8SJason M. Bills return nlohmann::json{ 10473e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1048684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationFailed"}, 1049684bb4b8SJason M. Bills {"Message", 1050684bb4b8SJason M. Bills "An error occurred internal to the service as part of the overall " 1051684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1052684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1053684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1054684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1055684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1056684bb4b8SJason M. Bills } 1057684bb4b8SJason M. Bills 1058684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 1059684bb4b8SJason M. Bills { 1060684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1061684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 1062684bb4b8SJason M. Bills } 1063684bb4b8SJason M. Bills 1064684bb4b8SJason M. Bills /** 1065684bb4b8SJason M. Bills * @internal 1066684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 1067684bb4b8SJason M. Bills * 1068684bb4b8SJason M. Bills * See header file for more information 1069684bb4b8SJason M. Bills * @endinternal 1070684bb4b8SJason M. Bills */ 1071684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 1072684bb4b8SJason M. Bills { 1073684bb4b8SJason M. Bills return nlohmann::json{ 10743e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1075684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationTimeout"}, 1076684bb4b8SJason M. Bills {"Message", "A timeout internal to the service occured as part of the " 1077684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1078684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1079684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1080684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1081684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1082684bb4b8SJason M. Bills } 1083684bb4b8SJason M. Bills 1084684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 1085684bb4b8SJason M. Bills { 1086684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1087684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 1088684bb4b8SJason M. Bills } 1089684bb4b8SJason M. Bills 1090684bb4b8SJason M. Bills /** 1091684bb4b8SJason M. Bills * @internal 1092f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 1093f12894f8SJason M. Bills * property 1094f12894f8SJason M. Bills * 1095f12894f8SJason M. Bills * See header file for more information 1096f12894f8SJason M. Bills * @endinternal 1097f12894f8SJason M. Bills */ 1098b5c07418SJames Feist nlohmann::json propertyValueTypeError(const std::string& arg1, 1099a08b46ccSJason M. Bills const std::string& arg2) 1100f12894f8SJason M. Bills { 1101b5c07418SJames Feist return nlohmann::json{ 11023e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1103684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueTypeError"}, 1104f12894f8SJason M. Bills {"Message", 1105f12894f8SJason M. Bills "The value " + arg1 + " for the property " + arg2 + 1106f12894f8SJason M. Bills " is of a different type than the property can accept."}, 110785659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1108684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 110966ac2b8cSJason M. Bills {"Resolution", 111066ac2b8cSJason M. Bills "Correct the value for the property in the request body and " 1111b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1112b5c07418SJames Feist } 1113b5c07418SJames Feist 1114b5c07418SJames Feist void propertyValueTypeError(crow::Response& res, const std::string& arg1, 1115b5c07418SJames Feist const std::string& arg2) 1116b5c07418SJames Feist { 1117b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1118b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 1119f4c4dcf4SKowalski, Kamil } 1120f4c4dcf4SKowalski, Kamil 1121f4c4dcf4SKowalski, Kamil /** 1122f4c4dcf4SKowalski, Kamil * @internal 1123f4c4dcf4SKowalski, Kamil * @brief Formats ResourceNotFound message into JSON 1124f4c4dcf4SKowalski, Kamil * 1125f4c4dcf4SKowalski, Kamil * See header file for more information 1126f4c4dcf4SKowalski, Kamil * @endinternal 1127f4c4dcf4SKowalski, Kamil */ 1128b5c07418SJames Feist nlohmann::json resourceNotFound(const std::string& arg1, 11291abe55efSEd Tanous const std::string& arg2) 11301abe55efSEd Tanous { 1131b5c07418SJames Feist return nlohmann::json{ 11323e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1133684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceNotFound"}, 11341abe55efSEd Tanous {"Message", "The requested resource of type " + arg1 + " named " + 11351abe55efSEd Tanous arg2 + " was not found."}, 113685659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1137684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1138f4c4dcf4SKowalski, Kamil {"Resolution", 1139b5c07418SJames Feist "Provide a valid resource identifier and resubmit the request."}}; 1140b5c07418SJames Feist } 1141b5c07418SJames Feist 1142b5c07418SJames Feist void resourceNotFound(crow::Response& res, const std::string& arg1, 1143b5c07418SJames Feist const std::string& arg2) 1144b5c07418SJames Feist { 1145b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1146b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1147f4c4dcf4SKowalski, Kamil } 1148f4c4dcf4SKowalski, Kamil 1149f4c4dcf4SKowalski, Kamil /** 1150f4c4dcf4SKowalski, Kamil * @internal 1151f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1152f4c4dcf4SKowalski, Kamil * 1153f4c4dcf4SKowalski, Kamil * See header file for more information 1154f4c4dcf4SKowalski, Kamil * @endinternal 1155f4c4dcf4SKowalski, Kamil */ 1156b5c07418SJames Feist nlohmann::json couldNotEstablishConnection(const std::string& arg1) 11571abe55efSEd Tanous { 1158b5c07418SJames Feist return nlohmann::json{ 11593e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1160684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CouldNotEstablishConnection"}, 11611abe55efSEd Tanous {"Message", 1162684bb4b8SJason M. Bills "The service failed to establish a connection with the URI " + arg1 + 1163b5c07418SJames Feist "."}, 116485659adfSJason M. Bills {"MessageArgs", {arg1}}, 1165684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 116666ac2b8cSJason M. Bills {"Resolution", 116766ac2b8cSJason M. Bills "Ensure that the URI contains a valid and reachable node name, " 1168b5c07418SJames Feist "protocol information and other URI components."}}; 1169b5c07418SJames Feist } 1170b5c07418SJames Feist 1171b5c07418SJames Feist void couldNotEstablishConnection(crow::Response& res, const std::string& arg1) 1172b5c07418SJames Feist { 1173b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1174b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1175f4c4dcf4SKowalski, Kamil } 1176f4c4dcf4SKowalski, Kamil 1177f4c4dcf4SKowalski, Kamil /** 1178f4c4dcf4SKowalski, Kamil * @internal 1179f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1180f12894f8SJason M. Bills * property 1181f12894f8SJason M. Bills * 1182f12894f8SJason M. Bills * See header file for more information 1183f12894f8SJason M. Bills * @endinternal 1184f12894f8SJason M. Bills */ 1185b5c07418SJames Feist nlohmann::json propertyNotWritable(const std::string& arg1) 1186f12894f8SJason M. Bills { 1187b5c07418SJames Feist return nlohmann::json{ 11883e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1189684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyNotWritable"}, 1190b5c07418SJames Feist {"Message", "The property " + arg1 + 1191b5c07418SJames Feist " is a read only property and cannot be " 1192b5c07418SJames Feist "assigned a value."}, 119385659adfSJason M. Bills {"MessageArgs", {arg1}}, 1194684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 119566ac2b8cSJason M. Bills {"Resolution", "Remove the property from the request body and " 1196b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1197b5c07418SJames Feist } 1198b5c07418SJames Feist 1199b5c07418SJames Feist void propertyNotWritable(crow::Response& res, const std::string& arg1) 1200b5c07418SJames Feist { 1201b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1202b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1203f4c4dcf4SKowalski, Kamil } 1204f4c4dcf4SKowalski, Kamil 1205f4c4dcf4SKowalski, Kamil /** 1206f4c4dcf4SKowalski, Kamil * @internal 1207f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1208f4c4dcf4SKowalski, Kamil * 1209f4c4dcf4SKowalski, Kamil * See header file for more information 1210f4c4dcf4SKowalski, Kamil * @endinternal 1211f4c4dcf4SKowalski, Kamil */ 1212b5c07418SJames Feist nlohmann::json queryParameterValueTypeError(const std::string& arg1, 12131abe55efSEd Tanous const std::string& arg2) 12141abe55efSEd Tanous { 1215b5c07418SJames Feist return nlohmann::json{ 12163e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1217684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueTypeError"}, 12181abe55efSEd Tanous {"Message", 12191abe55efSEd Tanous "The value " + arg1 + " for the query parameter " + arg2 + 1220f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 122185659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1222684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 122366ac2b8cSJason M. Bills {"Resolution", 122466ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1225b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1226b5c07418SJames Feist } 1227b5c07418SJames Feist 1228b5c07418SJames Feist void queryParameterValueTypeError(crow::Response& res, const std::string& arg1, 1229b5c07418SJames Feist const std::string& arg2) 1230b5c07418SJames Feist { 1231b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1232b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1233b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1234f4c4dcf4SKowalski, Kamil } 1235f4c4dcf4SKowalski, Kamil 1236f4c4dcf4SKowalski, Kamil /** 1237f4c4dcf4SKowalski, Kamil * @internal 1238f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1239f4c4dcf4SKowalski, Kamil * 1240f4c4dcf4SKowalski, Kamil * See header file for more information 1241f4c4dcf4SKowalski, Kamil * @endinternal 1242f4c4dcf4SKowalski, Kamil */ 1243b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 12441abe55efSEd Tanous { 1245b5c07418SJames Feist return nlohmann::json{ 12463e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1247684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceShuttingDown"}, 1248f12894f8SJason M. Bills {"Message", "The operation failed because the service is shutting " 124966ac2b8cSJason M. Bills "down and can no longer take incoming requests."}, 125085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1251684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 125266ac2b8cSJason M. Bills {"Resolution", "When the service becomes available, resubmit the " 1253b5c07418SJames Feist "request if the operation failed."}}; 1254b5c07418SJames Feist } 1255b5c07418SJames Feist 1256b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1257b5c07418SJames Feist { 1258b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1259b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1260f4c4dcf4SKowalski, Kamil } 1261f4c4dcf4SKowalski, Kamil 1262f4c4dcf4SKowalski, Kamil /** 1263f4c4dcf4SKowalski, Kamil * @internal 1264f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1265f4c4dcf4SKowalski, Kamil * 1266f4c4dcf4SKowalski, Kamil * See header file for more information 1267f4c4dcf4SKowalski, Kamil * @endinternal 1268f4c4dcf4SKowalski, Kamil */ 1269b5c07418SJames Feist nlohmann::json actionParameterDuplicate(const std::string& arg1, 12701abe55efSEd Tanous const std::string& arg2) 12711abe55efSEd Tanous { 1272b5c07418SJames Feist return nlohmann::json{ 12733e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1274684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterDuplicate"}, 1275f4c4dcf4SKowalski, Kamil {"Message", 1276f4c4dcf4SKowalski, Kamil "The action " + arg1 + 12771abe55efSEd Tanous " was submitted with more than one value for the parameter " + 12781abe55efSEd Tanous arg2 + "."}, 127985659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1280684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 128166ac2b8cSJason M. Bills {"Resolution", 128266ac2b8cSJason M. Bills "Resubmit the action with only one instance of the parameter in " 1283b5c07418SJames Feist "the request body if the operation failed."}}; 1284b5c07418SJames Feist } 1285b5c07418SJames Feist 1286b5c07418SJames Feist void actionParameterDuplicate(crow::Response& res, const std::string& arg1, 1287b5c07418SJames Feist const std::string& arg2) 1288b5c07418SJames Feist { 1289b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1290b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1291f4c4dcf4SKowalski, Kamil } 1292f4c4dcf4SKowalski, Kamil 1293f4c4dcf4SKowalski, Kamil /** 1294f4c4dcf4SKowalski, Kamil * @internal 1295f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1296f4c4dcf4SKowalski, Kamil * 1297f4c4dcf4SKowalski, Kamil * See header file for more information 1298f4c4dcf4SKowalski, Kamil * @endinternal 1299f4c4dcf4SKowalski, Kamil */ 1300b5c07418SJames Feist nlohmann::json actionParameterNotSupported(const std::string& arg1, 13011abe55efSEd Tanous const std::string& arg2) 13021abe55efSEd Tanous { 1303b5c07418SJames Feist return nlohmann::json{ 13043e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1305684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterNotSupported"}, 1306f4c4dcf4SKowalski, Kamil {"Message", "The parameter " + arg1 + " for the action " + arg2 + 1307f4c4dcf4SKowalski, Kamil " is not supported on the target resource."}, 130885659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1309684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 131066ac2b8cSJason M. Bills {"Resolution", "Remove the parameter supplied and resubmit the " 1311b5c07418SJames Feist "request if the operation failed."}}; 1312b5c07418SJames Feist } 1313b5c07418SJames Feist 1314b5c07418SJames Feist void actionParameterNotSupported(crow::Response& res, const std::string& arg1, 1315b5c07418SJames Feist const std::string& arg2) 1316b5c07418SJames Feist { 1317b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1318b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1319b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1320f4c4dcf4SKowalski, Kamil } 1321f4c4dcf4SKowalski, Kamil 1322f4c4dcf4SKowalski, Kamil /** 1323f4c4dcf4SKowalski, Kamil * @internal 1324f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1325f4c4dcf4SKowalski, Kamil * 1326f4c4dcf4SKowalski, Kamil * See header file for more information 1327f4c4dcf4SKowalski, Kamil * @endinternal 1328f4c4dcf4SKowalski, Kamil */ 1329b5c07418SJames Feist nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1, 13301abe55efSEd Tanous const std::string& arg2) 13311abe55efSEd Tanous { 1332b5c07418SJames Feist return nlohmann::json{ 13333e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1334684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SourceDoesNotSupportProtocol"}, 1335684bb4b8SJason M. Bills {"Message", "The other end of the connection at " + arg1 + 13361abe55efSEd Tanous " does not support the specified protocol " + arg2 + 13371abe55efSEd Tanous "."}, 133885659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1339684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1340b5c07418SJames Feist {"Resolution", "Change protocols or URIs. "}}; 1341b5c07418SJames Feist } 1342b5c07418SJames Feist 1343b5c07418SJames Feist void sourceDoesNotSupportProtocol(crow::Response& res, const std::string& arg1, 1344b5c07418SJames Feist const std::string& arg2) 1345b5c07418SJames Feist { 1346b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1347b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1348b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1349f4c4dcf4SKowalski, Kamil } 1350f4c4dcf4SKowalski, Kamil 1351f4c4dcf4SKowalski, Kamil /** 1352f4c4dcf4SKowalski, Kamil * @internal 1353f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1354f4c4dcf4SKowalski, Kamil * 1355f4c4dcf4SKowalski, Kamil * See header file for more information 1356f4c4dcf4SKowalski, Kamil * @endinternal 1357f4c4dcf4SKowalski, Kamil */ 1358b5c07418SJames Feist nlohmann::json accountRemoved(void) 13591abe55efSEd Tanous { 13603e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1361684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountRemoved"}, 1362f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully removed."}, 136385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1364684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1365b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1366b5c07418SJames Feist } 1367b5c07418SJames Feist 1368b5c07418SJames Feist void accountRemoved(crow::Response& res) 1369b5c07418SJames Feist { 1370b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1371b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1372f4c4dcf4SKowalski, Kamil } 1373f4c4dcf4SKowalski, Kamil 1374f4c4dcf4SKowalski, Kamil /** 1375f4c4dcf4SKowalski, Kamil * @internal 1376f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1377f4c4dcf4SKowalski, Kamil * 1378f4c4dcf4SKowalski, Kamil * See header file for more information 1379f4c4dcf4SKowalski, Kamil * @endinternal 1380f4c4dcf4SKowalski, Kamil */ 1381b5c07418SJames Feist nlohmann::json accessDenied(const std::string& arg1) 13821abe55efSEd Tanous { 1383b5c07418SJames Feist return nlohmann::json{ 13843e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1385684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccessDenied"}, 1386684bb4b8SJason M. Bills {"Message", "While attempting to establish a connection to " + arg1 + 1387b5c07418SJames Feist ", the service denied access."}, 138885659adfSJason M. Bills {"MessageArgs", {arg1}}, 1389684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 139066ac2b8cSJason M. Bills {"Resolution", "Attempt to ensure that the URI is correct and that " 1391b5c07418SJames Feist "the service has the appropriate credentials."}}; 1392b5c07418SJames Feist } 1393b5c07418SJames Feist 1394b5c07418SJames Feist void accessDenied(crow::Response& res, const std::string& arg1) 1395b5c07418SJames Feist { 1396b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1397b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1398f4c4dcf4SKowalski, Kamil } 1399f4c4dcf4SKowalski, Kamil 1400f4c4dcf4SKowalski, Kamil /** 1401f4c4dcf4SKowalski, Kamil * @internal 1402f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1403f4c4dcf4SKowalski, Kamil * 1404f4c4dcf4SKowalski, Kamil * See header file for more information 1405f4c4dcf4SKowalski, Kamil * @endinternal 1406f4c4dcf4SKowalski, Kamil */ 1407b5c07418SJames Feist nlohmann::json queryNotSupported(void) 14081abe55efSEd Tanous { 1409b5c07418SJames Feist return nlohmann::json{ 14103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1411684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupported"}, 1412f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported by the implementation."}, 141385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1414684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 141566ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1416b5c07418SJames Feist "request if the operation failed."}}; 1417b5c07418SJames Feist } 1418b5c07418SJames Feist 1419b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1420b5c07418SJames Feist { 1421b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1422b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1423f4c4dcf4SKowalski, Kamil } 1424f4c4dcf4SKowalski, Kamil 1425f4c4dcf4SKowalski, Kamil /** 1426f4c4dcf4SKowalski, Kamil * @internal 1427f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1428f4c4dcf4SKowalski, Kamil * 1429f4c4dcf4SKowalski, Kamil * See header file for more information 1430f4c4dcf4SKowalski, Kamil * @endinternal 1431f4c4dcf4SKowalski, Kamil */ 1432b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 14331abe55efSEd Tanous { 1434b5c07418SJames Feist return nlohmann::json{ 14353e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1436684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CreateLimitReachedForResource"}, 14371abe55efSEd Tanous {"Message", "The create operation failed because the resource has " 143866ac2b8cSJason M. Bills "reached the limit of possible resources."}, 143985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1440684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 144166ac2b8cSJason M. Bills {"Resolution", 144266ac2b8cSJason M. Bills "Either delete resources and resubmit the request if the " 1443b5c07418SJames Feist "operation failed or do not resubmit the request."}}; 1444b5c07418SJames Feist } 1445b5c07418SJames Feist 1446b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1447b5c07418SJames Feist { 1448b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1449b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1450f4c4dcf4SKowalski, Kamil } 1451f4c4dcf4SKowalski, Kamil 1452f4c4dcf4SKowalski, Kamil /** 1453f4c4dcf4SKowalski, Kamil * @internal 1454f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1455f4c4dcf4SKowalski, Kamil * 1456f4c4dcf4SKowalski, Kamil * See header file for more information 1457f4c4dcf4SKowalski, Kamil * @endinternal 1458f4c4dcf4SKowalski, Kamil */ 1459b5c07418SJames Feist nlohmann::json generalError(void) 14601abe55efSEd Tanous { 14613e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1462684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.GeneralError"}, 1463b7e069efSJames Feist {"Message", 1464b7e069efSJames Feist "A general error has occurred. See Resolution for " 1465cc9139ecSJason M. Bills "information on how to resolve the error."}, 146685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1467684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1468b5c07418SJames Feist {"Resolution", "None."}}; 1469b5c07418SJames Feist } 1470b5c07418SJames Feist 1471b5c07418SJames Feist void generalError(crow::Response& res) 1472b5c07418SJames Feist { 1473b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1474b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1475f4c4dcf4SKowalski, Kamil } 1476f4c4dcf4SKowalski, Kamil 1477f4c4dcf4SKowalski, Kamil /** 1478f4c4dcf4SKowalski, Kamil * @internal 1479f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1480f4c4dcf4SKowalski, Kamil * 1481f4c4dcf4SKowalski, Kamil * See header file for more information 1482f4c4dcf4SKowalski, Kamil * @endinternal 1483f4c4dcf4SKowalski, Kamil */ 1484b5c07418SJames Feist nlohmann::json success(void) 14851abe55efSEd Tanous { 14863e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1487684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Success"}, 1488f4c4dcf4SKowalski, Kamil {"Message", "Successfully Completed Request"}, 148985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1490684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1491b5c07418SJames Feist {"Resolution", "None"}}; 1492b5c07418SJames Feist } 1493b5c07418SJames Feist 1494b5c07418SJames Feist void success(crow::Response& res) 1495b5c07418SJames Feist { 1496b5c07418SJames Feist // don't set res.result here because success is the default and any 1497b5c07418SJames Feist // error should overwrite the default 1498b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1499f12894f8SJason M. Bills } 1500f12894f8SJason M. Bills 1501f12894f8SJason M. Bills /** 1502f12894f8SJason M. Bills * @internal 1503f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1504f4c4dcf4SKowalski, Kamil * 1505f4c4dcf4SKowalski, Kamil * See header file for more information 1506f4c4dcf4SKowalski, Kamil * @endinternal 1507f4c4dcf4SKowalski, Kamil */ 1508b5c07418SJames Feist nlohmann::json created(void) 15091abe55efSEd Tanous { 1510b5c07418SJames Feist return nlohmann::json{ 15113e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1512684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Created"}, 1513f4c4dcf4SKowalski, Kamil {"Message", "The resource has been created successfully"}, 151485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1515684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1516b5c07418SJames Feist {"Resolution", "None"}}; 1517b5c07418SJames Feist } 1518b5c07418SJames Feist 1519b5c07418SJames Feist void created(crow::Response& res) 1520b5c07418SJames Feist { 1521b5c07418SJames Feist res.result(boost::beast::http::status::created); 1522b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1523f4c4dcf4SKowalski, Kamil } 1524f4c4dcf4SKowalski, Kamil 1525f4c4dcf4SKowalski, Kamil /** 1526f4c4dcf4SKowalski, Kamil * @internal 1527cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1528cc9139ecSJason M. Bills * 1529cc9139ecSJason M. Bills * See header file for more information 1530cc9139ecSJason M. Bills * @endinternal 1531cc9139ecSJason M. Bills */ 1532b5c07418SJames Feist nlohmann::json noOperation(void) 1533cc9139ecSJason M. Bills { 1534b5c07418SJames Feist return nlohmann::json{ 15353e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1536684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoOperation"}, 1537cc9139ecSJason M. Bills {"Message", "The request body submitted contain no data to act " 1538cc9139ecSJason M. Bills "upon and no changes to the resource took place."}, 153985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1540684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1541cc9139ecSJason M. Bills {"Resolution", 1542b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1543b5c07418SJames Feist } 1544b5c07418SJames Feist 1545b5c07418SJames Feist void noOperation(crow::Response& res) 1546b5c07418SJames Feist { 1547b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1548b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1549cc9139ecSJason M. Bills } 1550cc9139ecSJason M. Bills 1551cc9139ecSJason M. Bills /** 1552cc9139ecSJason M. Bills * @internal 1553b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1554b5c07418SJames Feist * property 1555f12894f8SJason M. Bills * 1556f12894f8SJason M. Bills * See header file for more information 1557f12894f8SJason M. Bills * @endinternal 1558f12894f8SJason M. Bills */ 1559b5c07418SJames Feist nlohmann::json propertyUnknown(const std::string& arg1) 1560b5c07418SJames Feist { 1561b5c07418SJames Feist return nlohmann::json{ 15623e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1563684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyUnknown"}, 1564b5c07418SJames Feist {"Message", "The property " + arg1 + 1565b5c07418SJames Feist " is not in the list of valid properties for " 1566b5c07418SJames Feist "the resource."}, 1567b5c07418SJames Feist {"MessageArgs", {arg1}}, 1568684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1569b5c07418SJames Feist {"Resolution", "Remove the unknown property from the request " 1570b5c07418SJames Feist "body and resubmit " 1571b5c07418SJames Feist "the request if the operation failed."}}; 1572b5c07418SJames Feist } 1573b5c07418SJames Feist 1574a08b46ccSJason M. Bills void propertyUnknown(crow::Response& res, const std::string& arg1) 1575f12894f8SJason M. Bills { 1576f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1577b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1); 1578f4c4dcf4SKowalski, Kamil } 1579f4c4dcf4SKowalski, Kamil 1580f4c4dcf4SKowalski, Kamil /** 1581f4c4dcf4SKowalski, Kamil * @internal 1582f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1583f4c4dcf4SKowalski, Kamil * 1584f4c4dcf4SKowalski, Kamil * See header file for more information 1585f4c4dcf4SKowalski, Kamil * @endinternal 1586f4c4dcf4SKowalski, Kamil */ 1587b5c07418SJames Feist nlohmann::json noValidSession(void) 15881abe55efSEd Tanous { 1589b5c07418SJames Feist return nlohmann::json{ 15903e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1591684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoValidSession"}, 1592f4c4dcf4SKowalski, Kamil {"Message", 1593f4c4dcf4SKowalski, Kamil "There is no valid session established with the implementation."}, 159485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1595684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 15961abe55efSEd Tanous {"Resolution", 1597684bb4b8SJason M. Bills "Establish a session before attempting any operations."}}; 1598b5c07418SJames Feist } 1599b5c07418SJames Feist 1600b5c07418SJames Feist void noValidSession(crow::Response& res) 1601b5c07418SJames Feist { 1602b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1603b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1604f4c4dcf4SKowalski, Kamil } 1605f4c4dcf4SKowalski, Kamil 1606f4c4dcf4SKowalski, Kamil /** 1607f4c4dcf4SKowalski, Kamil * @internal 1608f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1609f4c4dcf4SKowalski, Kamil * 1610f4c4dcf4SKowalski, Kamil * See header file for more information 1611f4c4dcf4SKowalski, Kamil * @endinternal 1612f4c4dcf4SKowalski, Kamil */ 1613b5c07418SJames Feist nlohmann::json invalidObject(const std::string& arg1) 16141abe55efSEd Tanous { 1615b5c07418SJames Feist return nlohmann::json{ 16163e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1617684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidObject"}, 1618f4c4dcf4SKowalski, Kamil {"Message", "The object at " + arg1 + " is invalid."}, 161985659adfSJason M. Bills {"MessageArgs", {arg1}}, 1620684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1621f12894f8SJason M. Bills {"Resolution", 162266ac2b8cSJason M. Bills "Either the object is malformed or the URI is not correct. " 1623b5c07418SJames Feist "Correct the condition and resubmit the request if it failed."}}; 1624b5c07418SJames Feist } 1625b5c07418SJames Feist 1626b5c07418SJames Feist void invalidObject(crow::Response& res, const std::string& arg1) 1627b5c07418SJames Feist { 1628b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1629b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1630f4c4dcf4SKowalski, Kamil } 1631f4c4dcf4SKowalski, Kamil 1632f4c4dcf4SKowalski, Kamil /** 1633f4c4dcf4SKowalski, Kamil * @internal 1634f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1635f4c4dcf4SKowalski, Kamil * 1636f4c4dcf4SKowalski, Kamil * See header file for more information 1637f4c4dcf4SKowalski, Kamil * @endinternal 1638f4c4dcf4SKowalski, Kamil */ 1639b5c07418SJames Feist nlohmann::json resourceInStandby(void) 16401abe55efSEd Tanous { 1641b5c07418SJames Feist return nlohmann::json{ 16423e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1643684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceInStandby"}, 164466ac2b8cSJason M. Bills {"Message", "The request could not be performed because the " 164566ac2b8cSJason M. Bills "resource is in standby."}, 164685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1647684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1648f12894f8SJason M. Bills {"Resolution", "Ensure that the resource is in the correct power " 1649b5c07418SJames Feist "state and resubmit the request."}}; 1650b5c07418SJames Feist } 1651b5c07418SJames Feist 1652b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1653b5c07418SJames Feist { 1654b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1655b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1656f4c4dcf4SKowalski, Kamil } 1657f4c4dcf4SKowalski, Kamil 1658f4c4dcf4SKowalski, Kamil /** 1659f4c4dcf4SKowalski, Kamil * @internal 1660f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1661f4c4dcf4SKowalski, Kamil * 1662f4c4dcf4SKowalski, Kamil * See header file for more information 1663f4c4dcf4SKowalski, Kamil * @endinternal 1664f4c4dcf4SKowalski, Kamil */ 1665b5c07418SJames Feist nlohmann::json actionParameterValueTypeError(const std::string& arg1, 1666f4c4dcf4SKowalski, Kamil const std::string& arg2, 16671abe55efSEd Tanous const std::string& arg3) 16681abe55efSEd Tanous { 1669b5c07418SJames Feist return nlohmann::json{ 16703e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1671684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterValueTypeError"}, 16721abe55efSEd Tanous {"Message", 16731abe55efSEd Tanous "The value " + arg1 + " for the parameter " + arg2 + 1674f4c4dcf4SKowalski, Kamil " in the action " + arg3 + 1675f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 167685659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 1677684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 167866ac2b8cSJason M. Bills {"Resolution", 167966ac2b8cSJason M. Bills "Correct the value for the parameter in the request body and " 1680b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1681b5c07418SJames Feist } 1682b5c07418SJames Feist 1683b5c07418SJames Feist void actionParameterValueTypeError(crow::Response& res, const std::string& arg1, 1684b5c07418SJames Feist const std::string& arg2, 1685b5c07418SJames Feist const std::string& arg3) 1686b5c07418SJames Feist { 1687b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1688b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1689b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1690f4c4dcf4SKowalski, Kamil } 1691f4c4dcf4SKowalski, Kamil 1692f4c4dcf4SKowalski, Kamil /** 1693f4c4dcf4SKowalski, Kamil * @internal 1694f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1695f4c4dcf4SKowalski, Kamil * 1696f4c4dcf4SKowalski, Kamil * See header file for more information 1697f4c4dcf4SKowalski, Kamil * @endinternal 1698f4c4dcf4SKowalski, Kamil */ 1699b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 17001abe55efSEd Tanous { 1701b5c07418SJames Feist return nlohmann::json{ 17023e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1703684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionLimitExceeded"}, 1704f12894f8SJason M. Bills {"Message", "The session establishment failed due to the number of " 170566ac2b8cSJason M. Bills "simultaneous sessions exceeding the limit of the " 170666ac2b8cSJason M. Bills "implementation."}, 170785659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1708684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 170966ac2b8cSJason M. Bills {"Resolution", "Reduce the number of other sessions before trying " 171066ac2b8cSJason M. Bills "to establish the session or increase the limit of " 1711b5c07418SJames Feist "simultaneous sessions (if supported)."}}; 1712b5c07418SJames Feist } 1713b5c07418SJames Feist 1714b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1715b5c07418SJames Feist { 1716b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1717b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1718f4c4dcf4SKowalski, Kamil } 1719f4c4dcf4SKowalski, Kamil 1720f4c4dcf4SKowalski, Kamil /** 1721f4c4dcf4SKowalski, Kamil * @internal 1722f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1723f4c4dcf4SKowalski, Kamil * 1724f4c4dcf4SKowalski, Kamil * See header file for more information 1725f4c4dcf4SKowalski, Kamil * @endinternal 1726f4c4dcf4SKowalski, Kamil */ 1727b5c07418SJames Feist nlohmann::json actionNotSupported(const std::string& arg1) 17281abe55efSEd Tanous { 1729b5c07418SJames Feist return nlohmann::json{ 17303e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1731684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionNotSupported"}, 17321abe55efSEd Tanous {"Message", 17331abe55efSEd Tanous "The action " + arg1 + " is not supported by the resource."}, 173485659adfSJason M. Bills {"MessageArgs", {arg1}}, 1735684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1736f4c4dcf4SKowalski, Kamil {"Resolution", 1737f4c4dcf4SKowalski, Kamil "The action supplied cannot be resubmitted to the implementation. " 1738f12894f8SJason M. Bills " Perhaps the action was invalid, the wrong resource was the " 173966ac2b8cSJason M. Bills "target or the implementation documentation may be of " 1740b5c07418SJames Feist "assistance."}}; 1741b5c07418SJames Feist } 1742b5c07418SJames Feist 1743b5c07418SJames Feist void actionNotSupported(crow::Response& res, const std::string& arg1) 1744b5c07418SJames Feist { 1745b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1746b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1747f4c4dcf4SKowalski, Kamil } 1748f4c4dcf4SKowalski, Kamil 1749f4c4dcf4SKowalski, Kamil /** 1750f4c4dcf4SKowalski, Kamil * @internal 1751f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1752f4c4dcf4SKowalski, Kamil * 1753f4c4dcf4SKowalski, Kamil * See header file for more information 1754f4c4dcf4SKowalski, Kamil * @endinternal 1755f4c4dcf4SKowalski, Kamil */ 17565187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 17571abe55efSEd Tanous { 1758b5c07418SJames Feist return nlohmann::json{ 17593e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1760684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidIndex"}, 1761684bb4b8SJason M. Bills {"Message", "The Index " + std::to_string(arg1) + 1762f4c4dcf4SKowalski, Kamil " is not a valid offset into the array."}, 176385659adfSJason M. Bills {"MessageArgs", {std::to_string(arg1)}}, 1764684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1765f12894f8SJason M. Bills {"Resolution", "Verify the index value provided is within the " 1766b5c07418SJames Feist "bounds of the array."}}; 1767b5c07418SJames Feist } 1768b5c07418SJames Feist 17695187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1770b5c07418SJames Feist { 1771b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1772b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1773f4c4dcf4SKowalski, Kamil } 1774f4c4dcf4SKowalski, Kamil 1775f4c4dcf4SKowalski, Kamil /** 1776f4c4dcf4SKowalski, Kamil * @internal 1777f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1778f4c4dcf4SKowalski, Kamil * 1779f4c4dcf4SKowalski, Kamil * See header file for more information 1780f4c4dcf4SKowalski, Kamil * @endinternal 1781f4c4dcf4SKowalski, Kamil */ 1782b5c07418SJames Feist nlohmann::json emptyJSON(void) 17831abe55efSEd Tanous { 1784b5c07418SJames Feist return nlohmann::json{ 17853e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1786684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.EmptyJSON"}, 1787f12894f8SJason M. Bills {"Message", "The request body submitted contained an empty JSON " 178866ac2b8cSJason M. Bills "object and the service is unable to process it."}, 178985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1790684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1791f4c4dcf4SKowalski, Kamil {"Resolution", 1792b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1793b5c07418SJames Feist } 1794b5c07418SJames Feist 1795b5c07418SJames Feist void emptyJSON(crow::Response& res) 1796b5c07418SJames Feist { 1797b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1798b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1799f4c4dcf4SKowalski, Kamil } 1800f4c4dcf4SKowalski, Kamil 1801f4c4dcf4SKowalski, Kamil /** 1802f4c4dcf4SKowalski, Kamil * @internal 1803f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1804f4c4dcf4SKowalski, Kamil * 1805f4c4dcf4SKowalski, Kamil * See header file for more information 1806f4c4dcf4SKowalski, Kamil * @endinternal 1807f4c4dcf4SKowalski, Kamil */ 1808b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 18091abe55efSEd Tanous { 1810b5c07418SJames Feist return nlohmann::json{ 18113e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1812684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnResource"}, 1813f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported on the requested resource."}, 181485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1815684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 181666ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1817b5c07418SJames Feist "request if the operation failed."}}; 1818b5c07418SJames Feist } 1819b5c07418SJames Feist 1820b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1821b5c07418SJames Feist { 1822b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1823b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1824f4c4dcf4SKowalski, Kamil } 1825f4c4dcf4SKowalski, Kamil 1826f4c4dcf4SKowalski, Kamil /** 1827f4c4dcf4SKowalski, Kamil * @internal 1828684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1829684bb4b8SJason M. Bills * 1830684bb4b8SJason M. Bills * See header file for more information 1831684bb4b8SJason M. Bills * @endinternal 1832684bb4b8SJason M. Bills */ 1833684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1834684bb4b8SJason M. Bills { 1835684bb4b8SJason M. Bills return nlohmann::json{ 18363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1837684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnOperation"}, 1838684bb4b8SJason M. Bills {"Message", "Querying is not supported with the requested operation."}, 1839684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1840684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1841684bb4b8SJason M. Bills {"Resolution", "Remove the query parameters and resubmit the request " 1842684bb4b8SJason M. Bills "if the operation failed."}}; 1843684bb4b8SJason M. Bills } 1844684bb4b8SJason M. Bills 1845684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1846684bb4b8SJason M. Bills { 1847684bb4b8SJason M. Bills res.result(boost::beast::http::status::forbidden); 1848684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1849684bb4b8SJason M. Bills } 1850684bb4b8SJason M. Bills 1851684bb4b8SJason M. Bills /** 1852684bb4b8SJason M. Bills * @internal 1853684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1854684bb4b8SJason M. Bills * 1855684bb4b8SJason M. Bills * See header file for more information 1856684bb4b8SJason M. Bills * @endinternal 1857684bb4b8SJason M. Bills */ 1858684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1859684bb4b8SJason M. Bills { 1860684bb4b8SJason M. Bills return nlohmann::json{ 18613e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1862684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryCombinationInvalid"}, 1863684bb4b8SJason M. Bills {"Message", "Two or more query parameters in the request cannot be " 1864684bb4b8SJason M. Bills "used together."}, 1865684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1866684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1867684bb4b8SJason M. Bills {"Resolution", "Remove one or more of the query parameters and " 1868684bb4b8SJason M. Bills "resubmit the request if the operation failed."}}; 1869684bb4b8SJason M. Bills } 1870684bb4b8SJason M. Bills 1871684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1872684bb4b8SJason M. Bills { 1873684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1874684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1875684bb4b8SJason M. Bills } 1876684bb4b8SJason M. Bills 1877684bb4b8SJason M. Bills /** 1878684bb4b8SJason M. Bills * @internal 1879f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1880f4c4dcf4SKowalski, Kamil * 1881f4c4dcf4SKowalski, Kamil * See header file for more information 1882f4c4dcf4SKowalski, Kamil * @endinternal 1883f4c4dcf4SKowalski, Kamil */ 1884b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 18851abe55efSEd Tanous { 1886b5c07418SJames Feist return nlohmann::json{ 18873e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1888684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InsufficientPrivilege"}, 188966ac2b8cSJason M. Bills {"Message", "There are insufficient privileges for the account or " 189066ac2b8cSJason M. Bills "credentials associated with the current session to " 189166ac2b8cSJason M. Bills "perform the requested operation."}, 189285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1893684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1894f4c4dcf4SKowalski, Kamil {"Resolution", 1895f12894f8SJason M. Bills "Either abandon the operation or change the associated access " 1896b5c07418SJames Feist "rights and resubmit the request if the operation failed."}}; 1897b5c07418SJames Feist } 1898b5c07418SJames Feist 1899b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1900b5c07418SJames Feist { 1901b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1902b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1903f4c4dcf4SKowalski, Kamil } 1904f4c4dcf4SKowalski, Kamil 1905f4c4dcf4SKowalski, Kamil /** 1906f4c4dcf4SKowalski, Kamil * @internal 1907f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1908f4c4dcf4SKowalski, Kamil * 1909f4c4dcf4SKowalski, Kamil * See header file for more information 1910f4c4dcf4SKowalski, Kamil * @endinternal 1911f4c4dcf4SKowalski, Kamil */ 1912b5c07418SJames Feist nlohmann::json propertyValueModified(const std::string& arg1, 1913b5c07418SJames Feist const std::string& arg2) 1914b5c07418SJames Feist { 1915b5c07418SJames Feist return nlohmann::json{ 19163e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1917684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueModified"}, 1918b5c07418SJames Feist {"Message", "The property " + arg1 + " was assigned the value " + arg2 + 1919b5c07418SJames Feist " due to modification by the service."}, 1920b5c07418SJames Feist {"MessageArgs", {arg1, arg2}}, 1921684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1922b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1923b5c07418SJames Feist } 1924b5c07418SJames Feist 1925f12894f8SJason M. Bills void propertyValueModified(crow::Response& res, const std::string& arg1, 1926a08b46ccSJason M. Bills const std::string& arg2) 19271abe55efSEd Tanous { 1928f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1929b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1930f4c4dcf4SKowalski, Kamil } 1931f4c4dcf4SKowalski, Kamil 1932f4c4dcf4SKowalski, Kamil /** 1933f4c4dcf4SKowalski, Kamil * @internal 1934f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1935f4c4dcf4SKowalski, Kamil * 1936f4c4dcf4SKowalski, Kamil * See header file for more information 1937f4c4dcf4SKowalski, Kamil * @endinternal 1938f4c4dcf4SKowalski, Kamil */ 1939b5c07418SJames Feist nlohmann::json accountNotModified(void) 19401abe55efSEd Tanous { 1941b5c07418SJames Feist return nlohmann::json{ 19423e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1943684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountNotModified"}, 1944f4c4dcf4SKowalski, Kamil {"Message", "The account modification request failed."}, 194585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1946684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1947f12894f8SJason M. Bills {"Resolution", "The modification may have failed due to permission " 1948b5c07418SJames Feist "issues or issues with the request body."}}; 1949b5c07418SJames Feist } 1950b5c07418SJames Feist 1951b5c07418SJames Feist void accountNotModified(crow::Response& res) 1952b5c07418SJames Feist { 1953b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1954b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1955f4c4dcf4SKowalski, Kamil } 1956f4c4dcf4SKowalski, Kamil 1957f4c4dcf4SKowalski, Kamil /** 1958f4c4dcf4SKowalski, Kamil * @internal 1959f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1960f4c4dcf4SKowalski, Kamil * 1961f4c4dcf4SKowalski, Kamil * See header file for more information 1962f4c4dcf4SKowalski, Kamil * @endinternal 1963f4c4dcf4SKowalski, Kamil */ 1964b5c07418SJames Feist nlohmann::json queryParameterValueFormatError(const std::string& arg1, 19651abe55efSEd Tanous const std::string& arg2) 19661abe55efSEd Tanous { 1967b5c07418SJames Feist return nlohmann::json{ 19683e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1969684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueFormatError"}, 1970f4c4dcf4SKowalski, Kamil {"Message", 1971f4c4dcf4SKowalski, Kamil "The value " + arg1 + " for the parameter " + arg2 + 1972f4c4dcf4SKowalski, Kamil " is of a different format than the parameter can accept."}, 197385659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1974684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 197566ac2b8cSJason M. Bills {"Resolution", 197666ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1977b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1978b5c07418SJames Feist } 1979b5c07418SJames Feist 1980b5c07418SJames Feist void queryParameterValueFormatError(crow::Response& res, 1981b5c07418SJames Feist const std::string& arg1, 1982b5c07418SJames Feist const std::string& arg2) 1983b5c07418SJames Feist { 1984b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1985b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1986b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1987f4c4dcf4SKowalski, Kamil } 1988f4c4dcf4SKowalski, Kamil 1989f4c4dcf4SKowalski, Kamil /** 1990f4c4dcf4SKowalski, Kamil * @internal 1991b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1992b5c07418SJames Feist * property 1993f12894f8SJason M. Bills * 1994f12894f8SJason M. Bills * See header file for more information 1995f12894f8SJason M. Bills * @endinternal 1996f12894f8SJason M. Bills */ 1997b5c07418SJames Feist nlohmann::json propertyMissing(const std::string& arg1) 1998f12894f8SJason M. Bills { 1999b5c07418SJames Feist return nlohmann::json{ 20003e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2001684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyMissing"}, 2002f12894f8SJason M. Bills {"Message", "The property " + arg1 + 2003f12894f8SJason M. Bills " is a required property and must be included in " 2004f12894f8SJason M. Bills "the request."}, 200585659adfSJason M. Bills {"MessageArgs", {arg1}}, 2006684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2007f12894f8SJason M. Bills {"Resolution", 2008b5c07418SJames Feist "Ensure that the property is in the request body and has a " 2009b5c07418SJames Feist "valid " 2010b5c07418SJames Feist "value and resubmit the request if the operation failed."}}; 2011b5c07418SJames Feist } 2012b5c07418SJames Feist 2013b5c07418SJames Feist void propertyMissing(crow::Response& res, const std::string& arg1) 2014b5c07418SJames Feist { 2015b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2016b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 2017f4c4dcf4SKowalski, Kamil } 2018f4c4dcf4SKowalski, Kamil 2019f4c4dcf4SKowalski, Kamil /** 2020f4c4dcf4SKowalski, Kamil * @internal 2021f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 2022f4c4dcf4SKowalski, Kamil * 2023f4c4dcf4SKowalski, Kamil * See header file for more information 2024f4c4dcf4SKowalski, Kamil * @endinternal 2025f4c4dcf4SKowalski, Kamil */ 2026b5c07418SJames Feist nlohmann::json resourceExhaustion(const std::string& arg1) 20271abe55efSEd Tanous { 2028b5c07418SJames Feist return nlohmann::json{ 20293e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2030684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceExhaustion"}, 2031d425c6f6SEd Tanous {"Message", "The resource " + arg1 + 203266ac2b8cSJason M. Bills " was unable to satisfy the request due to " 203366ac2b8cSJason M. Bills "unavailability of resources."}, 203485659adfSJason M. Bills {"MessageArgs", {arg1}}, 2035684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 2036f12894f8SJason M. Bills {"Resolution", "Ensure that the resources are available and " 2037b5c07418SJames Feist "resubmit the request."}}; 2038b5c07418SJames Feist } 2039b5c07418SJames Feist 2040b5c07418SJames Feist void resourceExhaustion(crow::Response& res, const std::string& arg1) 2041b5c07418SJames Feist { 2042b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 2043b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 2044f4c4dcf4SKowalski, Kamil } 2045f4c4dcf4SKowalski, Kamil 2046f4c4dcf4SKowalski, Kamil /** 2047f4c4dcf4SKowalski, Kamil * @internal 2048f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 2049f4c4dcf4SKowalski, Kamil * 2050f4c4dcf4SKowalski, Kamil * See header file for more information 2051f4c4dcf4SKowalski, Kamil * @endinternal 2052f4c4dcf4SKowalski, Kamil */ 2053b5c07418SJames Feist nlohmann::json accountModified(void) 20541abe55efSEd Tanous { 20553e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 2056684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountModified"}, 2057f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully modified."}, 205885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 2059684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 2060b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 2061b5c07418SJames Feist } 2062b5c07418SJames Feist 2063b5c07418SJames Feist void accountModified(crow::Response& res) 2064b5c07418SJames Feist { 2065b5c07418SJames Feist res.result(boost::beast::http::status::ok); 2066b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 2067f4c4dcf4SKowalski, Kamil } 2068f4c4dcf4SKowalski, Kamil 2069f4c4dcf4SKowalski, Kamil /** 2070f4c4dcf4SKowalski, Kamil * @internal 2071f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 2072f4c4dcf4SKowalski, Kamil * 2073f4c4dcf4SKowalski, Kamil * See header file for more information 2074f4c4dcf4SKowalski, Kamil * @endinternal 2075f4c4dcf4SKowalski, Kamil */ 2076b5c07418SJames Feist nlohmann::json queryParameterOutOfRange(const std::string& arg1, 2077b5c07418SJames Feist const std::string& arg2, 2078b5c07418SJames Feist const std::string& arg3) 20791abe55efSEd Tanous { 2080b5c07418SJames Feist return nlohmann::json{ 20813e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2082684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterOutOfRange"}, 2083b5c07418SJames Feist {"Message", "The value " + arg1 + " for the query parameter " + arg2 + 2084b5c07418SJames Feist " is out of range " + arg3 + "."}, 208585659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 2086684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2087f4c4dcf4SKowalski, Kamil {"Resolution", 2088f12894f8SJason M. Bills "Reduce the value for the query parameter to a value that is " 208966ac2b8cSJason M. Bills "within range, such as a start or count value that is within " 209066ac2b8cSJason M. Bills "bounds of the number of resources in a collection or a page that " 2091b5c07418SJames Feist "is within the range of valid pages."}}; 2092b5c07418SJames Feist } 2093b5c07418SJames Feist 2094b5c07418SJames Feist void queryParameterOutOfRange(crow::Response& res, const std::string& arg1, 2095b5c07418SJames Feist const std::string& arg2, const std::string& arg3) 2096b5c07418SJames Feist { 2097b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2098b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 2099b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 2100f4c4dcf4SKowalski, Kamil } 2101f4c4dcf4SKowalski, Kamil 21023bf4e632SJoseph Reynolds /** 21033bf4e632SJoseph Reynolds * @internal 21043bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 21053bf4e632SJoseph Reynolds * 21063bf4e632SJoseph Reynolds * See header file for more information 21073bf4e632SJoseph Reynolds * @endinternal 21083bf4e632SJoseph Reynolds */ 21093bf4e632SJoseph Reynolds void passwordChangeRequired(crow::Response& res, const std::string& arg1) 21103bf4e632SJoseph Reynolds { 21113bf4e632SJoseph Reynolds messages::addMessageToJsonRoot( 21123bf4e632SJoseph Reynolds res.jsonValue, 21133bf4e632SJoseph Reynolds nlohmann::json{ 21143bf4e632SJoseph Reynolds {"@odata.type", "/redfish/v1/$metadata#Message.v1_5_0.Message"}, 2115684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PasswordChangeRequired"}, 21163bf4e632SJoseph Reynolds {"Message", "The password provided for this account must be " 21173bf4e632SJoseph Reynolds "changed before access is granted. PATCH the " 21183bf4e632SJoseph Reynolds "'Password' property for this account located at " 21193bf4e632SJoseph Reynolds "the target URI '" + 21203bf4e632SJoseph Reynolds arg1 + "' to complete this process."}, 21213bf4e632SJoseph Reynolds {"MessageArgs", {arg1}}, 2122684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 21233bf4e632SJoseph Reynolds {"Resolution", "Change the password for this account using " 21243bf4e632SJoseph Reynolds "a PATCH to the 'Password' property at the URI " 21253bf4e632SJoseph Reynolds "provided."}}); 21263bf4e632SJoseph Reynolds } 21273bf4e632SJoseph Reynolds 21284cde5d90SJames Feist void invalidUpload(crow::Response& res, const std::string& arg1, 21294cde5d90SJames Feist const std::string& arg2) 21304cde5d90SJames Feist { 21314cde5d90SJames Feist res.result(boost::beast::http::status::bad_request); 21324cde5d90SJames Feist addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 21334cde5d90SJames Feist } 21344cde5d90SJames Feist 21354cde5d90SJames Feist /** 21364cde5d90SJames Feist * @internal 21374cde5d90SJames Feist * @brief Formats Invalid File message into JSON 21384cde5d90SJames Feist * 21394cde5d90SJames Feist * See header file for more information 21404cde5d90SJames Feist * @endinternal 21414cde5d90SJames Feist */ 21424cde5d90SJames Feist nlohmann::json invalidUpload(const std::string& arg1, const std::string& arg2) 21434cde5d90SJames Feist { 21444cde5d90SJames Feist return nlohmann::json{ 21453e082749SAsmitha Karunanithi {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"}, 21464a0bf539SManojkiran Eda {"MessageId", "OpenBMC.0.2.InvalidUpload"}, 21474cde5d90SJames Feist {"Message", "Invalid file uploaded to " + arg1 + ": " + arg2 + "."}, 21484cde5d90SJames Feist {"MessageArgs", {arg1, arg2}}, 2149684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 21504cde5d90SJames Feist {"Resolution", "None."}}; 21514cde5d90SJames Feist } 21524cde5d90SJames Feist 2153dd28ba82SAppaRao Puli /** 2154dd28ba82SAppaRao Puli * @internal 2155dd28ba82SAppaRao Puli * @brief Formats MutualExclusiveProperties into JSON 2156dd28ba82SAppaRao Puli * 2157dd28ba82SAppaRao Puli * See header file for more information 2158dd28ba82SAppaRao Puli * @endinternal 2159dd28ba82SAppaRao Puli */ 2160dd28ba82SAppaRao Puli nlohmann::json mutualExclusiveProperties(const std::string& arg1, 2161dd28ba82SAppaRao Puli const std::string& arg2) 2162dd28ba82SAppaRao Puli { 2163dd28ba82SAppaRao Puli return nlohmann::json{ 21643e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2165dd28ba82SAppaRao Puli {"MessageId", "Base.1.5.0.MutualExclusiveProperties"}, 2166dd28ba82SAppaRao Puli {"Message", "The properties " + arg1 + " and " + arg2 + 2167dd28ba82SAppaRao Puli " are mutually exclusive."}, 2168dd28ba82SAppaRao Puli {"MessageArgs", {arg1, arg2}}, 2169684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2170dd28ba82SAppaRao Puli {"Resolution", 2171dd28ba82SAppaRao Puli "Ensure that the request body doesn't contain mutually exclusive " 2172dd28ba82SAppaRao Puli "properties and resubmit the request."}}; 2173dd28ba82SAppaRao Puli } 2174dd28ba82SAppaRao Puli 2175dd28ba82SAppaRao Puli void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, 2176dd28ba82SAppaRao Puli const std::string& arg2) 2177dd28ba82SAppaRao Puli { 2178dd28ba82SAppaRao Puli res.result(boost::beast::http::status::bad_request); 2179dd28ba82SAppaRao Puli addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2)); 2180dd28ba82SAppaRao Puli } 2181dd28ba82SAppaRao Puli 2182f4c4dcf4SKowalski, Kamil } // namespace messages 2183f4c4dcf4SKowalski, Kamil 2184d425c6f6SEd Tanous } // namespace redfish 2185