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 */ 16*9ea15c35SEd Tanous #include "http_response.hpp" 17*9ea15c35SEd Tanous 18*9ea15c35SEd Tanous #include <boost/beast/http/status.hpp> 191abe55efSEd Tanous #include <error_messages.hpp> 2004e438cbSEd Tanous #include <logging.hpp> 21*9ea15c35SEd 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 */ 699b5c07418SJames Feist nlohmann::json stringValueTooLong(const std::string& arg1, const 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 712b5c07418SJames Feist void stringValueTooLong(crow::Response& res, const std::string& arg1, 713b5c07418SJames Feist const int& arg2) 714b5c07418SJames Feist { 715b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 716b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 717f4c4dcf4SKowalski, Kamil } 718f4c4dcf4SKowalski, Kamil 719f4c4dcf4SKowalski, Kamil /** 720f4c4dcf4SKowalski, Kamil * @internal 721cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 722cc9139ecSJason M. Bills * 723cc9139ecSJason M. Bills * See header file for more information 724cc9139ecSJason M. Bills * @endinternal 725cc9139ecSJason M. Bills */ 726b5c07418SJames Feist nlohmann::json sessionTerminated(void) 727cc9139ecSJason M. Bills { 728b5c07418SJames Feist return nlohmann::json{ 7293e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 730684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionTerminated"}, 731cc9139ecSJason M. Bills {"Message", "The session was successfully terminated."}, 73285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 733684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 734b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 735b5c07418SJames Feist } 736b5c07418SJames Feist 737b5c07418SJames Feist void sessionTerminated(crow::Response& res) 738b5c07418SJames Feist { 739b5c07418SJames Feist res.result(boost::beast::http::status::ok); 740b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 741cc9139ecSJason M. Bills } 742cc9139ecSJason M. Bills 743cc9139ecSJason M. Bills /** 744cc9139ecSJason M. Bills * @internal 745684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 746684bb4b8SJason M. Bills * 747684bb4b8SJason M. Bills * See header file for more information 748684bb4b8SJason M. Bills * @endinternal 749684bb4b8SJason M. Bills */ 750684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 751684bb4b8SJason M. Bills { 752684bb4b8SJason M. Bills return nlohmann::json{ 7533e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 754684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SubscriptionTerminated"}, 755684bb4b8SJason M. Bills {"Message", "The event subscription has been terminated."}, 756684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 757684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 758684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 759684bb4b8SJason M. Bills } 760684bb4b8SJason M. Bills 761684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 762684bb4b8SJason M. Bills { 763684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 764684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 765684bb4b8SJason M. Bills } 766684bb4b8SJason M. Bills 767684bb4b8SJason M. Bills /** 768684bb4b8SJason M. Bills * @internal 769cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 770cc9139ecSJason M. Bills * 771cc9139ecSJason M. Bills * See header file for more information 772cc9139ecSJason M. Bills * @endinternal 773cc9139ecSJason M. Bills */ 774b5c07418SJames Feist nlohmann::json resourceTypeIncompatible(const std::string& arg1, 775cc9139ecSJason M. Bills const std::string& arg2) 776cc9139ecSJason M. Bills { 777b5c07418SJames Feist return nlohmann::json{ 7783e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 779684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceTypeIncompatible"}, 780cc9139ecSJason M. Bills {"Message", "The @odata.type of the request body " + arg1 + 781cc9139ecSJason M. Bills " is incompatible with the @odata.type of the " 782cc9139ecSJason M. Bills "resource which is " + 783cc9139ecSJason M. Bills arg2 + "."}, 78485659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 785684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 786cc9139ecSJason M. Bills {"Resolution", "Resubmit the request with a payload compatible " 787b5c07418SJames Feist "with the resource's schema."}}; 788b5c07418SJames Feist } 789b5c07418SJames Feist 790b5c07418SJames Feist void resourceTypeIncompatible(crow::Response& res, const std::string& arg1, 791b5c07418SJames Feist const std::string& arg2) 792b5c07418SJames Feist { 793b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 794b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 795cc9139ecSJason M. Bills } 796cc9139ecSJason M. Bills 797cc9139ecSJason M. Bills /** 798cc9139ecSJason M. Bills * @internal 799684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 800684bb4b8SJason M. Bills * 801684bb4b8SJason M. Bills * See header file for more information 802684bb4b8SJason M. Bills * @endinternal 803684bb4b8SJason M. Bills */ 804684bb4b8SJason M. Bills nlohmann::json resetRequired(const std::string& arg1, const std::string& arg2) 805684bb4b8SJason M. Bills { 806684bb4b8SJason M. Bills return nlohmann::json{ 8073e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 808684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResetRequired"}, 809684bb4b8SJason M. Bills {"Message", "In order to complete the operation, a component reset is " 810684bb4b8SJason M. Bills "required with the Reset action URI '" + 811684bb4b8SJason M. Bills arg1 + "' and ResetType '" + arg2 + "'."}, 812684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 813684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 814684bb4b8SJason M. Bills {"Resolution", 815684bb4b8SJason M. Bills "Perform the required Reset action on the specified component."}}; 816684bb4b8SJason M. Bills } 817684bb4b8SJason M. Bills 818684bb4b8SJason M. Bills void resetRequired(crow::Response& res, const std::string& arg1, 819684bb4b8SJason M. Bills const std::string& arg2) 820684bb4b8SJason M. Bills { 821684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 822684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 823684bb4b8SJason M. Bills } 824684bb4b8SJason M. Bills 825684bb4b8SJason M. Bills /** 826684bb4b8SJason M. Bills * @internal 827684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 828684bb4b8SJason M. Bills * 829684bb4b8SJason M. Bills * See header file for more information 830684bb4b8SJason M. Bills * @endinternal 831684bb4b8SJason M. Bills */ 832684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOnRequired(const std::string& arg1) 833684bb4b8SJason M. Bills { 834684bb4b8SJason M. Bills return nlohmann::json{ 8353e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 836684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOnRequired"}, 837684bb4b8SJason M. Bills {"Message", "The Chassis with Id '" + arg1 + 838684bb4b8SJason M. Bills "' requires to be powered on to perform this request."}, 839684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 840684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 841684bb4b8SJason M. Bills {"Resolution", 842684bb4b8SJason M. Bills "Power on the specified Chassis and resubmit the request."}}; 843684bb4b8SJason M. Bills } 844684bb4b8SJason M. Bills 845684bb4b8SJason M. Bills void chassisPowerStateOnRequired(crow::Response& res, const std::string& arg1) 846684bb4b8SJason M. Bills { 847684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 848684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 849684bb4b8SJason M. Bills } 850684bb4b8SJason M. Bills 851684bb4b8SJason M. Bills /** 852684bb4b8SJason M. Bills * @internal 853684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 854684bb4b8SJason M. Bills * 855684bb4b8SJason M. Bills * See header file for more information 856684bb4b8SJason M. Bills * @endinternal 857684bb4b8SJason M. Bills */ 858684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOffRequired(const std::string& arg1) 859684bb4b8SJason M. Bills { 860684bb4b8SJason M. Bills return nlohmann::json{ 8613e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 862684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOffRequired"}, 863684bb4b8SJason M. Bills {"Message", 864684bb4b8SJason M. Bills "The Chassis with Id '" + arg1 + 865684bb4b8SJason M. Bills "' requires to be powered off to perform this request."}, 866684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 867684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 868684bb4b8SJason M. Bills {"Resolution", 869684bb4b8SJason M. Bills "Power off the specified Chassis and resubmit the request."}}; 870684bb4b8SJason M. Bills } 871684bb4b8SJason M. Bills 872684bb4b8SJason M. Bills void chassisPowerStateOffRequired(crow::Response& res, const std::string& arg1) 873684bb4b8SJason M. Bills { 874684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 875684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 876684bb4b8SJason M. Bills } 877684bb4b8SJason M. Bills 878684bb4b8SJason M. Bills /** 879684bb4b8SJason M. Bills * @internal 880684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 881684bb4b8SJason M. Bills * 882684bb4b8SJason M. Bills * See header file for more information 883684bb4b8SJason M. Bills * @endinternal 884684bb4b8SJason M. Bills */ 885684bb4b8SJason M. Bills nlohmann::json propertyValueConflict(const std::string& arg1, 886684bb4b8SJason M. Bills const std::string& arg2) 887684bb4b8SJason M. Bills { 888684bb4b8SJason M. Bills return nlohmann::json{ 8893e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 890684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueConflict"}, 891684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 892684bb4b8SJason M. Bills "' could not be written because its value would " 893684bb4b8SJason M. Bills "conflict with the value of the '" + 894684bb4b8SJason M. Bills arg2 + "' property."}, 895684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 896684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 897684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 898684bb4b8SJason M. Bills } 899684bb4b8SJason M. Bills 900684bb4b8SJason M. Bills void propertyValueConflict(crow::Response& res, const std::string& arg1, 901684bb4b8SJason M. Bills const std::string& arg2) 902684bb4b8SJason M. Bills { 903684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 904684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 905684bb4b8SJason M. Bills } 906684bb4b8SJason M. Bills 907684bb4b8SJason M. Bills /** 908684bb4b8SJason M. Bills * @internal 909684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 910684bb4b8SJason M. Bills * 911684bb4b8SJason M. Bills * See header file for more information 912684bb4b8SJason M. Bills * @endinternal 913684bb4b8SJason M. Bills */ 914684bb4b8SJason M. Bills nlohmann::json propertyValueIncorrect(const std::string& arg1, 915684bb4b8SJason M. Bills const std::string& arg2) 916684bb4b8SJason M. Bills { 917684bb4b8SJason M. Bills return nlohmann::json{ 9183e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 919684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueIncorrect"}, 920684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 921684bb4b8SJason M. Bills "' with the requested value of '" + arg2 + 922684bb4b8SJason M. Bills "' could not be written because the value does not " 923684bb4b8SJason M. Bills "meet the constraints of the implementation."}, 924684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 925684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 926684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 927684bb4b8SJason M. Bills } 928684bb4b8SJason M. Bills 929684bb4b8SJason M. Bills void propertyValueIncorrect(crow::Response& res, const std::string& arg1, 930684bb4b8SJason M. Bills const std::string& arg2) 931684bb4b8SJason M. Bills { 932684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 933684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 934684bb4b8SJason M. Bills } 935684bb4b8SJason M. Bills 936684bb4b8SJason M. Bills /** 937684bb4b8SJason M. Bills * @internal 938684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 939684bb4b8SJason M. Bills * 940684bb4b8SJason M. Bills * See header file for more information 941684bb4b8SJason M. Bills * @endinternal 942684bb4b8SJason M. Bills */ 943684bb4b8SJason M. Bills nlohmann::json resourceCreationConflict(const std::string& arg1) 944684bb4b8SJason M. Bills { 945684bb4b8SJason M. Bills return nlohmann::json{ 9463e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 947684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceCreationConflict"}, 948684bb4b8SJason M. Bills {"Message", "The resource could not be created. The service has a " 949684bb4b8SJason M. Bills "resource at URI '" + 950684bb4b8SJason M. Bills arg1 + "' that conflicts with the creation request."}, 951684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 952684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 953684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 954684bb4b8SJason M. Bills } 955684bb4b8SJason M. Bills 956684bb4b8SJason M. Bills void resourceCreationConflict(crow::Response& res, const std::string& arg1) 957684bb4b8SJason M. Bills { 958684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 959684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 960684bb4b8SJason M. Bills } 961684bb4b8SJason M. Bills 962684bb4b8SJason M. Bills /** 963684bb4b8SJason M. Bills * @internal 964684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 965684bb4b8SJason M. Bills * 966684bb4b8SJason M. Bills * See header file for more information 967684bb4b8SJason M. Bills * @endinternal 968684bb4b8SJason M. Bills */ 969684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 970684bb4b8SJason M. Bills { 971684bb4b8SJason M. Bills return nlohmann::json{ 9723e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 973684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.MaximumErrorsExceeded"}, 974684bb4b8SJason M. Bills {"Message", "Too many errors have occurred to report them all."}, 975684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 976684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 977684bb4b8SJason M. Bills {"Resolution", 978684bb4b8SJason M. Bills "Resolve other reported errors and retry the current operation."}}; 979684bb4b8SJason M. Bills } 980684bb4b8SJason M. Bills 981684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 982684bb4b8SJason M. Bills { 983684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 984684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 985684bb4b8SJason M. Bills } 986684bb4b8SJason M. Bills 987684bb4b8SJason M. Bills /** 988684bb4b8SJason M. Bills * @internal 989684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 990684bb4b8SJason M. Bills * 991684bb4b8SJason M. Bills * See header file for more information 992684bb4b8SJason M. Bills * @endinternal 993684bb4b8SJason M. Bills */ 994684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 995684bb4b8SJason M. Bills { 996684bb4b8SJason M. Bills return nlohmann::json{ 9973e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 998684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionFailed"}, 999684bb4b8SJason M. Bills {"Message", "The ETag supplied did not match the ETag required to " 1000684bb4b8SJason M. Bills "change this resource."}, 1001684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1002684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1003684bb4b8SJason M. Bills {"Resolution", "Try the operation again using the appropriate ETag."}}; 1004684bb4b8SJason M. Bills } 1005684bb4b8SJason M. Bills 1006684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 1007684bb4b8SJason M. Bills { 10084df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 1009684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1010684bb4b8SJason M. Bills } 1011684bb4b8SJason M. Bills 1012684bb4b8SJason M. Bills /** 1013684bb4b8SJason M. Bills * @internal 1014684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 1015684bb4b8SJason M. Bills * 1016684bb4b8SJason M. Bills * See header file for more information 1017684bb4b8SJason M. Bills * @endinternal 1018684bb4b8SJason M. Bills */ 1019684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 1020684bb4b8SJason M. Bills { 1021684bb4b8SJason M. Bills return nlohmann::json{ 10223e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1023684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionRequired"}, 1024684bb4b8SJason M. Bills {"Message", "A precondition header or annotation is required to change " 1025684bb4b8SJason M. Bills "this resource."}, 1026684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1027684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1028684bb4b8SJason M. Bills {"Resolution", "Try the operation again using an If-Match or " 1029684bb4b8SJason M. Bills "If-None-Match header and appropriate ETag."}}; 1030684bb4b8SJason M. Bills } 1031684bb4b8SJason M. Bills 1032684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 1033684bb4b8SJason M. Bills { 1034684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1035684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1036684bb4b8SJason M. Bills } 1037684bb4b8SJason M. Bills 1038684bb4b8SJason M. Bills /** 1039684bb4b8SJason M. Bills * @internal 1040684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 1041684bb4b8SJason M. Bills * 1042684bb4b8SJason M. Bills * See header file for more information 1043684bb4b8SJason M. Bills * @endinternal 1044684bb4b8SJason M. Bills */ 1045684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 1046684bb4b8SJason M. Bills { 1047684bb4b8SJason M. Bills return nlohmann::json{ 10483e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1049684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationFailed"}, 1050684bb4b8SJason M. Bills {"Message", 1051684bb4b8SJason M. Bills "An error occurred internal to the service as part of the overall " 1052684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1053684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1054684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1055684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1056684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1057684bb4b8SJason M. Bills } 1058684bb4b8SJason M. Bills 1059684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 1060684bb4b8SJason M. Bills { 1061684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1062684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 1063684bb4b8SJason M. Bills } 1064684bb4b8SJason M. Bills 1065684bb4b8SJason M. Bills /** 1066684bb4b8SJason M. Bills * @internal 1067684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 1068684bb4b8SJason M. Bills * 1069684bb4b8SJason M. Bills * See header file for more information 1070684bb4b8SJason M. Bills * @endinternal 1071684bb4b8SJason M. Bills */ 1072684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 1073684bb4b8SJason M. Bills { 1074684bb4b8SJason M. Bills return nlohmann::json{ 10753e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1076684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationTimeout"}, 1077684bb4b8SJason M. Bills {"Message", "A timeout internal to the service occured as part of the " 1078684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1079684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1080684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1081684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1082684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1083684bb4b8SJason M. Bills } 1084684bb4b8SJason M. Bills 1085684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 1086684bb4b8SJason M. Bills { 1087684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1088684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 1089684bb4b8SJason M. Bills } 1090684bb4b8SJason M. Bills 1091684bb4b8SJason M. Bills /** 1092684bb4b8SJason M. Bills * @internal 1093f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 1094f12894f8SJason M. Bills * property 1095f12894f8SJason M. Bills * 1096f12894f8SJason M. Bills * See header file for more information 1097f12894f8SJason M. Bills * @endinternal 1098f12894f8SJason M. Bills */ 1099b5c07418SJames Feist nlohmann::json propertyValueTypeError(const std::string& arg1, 1100a08b46ccSJason M. Bills const std::string& arg2) 1101f12894f8SJason M. Bills { 1102b5c07418SJames Feist return nlohmann::json{ 11033e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1104684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueTypeError"}, 1105f12894f8SJason M. Bills {"Message", 1106f12894f8SJason M. Bills "The value " + arg1 + " for the property " + arg2 + 1107f12894f8SJason M. Bills " is of a different type than the property can accept."}, 110885659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1109684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 111066ac2b8cSJason M. Bills {"Resolution", 111166ac2b8cSJason M. Bills "Correct the value for the property in the request body and " 1112b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1113b5c07418SJames Feist } 1114b5c07418SJames Feist 1115b5c07418SJames Feist void propertyValueTypeError(crow::Response& res, const std::string& arg1, 1116b5c07418SJames Feist const std::string& arg2) 1117b5c07418SJames Feist { 1118b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1119b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 1120f4c4dcf4SKowalski, Kamil } 1121f4c4dcf4SKowalski, Kamil 1122f4c4dcf4SKowalski, Kamil /** 1123f4c4dcf4SKowalski, Kamil * @internal 1124f4c4dcf4SKowalski, Kamil * @brief Formats ResourceNotFound message into JSON 1125f4c4dcf4SKowalski, Kamil * 1126f4c4dcf4SKowalski, Kamil * See header file for more information 1127f4c4dcf4SKowalski, Kamil * @endinternal 1128f4c4dcf4SKowalski, Kamil */ 1129b5c07418SJames Feist nlohmann::json resourceNotFound(const std::string& arg1, 11301abe55efSEd Tanous const std::string& arg2) 11311abe55efSEd Tanous { 1132b5c07418SJames Feist return nlohmann::json{ 11333e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1134684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceNotFound"}, 11351abe55efSEd Tanous {"Message", "The requested resource of type " + arg1 + " named " + 11361abe55efSEd Tanous arg2 + " was not found."}, 113785659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1138684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1139f4c4dcf4SKowalski, Kamil {"Resolution", 1140b5c07418SJames Feist "Provide a valid resource identifier and resubmit the request."}}; 1141b5c07418SJames Feist } 1142b5c07418SJames Feist 1143b5c07418SJames Feist void resourceNotFound(crow::Response& res, const std::string& arg1, 1144b5c07418SJames Feist const std::string& arg2) 1145b5c07418SJames Feist { 1146b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1147b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1148f4c4dcf4SKowalski, Kamil } 1149f4c4dcf4SKowalski, Kamil 1150f4c4dcf4SKowalski, Kamil /** 1151f4c4dcf4SKowalski, Kamil * @internal 1152f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1153f4c4dcf4SKowalski, Kamil * 1154f4c4dcf4SKowalski, Kamil * See header file for more information 1155f4c4dcf4SKowalski, Kamil * @endinternal 1156f4c4dcf4SKowalski, Kamil */ 1157b5c07418SJames Feist nlohmann::json couldNotEstablishConnection(const std::string& arg1) 11581abe55efSEd Tanous { 1159b5c07418SJames Feist return nlohmann::json{ 11603e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1161684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CouldNotEstablishConnection"}, 11621abe55efSEd Tanous {"Message", 1163684bb4b8SJason M. Bills "The service failed to establish a connection with the URI " + arg1 + 1164b5c07418SJames Feist "."}, 116585659adfSJason M. Bills {"MessageArgs", {arg1}}, 1166684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 116766ac2b8cSJason M. Bills {"Resolution", 116866ac2b8cSJason M. Bills "Ensure that the URI contains a valid and reachable node name, " 1169b5c07418SJames Feist "protocol information and other URI components."}}; 1170b5c07418SJames Feist } 1171b5c07418SJames Feist 1172b5c07418SJames Feist void couldNotEstablishConnection(crow::Response& res, const std::string& arg1) 1173b5c07418SJames Feist { 1174b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1175b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1176f4c4dcf4SKowalski, Kamil } 1177f4c4dcf4SKowalski, Kamil 1178f4c4dcf4SKowalski, Kamil /** 1179f4c4dcf4SKowalski, Kamil * @internal 1180f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1181f12894f8SJason M. Bills * property 1182f12894f8SJason M. Bills * 1183f12894f8SJason M. Bills * See header file for more information 1184f12894f8SJason M. Bills * @endinternal 1185f12894f8SJason M. Bills */ 1186b5c07418SJames Feist nlohmann::json propertyNotWritable(const std::string& arg1) 1187f12894f8SJason M. Bills { 1188b5c07418SJames Feist return nlohmann::json{ 11893e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1190684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyNotWritable"}, 1191b5c07418SJames Feist {"Message", "The property " + arg1 + 1192b5c07418SJames Feist " is a read only property and cannot be " 1193b5c07418SJames Feist "assigned a value."}, 119485659adfSJason M. Bills {"MessageArgs", {arg1}}, 1195684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 119666ac2b8cSJason M. Bills {"Resolution", "Remove the property from the request body and " 1197b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1198b5c07418SJames Feist } 1199b5c07418SJames Feist 1200b5c07418SJames Feist void propertyNotWritable(crow::Response& res, const std::string& arg1) 1201b5c07418SJames Feist { 1202b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1203b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1204f4c4dcf4SKowalski, Kamil } 1205f4c4dcf4SKowalski, Kamil 1206f4c4dcf4SKowalski, Kamil /** 1207f4c4dcf4SKowalski, Kamil * @internal 1208f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1209f4c4dcf4SKowalski, Kamil * 1210f4c4dcf4SKowalski, Kamil * See header file for more information 1211f4c4dcf4SKowalski, Kamil * @endinternal 1212f4c4dcf4SKowalski, Kamil */ 1213b5c07418SJames Feist nlohmann::json queryParameterValueTypeError(const std::string& arg1, 12141abe55efSEd Tanous const std::string& arg2) 12151abe55efSEd Tanous { 1216b5c07418SJames Feist return nlohmann::json{ 12173e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1218684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueTypeError"}, 12191abe55efSEd Tanous {"Message", 12201abe55efSEd Tanous "The value " + arg1 + " for the query parameter " + arg2 + 1221f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 122285659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1223684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 122466ac2b8cSJason M. Bills {"Resolution", 122566ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1226b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1227b5c07418SJames Feist } 1228b5c07418SJames Feist 1229b5c07418SJames Feist void queryParameterValueTypeError(crow::Response& res, const std::string& arg1, 1230b5c07418SJames Feist const std::string& arg2) 1231b5c07418SJames Feist { 1232b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1233b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1234b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1235f4c4dcf4SKowalski, Kamil } 1236f4c4dcf4SKowalski, Kamil 1237f4c4dcf4SKowalski, Kamil /** 1238f4c4dcf4SKowalski, Kamil * @internal 1239f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1240f4c4dcf4SKowalski, Kamil * 1241f4c4dcf4SKowalski, Kamil * See header file for more information 1242f4c4dcf4SKowalski, Kamil * @endinternal 1243f4c4dcf4SKowalski, Kamil */ 1244b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 12451abe55efSEd Tanous { 1246b5c07418SJames Feist return nlohmann::json{ 12473e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1248684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceShuttingDown"}, 1249f12894f8SJason M. Bills {"Message", "The operation failed because the service is shutting " 125066ac2b8cSJason M. Bills "down and can no longer take incoming requests."}, 125185659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1252684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 125366ac2b8cSJason M. Bills {"Resolution", "When the service becomes available, resubmit the " 1254b5c07418SJames Feist "request if the operation failed."}}; 1255b5c07418SJames Feist } 1256b5c07418SJames Feist 1257b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1258b5c07418SJames Feist { 1259b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1260b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1261f4c4dcf4SKowalski, Kamil } 1262f4c4dcf4SKowalski, Kamil 1263f4c4dcf4SKowalski, Kamil /** 1264f4c4dcf4SKowalski, Kamil * @internal 1265f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1266f4c4dcf4SKowalski, Kamil * 1267f4c4dcf4SKowalski, Kamil * See header file for more information 1268f4c4dcf4SKowalski, Kamil * @endinternal 1269f4c4dcf4SKowalski, Kamil */ 1270b5c07418SJames Feist nlohmann::json actionParameterDuplicate(const std::string& arg1, 12711abe55efSEd Tanous const std::string& arg2) 12721abe55efSEd Tanous { 1273b5c07418SJames Feist return nlohmann::json{ 12743e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1275684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterDuplicate"}, 1276f4c4dcf4SKowalski, Kamil {"Message", 1277f4c4dcf4SKowalski, Kamil "The action " + arg1 + 12781abe55efSEd Tanous " was submitted with more than one value for the parameter " + 12791abe55efSEd Tanous arg2 + "."}, 128085659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1281684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 128266ac2b8cSJason M. Bills {"Resolution", 128366ac2b8cSJason M. Bills "Resubmit the action with only one instance of the parameter in " 1284b5c07418SJames Feist "the request body if the operation failed."}}; 1285b5c07418SJames Feist } 1286b5c07418SJames Feist 1287b5c07418SJames Feist void actionParameterDuplicate(crow::Response& res, const std::string& arg1, 1288b5c07418SJames Feist const std::string& arg2) 1289b5c07418SJames Feist { 1290b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1291b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1292f4c4dcf4SKowalski, Kamil } 1293f4c4dcf4SKowalski, Kamil 1294f4c4dcf4SKowalski, Kamil /** 1295f4c4dcf4SKowalski, Kamil * @internal 1296f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1297f4c4dcf4SKowalski, Kamil * 1298f4c4dcf4SKowalski, Kamil * See header file for more information 1299f4c4dcf4SKowalski, Kamil * @endinternal 1300f4c4dcf4SKowalski, Kamil */ 1301b5c07418SJames Feist nlohmann::json actionParameterNotSupported(const std::string& arg1, 13021abe55efSEd Tanous const std::string& arg2) 13031abe55efSEd Tanous { 1304b5c07418SJames Feist return nlohmann::json{ 13053e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1306684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterNotSupported"}, 1307f4c4dcf4SKowalski, Kamil {"Message", "The parameter " + arg1 + " for the action " + arg2 + 1308f4c4dcf4SKowalski, Kamil " is not supported on the target resource."}, 130985659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1310684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 131166ac2b8cSJason M. Bills {"Resolution", "Remove the parameter supplied and resubmit the " 1312b5c07418SJames Feist "request if the operation failed."}}; 1313b5c07418SJames Feist } 1314b5c07418SJames Feist 1315b5c07418SJames Feist void actionParameterNotSupported(crow::Response& res, const std::string& arg1, 1316b5c07418SJames Feist const std::string& arg2) 1317b5c07418SJames Feist { 1318b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1319b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1320b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1321f4c4dcf4SKowalski, Kamil } 1322f4c4dcf4SKowalski, Kamil 1323f4c4dcf4SKowalski, Kamil /** 1324f4c4dcf4SKowalski, Kamil * @internal 1325f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1326f4c4dcf4SKowalski, Kamil * 1327f4c4dcf4SKowalski, Kamil * See header file for more information 1328f4c4dcf4SKowalski, Kamil * @endinternal 1329f4c4dcf4SKowalski, Kamil */ 1330b5c07418SJames Feist nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1, 13311abe55efSEd Tanous const std::string& arg2) 13321abe55efSEd Tanous { 1333b5c07418SJames Feist return nlohmann::json{ 13343e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1335684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SourceDoesNotSupportProtocol"}, 1336684bb4b8SJason M. Bills {"Message", "The other end of the connection at " + arg1 + 13371abe55efSEd Tanous " does not support the specified protocol " + arg2 + 13381abe55efSEd Tanous "."}, 133985659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1340684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1341b5c07418SJames Feist {"Resolution", "Change protocols or URIs. "}}; 1342b5c07418SJames Feist } 1343b5c07418SJames Feist 1344b5c07418SJames Feist void sourceDoesNotSupportProtocol(crow::Response& res, const std::string& arg1, 1345b5c07418SJames Feist const std::string& arg2) 1346b5c07418SJames Feist { 1347b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1348b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1349b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1350f4c4dcf4SKowalski, Kamil } 1351f4c4dcf4SKowalski, Kamil 1352f4c4dcf4SKowalski, Kamil /** 1353f4c4dcf4SKowalski, Kamil * @internal 1354f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1355f4c4dcf4SKowalski, Kamil * 1356f4c4dcf4SKowalski, Kamil * See header file for more information 1357f4c4dcf4SKowalski, Kamil * @endinternal 1358f4c4dcf4SKowalski, Kamil */ 1359b5c07418SJames Feist nlohmann::json accountRemoved(void) 13601abe55efSEd Tanous { 13613e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1362684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountRemoved"}, 1363f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully removed."}, 136485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1365684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1366b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1367b5c07418SJames Feist } 1368b5c07418SJames Feist 1369b5c07418SJames Feist void accountRemoved(crow::Response& res) 1370b5c07418SJames Feist { 1371b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1372b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1373f4c4dcf4SKowalski, Kamil } 1374f4c4dcf4SKowalski, Kamil 1375f4c4dcf4SKowalski, Kamil /** 1376f4c4dcf4SKowalski, Kamil * @internal 1377f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1378f4c4dcf4SKowalski, Kamil * 1379f4c4dcf4SKowalski, Kamil * See header file for more information 1380f4c4dcf4SKowalski, Kamil * @endinternal 1381f4c4dcf4SKowalski, Kamil */ 1382b5c07418SJames Feist nlohmann::json accessDenied(const std::string& arg1) 13831abe55efSEd Tanous { 1384b5c07418SJames Feist return nlohmann::json{ 13853e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1386684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccessDenied"}, 1387684bb4b8SJason M. Bills {"Message", "While attempting to establish a connection to " + arg1 + 1388b5c07418SJames Feist ", the service denied access."}, 138985659adfSJason M. Bills {"MessageArgs", {arg1}}, 1390684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 139166ac2b8cSJason M. Bills {"Resolution", "Attempt to ensure that the URI is correct and that " 1392b5c07418SJames Feist "the service has the appropriate credentials."}}; 1393b5c07418SJames Feist } 1394b5c07418SJames Feist 1395b5c07418SJames Feist void accessDenied(crow::Response& res, const std::string& arg1) 1396b5c07418SJames Feist { 1397b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1398b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1399f4c4dcf4SKowalski, Kamil } 1400f4c4dcf4SKowalski, Kamil 1401f4c4dcf4SKowalski, Kamil /** 1402f4c4dcf4SKowalski, Kamil * @internal 1403f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1404f4c4dcf4SKowalski, Kamil * 1405f4c4dcf4SKowalski, Kamil * See header file for more information 1406f4c4dcf4SKowalski, Kamil * @endinternal 1407f4c4dcf4SKowalski, Kamil */ 1408b5c07418SJames Feist nlohmann::json queryNotSupported(void) 14091abe55efSEd Tanous { 1410b5c07418SJames Feist return nlohmann::json{ 14113e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1412684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupported"}, 1413f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported by the implementation."}, 141485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1415684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 141666ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1417b5c07418SJames Feist "request if the operation failed."}}; 1418b5c07418SJames Feist } 1419b5c07418SJames Feist 1420b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1421b5c07418SJames Feist { 1422b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1423b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1424f4c4dcf4SKowalski, Kamil } 1425f4c4dcf4SKowalski, Kamil 1426f4c4dcf4SKowalski, Kamil /** 1427f4c4dcf4SKowalski, Kamil * @internal 1428f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1429f4c4dcf4SKowalski, Kamil * 1430f4c4dcf4SKowalski, Kamil * See header file for more information 1431f4c4dcf4SKowalski, Kamil * @endinternal 1432f4c4dcf4SKowalski, Kamil */ 1433b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 14341abe55efSEd Tanous { 1435b5c07418SJames Feist return nlohmann::json{ 14363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1437684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CreateLimitReachedForResource"}, 14381abe55efSEd Tanous {"Message", "The create operation failed because the resource has " 143966ac2b8cSJason M. Bills "reached the limit of possible resources."}, 144085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1441684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 144266ac2b8cSJason M. Bills {"Resolution", 144366ac2b8cSJason M. Bills "Either delete resources and resubmit the request if the " 1444b5c07418SJames Feist "operation failed or do not resubmit the request."}}; 1445b5c07418SJames Feist } 1446b5c07418SJames Feist 1447b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1448b5c07418SJames Feist { 1449b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1450b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1451f4c4dcf4SKowalski, Kamil } 1452f4c4dcf4SKowalski, Kamil 1453f4c4dcf4SKowalski, Kamil /** 1454f4c4dcf4SKowalski, Kamil * @internal 1455f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1456f4c4dcf4SKowalski, Kamil * 1457f4c4dcf4SKowalski, Kamil * See header file for more information 1458f4c4dcf4SKowalski, Kamil * @endinternal 1459f4c4dcf4SKowalski, Kamil */ 1460b5c07418SJames Feist nlohmann::json generalError(void) 14611abe55efSEd Tanous { 14623e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1463684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.GeneralError"}, 1464b7e069efSJames Feist {"Message", 1465b7e069efSJames Feist "A general error has occurred. See Resolution for " 1466cc9139ecSJason M. Bills "information on how to resolve the error."}, 146785659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1468684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1469b5c07418SJames Feist {"Resolution", "None."}}; 1470b5c07418SJames Feist } 1471b5c07418SJames Feist 1472b5c07418SJames Feist void generalError(crow::Response& res) 1473b5c07418SJames Feist { 1474b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1475b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1476f4c4dcf4SKowalski, Kamil } 1477f4c4dcf4SKowalski, Kamil 1478f4c4dcf4SKowalski, Kamil /** 1479f4c4dcf4SKowalski, Kamil * @internal 1480f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1481f4c4dcf4SKowalski, Kamil * 1482f4c4dcf4SKowalski, Kamil * See header file for more information 1483f4c4dcf4SKowalski, Kamil * @endinternal 1484f4c4dcf4SKowalski, Kamil */ 1485b5c07418SJames Feist nlohmann::json success(void) 14861abe55efSEd Tanous { 14873e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1488684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Success"}, 1489f4c4dcf4SKowalski, Kamil {"Message", "Successfully Completed Request"}, 149085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1491684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1492b5c07418SJames Feist {"Resolution", "None"}}; 1493b5c07418SJames Feist } 1494b5c07418SJames Feist 1495b5c07418SJames Feist void success(crow::Response& res) 1496b5c07418SJames Feist { 1497b5c07418SJames Feist // don't set res.result here because success is the default and any 1498b5c07418SJames Feist // error should overwrite the default 1499b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1500f12894f8SJason M. Bills } 1501f12894f8SJason M. Bills 1502f12894f8SJason M. Bills /** 1503f12894f8SJason M. Bills * @internal 1504f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1505f4c4dcf4SKowalski, Kamil * 1506f4c4dcf4SKowalski, Kamil * See header file for more information 1507f4c4dcf4SKowalski, Kamil * @endinternal 1508f4c4dcf4SKowalski, Kamil */ 1509b5c07418SJames Feist nlohmann::json created(void) 15101abe55efSEd Tanous { 1511b5c07418SJames Feist return nlohmann::json{ 15123e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1513684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Created"}, 1514f4c4dcf4SKowalski, Kamil {"Message", "The resource has been created successfully"}, 151585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1516684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1517b5c07418SJames Feist {"Resolution", "None"}}; 1518b5c07418SJames Feist } 1519b5c07418SJames Feist 1520b5c07418SJames Feist void created(crow::Response& res) 1521b5c07418SJames Feist { 1522b5c07418SJames Feist res.result(boost::beast::http::status::created); 1523b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1524f4c4dcf4SKowalski, Kamil } 1525f4c4dcf4SKowalski, Kamil 1526f4c4dcf4SKowalski, Kamil /** 1527f4c4dcf4SKowalski, Kamil * @internal 1528cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1529cc9139ecSJason M. Bills * 1530cc9139ecSJason M. Bills * See header file for more information 1531cc9139ecSJason M. Bills * @endinternal 1532cc9139ecSJason M. Bills */ 1533b5c07418SJames Feist nlohmann::json noOperation(void) 1534cc9139ecSJason M. Bills { 1535b5c07418SJames Feist return nlohmann::json{ 15363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1537684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoOperation"}, 1538cc9139ecSJason M. Bills {"Message", "The request body submitted contain no data to act " 1539cc9139ecSJason M. Bills "upon and no changes to the resource took place."}, 154085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1541684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1542cc9139ecSJason M. Bills {"Resolution", 1543b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1544b5c07418SJames Feist } 1545b5c07418SJames Feist 1546b5c07418SJames Feist void noOperation(crow::Response& res) 1547b5c07418SJames Feist { 1548b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1549b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1550cc9139ecSJason M. Bills } 1551cc9139ecSJason M. Bills 1552cc9139ecSJason M. Bills /** 1553cc9139ecSJason M. Bills * @internal 1554b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1555b5c07418SJames Feist * property 1556f12894f8SJason M. Bills * 1557f12894f8SJason M. Bills * See header file for more information 1558f12894f8SJason M. Bills * @endinternal 1559f12894f8SJason M. Bills */ 1560b5c07418SJames Feist nlohmann::json propertyUnknown(const std::string& arg1) 1561b5c07418SJames Feist { 1562b5c07418SJames Feist return nlohmann::json{ 15633e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1564684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyUnknown"}, 1565b5c07418SJames Feist {"Message", "The property " + arg1 + 1566b5c07418SJames Feist " is not in the list of valid properties for " 1567b5c07418SJames Feist "the resource."}, 1568b5c07418SJames Feist {"MessageArgs", {arg1}}, 1569684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1570b5c07418SJames Feist {"Resolution", "Remove the unknown property from the request " 1571b5c07418SJames Feist "body and resubmit " 1572b5c07418SJames Feist "the request if the operation failed."}}; 1573b5c07418SJames Feist } 1574b5c07418SJames Feist 1575a08b46ccSJason M. Bills void propertyUnknown(crow::Response& res, const std::string& arg1) 1576f12894f8SJason M. Bills { 1577f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1578b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1); 1579f4c4dcf4SKowalski, Kamil } 1580f4c4dcf4SKowalski, Kamil 1581f4c4dcf4SKowalski, Kamil /** 1582f4c4dcf4SKowalski, Kamil * @internal 1583f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1584f4c4dcf4SKowalski, Kamil * 1585f4c4dcf4SKowalski, Kamil * See header file for more information 1586f4c4dcf4SKowalski, Kamil * @endinternal 1587f4c4dcf4SKowalski, Kamil */ 1588b5c07418SJames Feist nlohmann::json noValidSession(void) 15891abe55efSEd Tanous { 1590b5c07418SJames Feist return nlohmann::json{ 15913e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1592684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoValidSession"}, 1593f4c4dcf4SKowalski, Kamil {"Message", 1594f4c4dcf4SKowalski, Kamil "There is no valid session established with the implementation."}, 159585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1596684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 15971abe55efSEd Tanous {"Resolution", 1598684bb4b8SJason M. Bills "Establish a session before attempting any operations."}}; 1599b5c07418SJames Feist } 1600b5c07418SJames Feist 1601b5c07418SJames Feist void noValidSession(crow::Response& res) 1602b5c07418SJames Feist { 1603b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1604b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1605f4c4dcf4SKowalski, Kamil } 1606f4c4dcf4SKowalski, Kamil 1607f4c4dcf4SKowalski, Kamil /** 1608f4c4dcf4SKowalski, Kamil * @internal 1609f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1610f4c4dcf4SKowalski, Kamil * 1611f4c4dcf4SKowalski, Kamil * See header file for more information 1612f4c4dcf4SKowalski, Kamil * @endinternal 1613f4c4dcf4SKowalski, Kamil */ 1614b5c07418SJames Feist nlohmann::json invalidObject(const std::string& arg1) 16151abe55efSEd Tanous { 1616b5c07418SJames Feist return nlohmann::json{ 16173e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1618684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidObject"}, 1619f4c4dcf4SKowalski, Kamil {"Message", "The object at " + arg1 + " is invalid."}, 162085659adfSJason M. Bills {"MessageArgs", {arg1}}, 1621684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1622f12894f8SJason M. Bills {"Resolution", 162366ac2b8cSJason M. Bills "Either the object is malformed or the URI is not correct. " 1624b5c07418SJames Feist "Correct the condition and resubmit the request if it failed."}}; 1625b5c07418SJames Feist } 1626b5c07418SJames Feist 1627b5c07418SJames Feist void invalidObject(crow::Response& res, const std::string& arg1) 1628b5c07418SJames Feist { 1629b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1630b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1631f4c4dcf4SKowalski, Kamil } 1632f4c4dcf4SKowalski, Kamil 1633f4c4dcf4SKowalski, Kamil /** 1634f4c4dcf4SKowalski, Kamil * @internal 1635f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1636f4c4dcf4SKowalski, Kamil * 1637f4c4dcf4SKowalski, Kamil * See header file for more information 1638f4c4dcf4SKowalski, Kamil * @endinternal 1639f4c4dcf4SKowalski, Kamil */ 1640b5c07418SJames Feist nlohmann::json resourceInStandby(void) 16411abe55efSEd Tanous { 1642b5c07418SJames Feist return nlohmann::json{ 16433e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1644684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceInStandby"}, 164566ac2b8cSJason M. Bills {"Message", "The request could not be performed because the " 164666ac2b8cSJason M. Bills "resource is in standby."}, 164785659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1648684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1649f12894f8SJason M. Bills {"Resolution", "Ensure that the resource is in the correct power " 1650b5c07418SJames Feist "state and resubmit the request."}}; 1651b5c07418SJames Feist } 1652b5c07418SJames Feist 1653b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1654b5c07418SJames Feist { 1655b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1656b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1657f4c4dcf4SKowalski, Kamil } 1658f4c4dcf4SKowalski, Kamil 1659f4c4dcf4SKowalski, Kamil /** 1660f4c4dcf4SKowalski, Kamil * @internal 1661f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1662f4c4dcf4SKowalski, Kamil * 1663f4c4dcf4SKowalski, Kamil * See header file for more information 1664f4c4dcf4SKowalski, Kamil * @endinternal 1665f4c4dcf4SKowalski, Kamil */ 1666b5c07418SJames Feist nlohmann::json actionParameterValueTypeError(const std::string& arg1, 1667f4c4dcf4SKowalski, Kamil const std::string& arg2, 16681abe55efSEd Tanous const std::string& arg3) 16691abe55efSEd Tanous { 1670b5c07418SJames Feist return nlohmann::json{ 16713e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1672684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterValueTypeError"}, 16731abe55efSEd Tanous {"Message", 16741abe55efSEd Tanous "The value " + arg1 + " for the parameter " + arg2 + 1675f4c4dcf4SKowalski, Kamil " in the action " + arg3 + 1676f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 167785659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 1678684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 167966ac2b8cSJason M. Bills {"Resolution", 168066ac2b8cSJason M. Bills "Correct the value for the parameter in the request body and " 1681b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1682b5c07418SJames Feist } 1683b5c07418SJames Feist 1684b5c07418SJames Feist void actionParameterValueTypeError(crow::Response& res, const std::string& arg1, 1685b5c07418SJames Feist const std::string& arg2, 1686b5c07418SJames Feist const std::string& arg3) 1687b5c07418SJames Feist { 1688b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1689b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1690b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1691f4c4dcf4SKowalski, Kamil } 1692f4c4dcf4SKowalski, Kamil 1693f4c4dcf4SKowalski, Kamil /** 1694f4c4dcf4SKowalski, Kamil * @internal 1695f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1696f4c4dcf4SKowalski, Kamil * 1697f4c4dcf4SKowalski, Kamil * See header file for more information 1698f4c4dcf4SKowalski, Kamil * @endinternal 1699f4c4dcf4SKowalski, Kamil */ 1700b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 17011abe55efSEd Tanous { 1702b5c07418SJames Feist return nlohmann::json{ 17033e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1704684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionLimitExceeded"}, 1705f12894f8SJason M. Bills {"Message", "The session establishment failed due to the number of " 170666ac2b8cSJason M. Bills "simultaneous sessions exceeding the limit of the " 170766ac2b8cSJason M. Bills "implementation."}, 170885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1709684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 171066ac2b8cSJason M. Bills {"Resolution", "Reduce the number of other sessions before trying " 171166ac2b8cSJason M. Bills "to establish the session or increase the limit of " 1712b5c07418SJames Feist "simultaneous sessions (if supported)."}}; 1713b5c07418SJames Feist } 1714b5c07418SJames Feist 1715b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1716b5c07418SJames Feist { 1717b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1718b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1719f4c4dcf4SKowalski, Kamil } 1720f4c4dcf4SKowalski, Kamil 1721f4c4dcf4SKowalski, Kamil /** 1722f4c4dcf4SKowalski, Kamil * @internal 1723f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1724f4c4dcf4SKowalski, Kamil * 1725f4c4dcf4SKowalski, Kamil * See header file for more information 1726f4c4dcf4SKowalski, Kamil * @endinternal 1727f4c4dcf4SKowalski, Kamil */ 1728b5c07418SJames Feist nlohmann::json actionNotSupported(const std::string& arg1) 17291abe55efSEd Tanous { 1730b5c07418SJames Feist return nlohmann::json{ 17313e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1732684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionNotSupported"}, 17331abe55efSEd Tanous {"Message", 17341abe55efSEd Tanous "The action " + arg1 + " is not supported by the resource."}, 173585659adfSJason M. Bills {"MessageArgs", {arg1}}, 1736684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1737f4c4dcf4SKowalski, Kamil {"Resolution", 1738f4c4dcf4SKowalski, Kamil "The action supplied cannot be resubmitted to the implementation. " 1739f12894f8SJason M. Bills " Perhaps the action was invalid, the wrong resource was the " 174066ac2b8cSJason M. Bills "target or the implementation documentation may be of " 1741b5c07418SJames Feist "assistance."}}; 1742b5c07418SJames Feist } 1743b5c07418SJames Feist 1744b5c07418SJames Feist void actionNotSupported(crow::Response& res, const std::string& arg1) 1745b5c07418SJames Feist { 1746b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1747b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1748f4c4dcf4SKowalski, Kamil } 1749f4c4dcf4SKowalski, Kamil 1750f4c4dcf4SKowalski, Kamil /** 1751f4c4dcf4SKowalski, Kamil * @internal 1752f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1753f4c4dcf4SKowalski, Kamil * 1754f4c4dcf4SKowalski, Kamil * See header file for more information 1755f4c4dcf4SKowalski, Kamil * @endinternal 1756f4c4dcf4SKowalski, Kamil */ 17575187e09bSJosh Lehan nlohmann::json invalidIndex(int64_t arg1) 17581abe55efSEd Tanous { 1759b5c07418SJames Feist return nlohmann::json{ 17603e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1761684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidIndex"}, 1762684bb4b8SJason M. Bills {"Message", "The Index " + std::to_string(arg1) + 1763f4c4dcf4SKowalski, Kamil " is not a valid offset into the array."}, 176485659adfSJason M. Bills {"MessageArgs", {std::to_string(arg1)}}, 1765684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1766f12894f8SJason M. Bills {"Resolution", "Verify the index value provided is within the " 1767b5c07418SJames Feist "bounds of the array."}}; 1768b5c07418SJames Feist } 1769b5c07418SJames Feist 17705187e09bSJosh Lehan void invalidIndex(crow::Response& res, int64_t arg1) 1771b5c07418SJames Feist { 1772b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1773b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1774f4c4dcf4SKowalski, Kamil } 1775f4c4dcf4SKowalski, Kamil 1776f4c4dcf4SKowalski, Kamil /** 1777f4c4dcf4SKowalski, Kamil * @internal 1778f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1779f4c4dcf4SKowalski, Kamil * 1780f4c4dcf4SKowalski, Kamil * See header file for more information 1781f4c4dcf4SKowalski, Kamil * @endinternal 1782f4c4dcf4SKowalski, Kamil */ 1783b5c07418SJames Feist nlohmann::json emptyJSON(void) 17841abe55efSEd Tanous { 1785b5c07418SJames Feist return nlohmann::json{ 17863e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1787684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.EmptyJSON"}, 1788f12894f8SJason M. Bills {"Message", "The request body submitted contained an empty JSON " 178966ac2b8cSJason M. Bills "object and the service is unable to process it."}, 179085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1791684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1792f4c4dcf4SKowalski, Kamil {"Resolution", 1793b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1794b5c07418SJames Feist } 1795b5c07418SJames Feist 1796b5c07418SJames Feist void emptyJSON(crow::Response& res) 1797b5c07418SJames Feist { 1798b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1799b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1800f4c4dcf4SKowalski, Kamil } 1801f4c4dcf4SKowalski, Kamil 1802f4c4dcf4SKowalski, Kamil /** 1803f4c4dcf4SKowalski, Kamil * @internal 1804f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1805f4c4dcf4SKowalski, Kamil * 1806f4c4dcf4SKowalski, Kamil * See header file for more information 1807f4c4dcf4SKowalski, Kamil * @endinternal 1808f4c4dcf4SKowalski, Kamil */ 1809b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 18101abe55efSEd Tanous { 1811b5c07418SJames Feist return nlohmann::json{ 18123e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1813684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnResource"}, 1814f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported on the requested resource."}, 181585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1816684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 181766ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1818b5c07418SJames Feist "request if the operation failed."}}; 1819b5c07418SJames Feist } 1820b5c07418SJames Feist 1821b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1822b5c07418SJames Feist { 1823b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1824b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1825f4c4dcf4SKowalski, Kamil } 1826f4c4dcf4SKowalski, Kamil 1827f4c4dcf4SKowalski, Kamil /** 1828f4c4dcf4SKowalski, Kamil * @internal 1829684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1830684bb4b8SJason M. Bills * 1831684bb4b8SJason M. Bills * See header file for more information 1832684bb4b8SJason M. Bills * @endinternal 1833684bb4b8SJason M. Bills */ 1834684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1835684bb4b8SJason M. Bills { 1836684bb4b8SJason M. Bills return nlohmann::json{ 18373e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1838684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnOperation"}, 1839684bb4b8SJason M. Bills {"Message", "Querying is not supported with the requested operation."}, 1840684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1841684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1842684bb4b8SJason M. Bills {"Resolution", "Remove the query parameters and resubmit the request " 1843684bb4b8SJason M. Bills "if the operation failed."}}; 1844684bb4b8SJason M. Bills } 1845684bb4b8SJason M. Bills 1846684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1847684bb4b8SJason M. Bills { 1848684bb4b8SJason M. Bills res.result(boost::beast::http::status::forbidden); 1849684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1850684bb4b8SJason M. Bills } 1851684bb4b8SJason M. Bills 1852684bb4b8SJason M. Bills /** 1853684bb4b8SJason M. Bills * @internal 1854684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1855684bb4b8SJason M. Bills * 1856684bb4b8SJason M. Bills * See header file for more information 1857684bb4b8SJason M. Bills * @endinternal 1858684bb4b8SJason M. Bills */ 1859684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1860684bb4b8SJason M. Bills { 1861684bb4b8SJason M. Bills return nlohmann::json{ 18623e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1863684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryCombinationInvalid"}, 1864684bb4b8SJason M. Bills {"Message", "Two or more query parameters in the request cannot be " 1865684bb4b8SJason M. Bills "used together."}, 1866684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1867684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1868684bb4b8SJason M. Bills {"Resolution", "Remove one or more of the query parameters and " 1869684bb4b8SJason M. Bills "resubmit the request if the operation failed."}}; 1870684bb4b8SJason M. Bills } 1871684bb4b8SJason M. Bills 1872684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1873684bb4b8SJason M. Bills { 1874684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1875684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1876684bb4b8SJason M. Bills } 1877684bb4b8SJason M. Bills 1878684bb4b8SJason M. Bills /** 1879684bb4b8SJason M. Bills * @internal 1880f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1881f4c4dcf4SKowalski, Kamil * 1882f4c4dcf4SKowalski, Kamil * See header file for more information 1883f4c4dcf4SKowalski, Kamil * @endinternal 1884f4c4dcf4SKowalski, Kamil */ 1885b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 18861abe55efSEd Tanous { 1887b5c07418SJames Feist return nlohmann::json{ 18883e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1889684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InsufficientPrivilege"}, 189066ac2b8cSJason M. Bills {"Message", "There are insufficient privileges for the account or " 189166ac2b8cSJason M. Bills "credentials associated with the current session to " 189266ac2b8cSJason M. Bills "perform the requested operation."}, 189385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1894684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1895f4c4dcf4SKowalski, Kamil {"Resolution", 1896f12894f8SJason M. Bills "Either abandon the operation or change the associated access " 1897b5c07418SJames Feist "rights and resubmit the request if the operation failed."}}; 1898b5c07418SJames Feist } 1899b5c07418SJames Feist 1900b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1901b5c07418SJames Feist { 1902b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1903b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1904f4c4dcf4SKowalski, Kamil } 1905f4c4dcf4SKowalski, Kamil 1906f4c4dcf4SKowalski, Kamil /** 1907f4c4dcf4SKowalski, Kamil * @internal 1908f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1909f4c4dcf4SKowalski, Kamil * 1910f4c4dcf4SKowalski, Kamil * See header file for more information 1911f4c4dcf4SKowalski, Kamil * @endinternal 1912f4c4dcf4SKowalski, Kamil */ 1913b5c07418SJames Feist nlohmann::json propertyValueModified(const std::string& arg1, 1914b5c07418SJames Feist const std::string& arg2) 1915b5c07418SJames Feist { 1916b5c07418SJames Feist return nlohmann::json{ 19173e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1918684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueModified"}, 1919b5c07418SJames Feist {"Message", "The property " + arg1 + " was assigned the value " + arg2 + 1920b5c07418SJames Feist " due to modification by the service."}, 1921b5c07418SJames Feist {"MessageArgs", {arg1, arg2}}, 1922684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1923b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1924b5c07418SJames Feist } 1925b5c07418SJames Feist 1926f12894f8SJason M. Bills void propertyValueModified(crow::Response& res, const std::string& arg1, 1927a08b46ccSJason M. Bills const std::string& arg2) 19281abe55efSEd Tanous { 1929f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1930b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1931f4c4dcf4SKowalski, Kamil } 1932f4c4dcf4SKowalski, Kamil 1933f4c4dcf4SKowalski, Kamil /** 1934f4c4dcf4SKowalski, Kamil * @internal 1935f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1936f4c4dcf4SKowalski, Kamil * 1937f4c4dcf4SKowalski, Kamil * See header file for more information 1938f4c4dcf4SKowalski, Kamil * @endinternal 1939f4c4dcf4SKowalski, Kamil */ 1940b5c07418SJames Feist nlohmann::json accountNotModified(void) 19411abe55efSEd Tanous { 1942b5c07418SJames Feist return nlohmann::json{ 19433e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1944684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountNotModified"}, 1945f4c4dcf4SKowalski, Kamil {"Message", "The account modification request failed."}, 194685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1947684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1948f12894f8SJason M. Bills {"Resolution", "The modification may have failed due to permission " 1949b5c07418SJames Feist "issues or issues with the request body."}}; 1950b5c07418SJames Feist } 1951b5c07418SJames Feist 1952b5c07418SJames Feist void accountNotModified(crow::Response& res) 1953b5c07418SJames Feist { 1954b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1955b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1956f4c4dcf4SKowalski, Kamil } 1957f4c4dcf4SKowalski, Kamil 1958f4c4dcf4SKowalski, Kamil /** 1959f4c4dcf4SKowalski, Kamil * @internal 1960f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1961f4c4dcf4SKowalski, Kamil * 1962f4c4dcf4SKowalski, Kamil * See header file for more information 1963f4c4dcf4SKowalski, Kamil * @endinternal 1964f4c4dcf4SKowalski, Kamil */ 1965b5c07418SJames Feist nlohmann::json queryParameterValueFormatError(const std::string& arg1, 19661abe55efSEd Tanous const std::string& arg2) 19671abe55efSEd Tanous { 1968b5c07418SJames Feist return nlohmann::json{ 19693e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1970684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueFormatError"}, 1971f4c4dcf4SKowalski, Kamil {"Message", 1972f4c4dcf4SKowalski, Kamil "The value " + arg1 + " for the parameter " + arg2 + 1973f4c4dcf4SKowalski, Kamil " is of a different format than the parameter can accept."}, 197485659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1975684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 197666ac2b8cSJason M. Bills {"Resolution", 197766ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1978b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1979b5c07418SJames Feist } 1980b5c07418SJames Feist 1981b5c07418SJames Feist void queryParameterValueFormatError(crow::Response& res, 1982b5c07418SJames Feist const std::string& arg1, 1983b5c07418SJames Feist const std::string& arg2) 1984b5c07418SJames Feist { 1985b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1986b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1987b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1988f4c4dcf4SKowalski, Kamil } 1989f4c4dcf4SKowalski, Kamil 1990f4c4dcf4SKowalski, Kamil /** 1991f4c4dcf4SKowalski, Kamil * @internal 1992b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1993b5c07418SJames Feist * property 1994f12894f8SJason M. Bills * 1995f12894f8SJason M. Bills * See header file for more information 1996f12894f8SJason M. Bills * @endinternal 1997f12894f8SJason M. Bills */ 1998b5c07418SJames Feist nlohmann::json propertyMissing(const std::string& arg1) 1999f12894f8SJason M. Bills { 2000b5c07418SJames Feist return nlohmann::json{ 20013e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2002684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyMissing"}, 2003f12894f8SJason M. Bills {"Message", "The property " + arg1 + 2004f12894f8SJason M. Bills " is a required property and must be included in " 2005f12894f8SJason M. Bills "the request."}, 200685659adfSJason M. Bills {"MessageArgs", {arg1}}, 2007684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2008f12894f8SJason M. Bills {"Resolution", 2009b5c07418SJames Feist "Ensure that the property is in the request body and has a " 2010b5c07418SJames Feist "valid " 2011b5c07418SJames Feist "value and resubmit the request if the operation failed."}}; 2012b5c07418SJames Feist } 2013b5c07418SJames Feist 2014b5c07418SJames Feist void propertyMissing(crow::Response& res, const std::string& arg1) 2015b5c07418SJames Feist { 2016b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2017b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 2018f4c4dcf4SKowalski, Kamil } 2019f4c4dcf4SKowalski, Kamil 2020f4c4dcf4SKowalski, Kamil /** 2021f4c4dcf4SKowalski, Kamil * @internal 2022f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 2023f4c4dcf4SKowalski, Kamil * 2024f4c4dcf4SKowalski, Kamil * See header file for more information 2025f4c4dcf4SKowalski, Kamil * @endinternal 2026f4c4dcf4SKowalski, Kamil */ 2027b5c07418SJames Feist nlohmann::json resourceExhaustion(const std::string& arg1) 20281abe55efSEd Tanous { 2029b5c07418SJames Feist return nlohmann::json{ 20303e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2031684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceExhaustion"}, 2032d425c6f6SEd Tanous {"Message", "The resource " + arg1 + 203366ac2b8cSJason M. Bills " was unable to satisfy the request due to " 203466ac2b8cSJason M. Bills "unavailability of resources."}, 203585659adfSJason M. Bills {"MessageArgs", {arg1}}, 2036684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 2037f12894f8SJason M. Bills {"Resolution", "Ensure that the resources are available and " 2038b5c07418SJames Feist "resubmit the request."}}; 2039b5c07418SJames Feist } 2040b5c07418SJames Feist 2041b5c07418SJames Feist void resourceExhaustion(crow::Response& res, const std::string& arg1) 2042b5c07418SJames Feist { 2043b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 2044b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 2045f4c4dcf4SKowalski, Kamil } 2046f4c4dcf4SKowalski, Kamil 2047f4c4dcf4SKowalski, Kamil /** 2048f4c4dcf4SKowalski, Kamil * @internal 2049f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 2050f4c4dcf4SKowalski, Kamil * 2051f4c4dcf4SKowalski, Kamil * See header file for more information 2052f4c4dcf4SKowalski, Kamil * @endinternal 2053f4c4dcf4SKowalski, Kamil */ 2054b5c07418SJames Feist nlohmann::json accountModified(void) 20551abe55efSEd Tanous { 20563e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 2057684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountModified"}, 2058f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully modified."}, 205985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 2060684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 2061b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 2062b5c07418SJames Feist } 2063b5c07418SJames Feist 2064b5c07418SJames Feist void accountModified(crow::Response& res) 2065b5c07418SJames Feist { 2066b5c07418SJames Feist res.result(boost::beast::http::status::ok); 2067b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 2068f4c4dcf4SKowalski, Kamil } 2069f4c4dcf4SKowalski, Kamil 2070f4c4dcf4SKowalski, Kamil /** 2071f4c4dcf4SKowalski, Kamil * @internal 2072f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 2073f4c4dcf4SKowalski, Kamil * 2074f4c4dcf4SKowalski, Kamil * See header file for more information 2075f4c4dcf4SKowalski, Kamil * @endinternal 2076f4c4dcf4SKowalski, Kamil */ 2077b5c07418SJames Feist nlohmann::json queryParameterOutOfRange(const std::string& arg1, 2078b5c07418SJames Feist const std::string& arg2, 2079b5c07418SJames Feist const std::string& arg3) 20801abe55efSEd Tanous { 2081b5c07418SJames Feist return nlohmann::json{ 20823e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2083684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterOutOfRange"}, 2084b5c07418SJames Feist {"Message", "The value " + arg1 + " for the query parameter " + arg2 + 2085b5c07418SJames Feist " is out of range " + arg3 + "."}, 208685659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 2087684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2088f4c4dcf4SKowalski, Kamil {"Resolution", 2089f12894f8SJason M. Bills "Reduce the value for the query parameter to a value that is " 209066ac2b8cSJason M. Bills "within range, such as a start or count value that is within " 209166ac2b8cSJason M. Bills "bounds of the number of resources in a collection or a page that " 2092b5c07418SJames Feist "is within the range of valid pages."}}; 2093b5c07418SJames Feist } 2094b5c07418SJames Feist 2095b5c07418SJames Feist void queryParameterOutOfRange(crow::Response& res, const std::string& arg1, 2096b5c07418SJames Feist const std::string& arg2, const std::string& arg3) 2097b5c07418SJames Feist { 2098b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2099b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 2100b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 2101f4c4dcf4SKowalski, Kamil } 2102f4c4dcf4SKowalski, Kamil 21033bf4e632SJoseph Reynolds /** 21043bf4e632SJoseph Reynolds * @internal 21053bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 21063bf4e632SJoseph Reynolds * 21073bf4e632SJoseph Reynolds * See header file for more information 21083bf4e632SJoseph Reynolds * @endinternal 21093bf4e632SJoseph Reynolds */ 21103bf4e632SJoseph Reynolds void passwordChangeRequired(crow::Response& res, const std::string& arg1) 21113bf4e632SJoseph Reynolds { 21123bf4e632SJoseph Reynolds messages::addMessageToJsonRoot( 21133bf4e632SJoseph Reynolds res.jsonValue, 21143bf4e632SJoseph Reynolds nlohmann::json{ 21153bf4e632SJoseph Reynolds {"@odata.type", "/redfish/v1/$metadata#Message.v1_5_0.Message"}, 2116684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PasswordChangeRequired"}, 21173bf4e632SJoseph Reynolds {"Message", "The password provided for this account must be " 21183bf4e632SJoseph Reynolds "changed before access is granted. PATCH the " 21193bf4e632SJoseph Reynolds "'Password' property for this account located at " 21203bf4e632SJoseph Reynolds "the target URI '" + 21213bf4e632SJoseph Reynolds arg1 + "' to complete this process."}, 21223bf4e632SJoseph Reynolds {"MessageArgs", {arg1}}, 2123684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 21243bf4e632SJoseph Reynolds {"Resolution", "Change the password for this account using " 21253bf4e632SJoseph Reynolds "a PATCH to the 'Password' property at the URI " 21263bf4e632SJoseph Reynolds "provided."}}); 21273bf4e632SJoseph Reynolds } 21283bf4e632SJoseph Reynolds 21294cde5d90SJames Feist void invalidUpload(crow::Response& res, const std::string& arg1, 21304cde5d90SJames Feist const std::string& arg2) 21314cde5d90SJames Feist { 21324cde5d90SJames Feist res.result(boost::beast::http::status::bad_request); 21334cde5d90SJames Feist addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 21344cde5d90SJames Feist } 21354cde5d90SJames Feist 21364cde5d90SJames Feist /** 21374cde5d90SJames Feist * @internal 21384cde5d90SJames Feist * @brief Formats Invalid File message into JSON 21394cde5d90SJames Feist * 21404cde5d90SJames Feist * See header file for more information 21414cde5d90SJames Feist * @endinternal 21424cde5d90SJames Feist */ 21434cde5d90SJames Feist nlohmann::json invalidUpload(const std::string& arg1, const std::string& arg2) 21444cde5d90SJames Feist { 21454cde5d90SJames Feist return nlohmann::json{ 21463e082749SAsmitha Karunanithi {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"}, 21474a0bf539SManojkiran Eda {"MessageId", "OpenBMC.0.2.InvalidUpload"}, 21484cde5d90SJames Feist {"Message", "Invalid file uploaded to " + arg1 + ": " + arg2 + "."}, 21494cde5d90SJames Feist {"MessageArgs", {arg1, arg2}}, 2150684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 21514cde5d90SJames Feist {"Resolution", "None."}}; 21524cde5d90SJames Feist } 21534cde5d90SJames Feist 2154dd28ba82SAppaRao Puli /** 2155dd28ba82SAppaRao Puli * @internal 2156dd28ba82SAppaRao Puli * @brief Formats MutualExclusiveProperties into JSON 2157dd28ba82SAppaRao Puli * 2158dd28ba82SAppaRao Puli * See header file for more information 2159dd28ba82SAppaRao Puli * @endinternal 2160dd28ba82SAppaRao Puli */ 2161dd28ba82SAppaRao Puli nlohmann::json mutualExclusiveProperties(const std::string& arg1, 2162dd28ba82SAppaRao Puli const std::string& arg2) 2163dd28ba82SAppaRao Puli { 2164dd28ba82SAppaRao Puli return nlohmann::json{ 21653e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2166dd28ba82SAppaRao Puli {"MessageId", "Base.1.5.0.MutualExclusiveProperties"}, 2167dd28ba82SAppaRao Puli {"Message", "The properties " + arg1 + " and " + arg2 + 2168dd28ba82SAppaRao Puli " are mutually exclusive."}, 2169dd28ba82SAppaRao Puli {"MessageArgs", {arg1, arg2}}, 2170684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2171dd28ba82SAppaRao Puli {"Resolution", 2172dd28ba82SAppaRao Puli "Ensure that the request body doesn't contain mutually exclusive " 2173dd28ba82SAppaRao Puli "properties and resubmit the request."}}; 2174dd28ba82SAppaRao Puli } 2175dd28ba82SAppaRao Puli 2176dd28ba82SAppaRao Puli void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, 2177dd28ba82SAppaRao Puli const std::string& arg2) 2178dd28ba82SAppaRao Puli { 2179dd28ba82SAppaRao Puli res.result(boost::beast::http::status::bad_request); 2180dd28ba82SAppaRao Puli addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2)); 2181dd28ba82SAppaRao Puli } 2182dd28ba82SAppaRao Puli 2183f4c4dcf4SKowalski, Kamil } // namespace messages 2184f4c4dcf4SKowalski, Kamil 2185d425c6f6SEd Tanous } // namespace redfish 2186