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 */ 161abe55efSEd Tanous #include <error_messages.hpp> 1704e438cbSEd Tanous #include <logging.hpp> 18f4c4dcf4SKowalski, Kamil 191abe55efSEd Tanous namespace redfish 201abe55efSEd Tanous { 211abe55efSEd Tanous 221abe55efSEd Tanous namespace messages 231abe55efSEd Tanous { 24f4c4dcf4SKowalski, Kamil 25f12894f8SJason M. Bills static void addMessageToErrorJson(nlohmann::json& target, 261abe55efSEd Tanous const nlohmann::json& message) 271abe55efSEd Tanous { 28f4c4dcf4SKowalski, Kamil auto& error = target["error"]; 29f4c4dcf4SKowalski, Kamil 301abe55efSEd Tanous // If this is the first error message, fill in the information from the 311abe55efSEd Tanous // first error message to the top level struct 321abe55efSEd Tanous if (!error.is_object()) 331abe55efSEd Tanous { 34c074230bSJason M. Bills auto messageIdIterator = message.find("MessageId"); 35c074230bSJason M. Bills if (messageIdIterator == message.end()) 361abe55efSEd Tanous { 371abe55efSEd Tanous BMCWEB_LOG_CRITICAL 381abe55efSEd Tanous << "Attempt to add error message without MessageId"; 39f4c4dcf4SKowalski, Kamil return; 40f4c4dcf4SKowalski, Kamil } 41f4c4dcf4SKowalski, Kamil 42c074230bSJason M. Bills auto messageFieldIterator = message.find("Message"); 43c074230bSJason M. Bills if (messageFieldIterator == message.end()) 441abe55efSEd Tanous { 451abe55efSEd Tanous BMCWEB_LOG_CRITICAL 461abe55efSEd Tanous << "Attempt to add error message without Message"; 47f4c4dcf4SKowalski, Kamil return; 48f4c4dcf4SKowalski, Kamil } 49c21055aaSEd Tanous error = {{"code", *messageIdIterator}, 50c21055aaSEd Tanous {"message", *messageFieldIterator}}; 511abe55efSEd Tanous } 521abe55efSEd Tanous else 531abe55efSEd Tanous { 54f4c4dcf4SKowalski, Kamil // More than 1 error occurred, so the message has to be generic 5555c7b7a2SEd Tanous error["code"] = std::string(messageVersionPrefix) + "GeneralError"; 56cc9139ecSJason M. Bills error["message"] = "A general error has occurred. See Resolution for " 57cc9139ecSJason M. Bills "information on how to resolve the error."; 58f4c4dcf4SKowalski, Kamil } 59f4c4dcf4SKowalski, Kamil 60f4c4dcf4SKowalski, Kamil // This check could technically be done in in the default construction 61f4c4dcf4SKowalski, Kamil // branch above, but because we need the pointer to the extended info field 62f4c4dcf4SKowalski, Kamil // anyway, it's more efficient to do it here. 63c074230bSJason M. Bills auto& extendedInfo = error[messages::messageAnnotation]; 64c074230bSJason M. Bills if (!extendedInfo.is_array()) 651abe55efSEd Tanous { 66c074230bSJason M. Bills extendedInfo = nlohmann::json::array(); 67f4c4dcf4SKowalski, Kamil } 68f4c4dcf4SKowalski, Kamil 69c074230bSJason M. Bills extendedInfo.push_back(message); 70f4c4dcf4SKowalski, Kamil } 71f4c4dcf4SKowalski, Kamil 72f12894f8SJason M. Bills static void addMessageToJsonRoot(nlohmann::json& target, 73f12894f8SJason M. Bills const nlohmann::json& message) 741abe55efSEd Tanous { 751abe55efSEd Tanous if (!target[messages::messageAnnotation].is_array()) 761abe55efSEd Tanous { 77f4c4dcf4SKowalski, Kamil // Force object to be an array 7855c7b7a2SEd Tanous target[messages::messageAnnotation] = nlohmann::json::array(); 79f4c4dcf4SKowalski, Kamil } 80f4c4dcf4SKowalski, Kamil 8155c7b7a2SEd Tanous target[messages::messageAnnotation].push_back(message); 82f4c4dcf4SKowalski, Kamil } 83f4c4dcf4SKowalski, Kamil 84f12894f8SJason M. Bills static void addMessageToJson(nlohmann::json& target, 85f12894f8SJason M. Bills const nlohmann::json& message, 861abe55efSEd Tanous const std::string& fieldPath) 871abe55efSEd Tanous { 88a08b46ccSJason M. Bills std::string extendedInfo(fieldPath + messages::messageAnnotation); 89f4c4dcf4SKowalski, Kamil 901abe55efSEd Tanous if (!target[extendedInfo].is_array()) 911abe55efSEd Tanous { 92f4c4dcf4SKowalski, Kamil // Force object to be an array 93f4c4dcf4SKowalski, Kamil target[extendedInfo] = nlohmann::json::array(); 94f4c4dcf4SKowalski, Kamil } 95f4c4dcf4SKowalski, Kamil 96f4c4dcf4SKowalski, Kamil // Object exists and it is an array so we can just push in the message 97f4c4dcf4SKowalski, Kamil target[extendedInfo].push_back(message); 98f4c4dcf4SKowalski, Kamil } 99f4c4dcf4SKowalski, Kamil 100f4c4dcf4SKowalski, Kamil /** 101f4c4dcf4SKowalski, Kamil * @internal 102f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInUse message into JSON 103f4c4dcf4SKowalski, Kamil * 104f4c4dcf4SKowalski, Kamil * See header file for more information 105f4c4dcf4SKowalski, Kamil * @endinternal 106f4c4dcf4SKowalski, Kamil */ 107b5c07418SJames Feist nlohmann::json resourceInUse(void) 1081abe55efSEd Tanous { 109b5c07418SJames Feist return nlohmann::json{ 1103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 111684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceInUse"}, 11266ac2b8cSJason M. Bills {"Message", "The change to the requested resource failed because " 11366ac2b8cSJason M. Bills "the resource is in use or in transition."}, 11485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 115684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 11666ac2b8cSJason M. Bills {"Resolution", "Remove the condition and resubmit the request if " 117b5c07418SJames Feist "the operation failed."}}; 118b5c07418SJames Feist } 119b5c07418SJames Feist 120b5c07418SJames Feist void resourceInUse(crow::Response& res) 121b5c07418SJames Feist { 122b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 123b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInUse()); 124f4c4dcf4SKowalski, Kamil } 125f4c4dcf4SKowalski, Kamil 126f4c4dcf4SKowalski, Kamil /** 127f4c4dcf4SKowalski, Kamil * @internal 128f4c4dcf4SKowalski, Kamil * @brief Formats MalformedJSON message into JSON 129f4c4dcf4SKowalski, Kamil * 130f4c4dcf4SKowalski, Kamil * See header file for more information 131f4c4dcf4SKowalski, Kamil * @endinternal 132f4c4dcf4SKowalski, Kamil */ 133b5c07418SJames Feist nlohmann::json malformedJSON(void) 1341abe55efSEd Tanous { 135b5c07418SJames Feist return nlohmann::json{ 1363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 137684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.MalformedJSON"}, 13866ac2b8cSJason M. Bills {"Message", "The request body submitted was malformed JSON and " 13966ac2b8cSJason M. Bills "could not be parsed by the receiving service."}, 14085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 141684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1421abe55efSEd Tanous {"Resolution", "Ensure that the request body is valid JSON and " 143b5c07418SJames Feist "resubmit the request."}}; 144b5c07418SJames Feist } 145b5c07418SJames Feist 146b5c07418SJames Feist void malformedJSON(crow::Response& res) 147b5c07418SJames Feist { 148b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 149b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, malformedJSON()); 150f4c4dcf4SKowalski, Kamil } 151f4c4dcf4SKowalski, Kamil 152f4c4dcf4SKowalski, Kamil /** 153f4c4dcf4SKowalski, Kamil * @internal 154f4c4dcf4SKowalski, Kamil * @brief Formats ResourceMissingAtURI message into JSON 155f4c4dcf4SKowalski, Kamil * 156f4c4dcf4SKowalski, Kamil * See header file for more information 157f4c4dcf4SKowalski, Kamil * @endinternal 158f4c4dcf4SKowalski, Kamil */ 159b5c07418SJames Feist nlohmann::json resourceMissingAtURI(const std::string& arg1) 1601abe55efSEd Tanous { 161b5c07418SJames Feist return nlohmann::json{ 1623e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 163684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceMissingAtURI"}, 164f4c4dcf4SKowalski, Kamil {"Message", "The resource at the URI " + arg1 + " was not found."}, 16585659adfSJason M. Bills {"MessageArgs", {arg1}}, 166684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 16766ac2b8cSJason M. Bills {"Resolution", "Place a valid resource at the URI or correct the " 168b5c07418SJames Feist "URI and resubmit the request."}}; 169b5c07418SJames Feist } 170b5c07418SJames Feist 171b5c07418SJames Feist void resourceMissingAtURI(crow::Response& res, const std::string& arg1) 172b5c07418SJames Feist { 173b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 174b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); 175f4c4dcf4SKowalski, Kamil } 176f4c4dcf4SKowalski, Kamil 177f4c4dcf4SKowalski, Kamil /** 178f4c4dcf4SKowalski, Kamil * @internal 179f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueFormatError message into JSON 180f4c4dcf4SKowalski, Kamil * 181f4c4dcf4SKowalski, Kamil * See header file for more information 182f4c4dcf4SKowalski, Kamil * @endinternal 183f4c4dcf4SKowalski, Kamil */ 184b5c07418SJames Feist nlohmann::json actionParameterValueFormatError(const std::string& arg1, 185f4c4dcf4SKowalski, Kamil const std::string& arg2, 1861abe55efSEd Tanous const std::string& arg3) 1871abe55efSEd Tanous { 188b5c07418SJames Feist return nlohmann::json{ 1893e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 190684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterValueFormatError"}, 191f4c4dcf4SKowalski, Kamil {"Message", 1921abe55efSEd Tanous "The value " + arg1 + " for the parameter " + arg2 + 1931abe55efSEd Tanous " in the action " + arg3 + 1941abe55efSEd Tanous " is of a different format than the parameter can accept."}, 19585659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 196684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 19766ac2b8cSJason M. Bills {"Resolution", 19866ac2b8cSJason M. Bills "Correct the value for the parameter in the request body and " 199b5c07418SJames Feist "resubmit the request if the operation failed."}}; 200b5c07418SJames Feist } 201b5c07418SJames Feist 202b5c07418SJames Feist void actionParameterValueFormatError(crow::Response& res, 203b5c07418SJames Feist const std::string& arg1, 204b5c07418SJames Feist const std::string& arg2, 205b5c07418SJames Feist const std::string& arg3) 206b5c07418SJames Feist { 207b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 208b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 209b5c07418SJames Feist actionParameterValueFormatError(arg1, arg2, arg3)); 210f4c4dcf4SKowalski, Kamil } 211f4c4dcf4SKowalski, Kamil 212f4c4dcf4SKowalski, Kamil /** 213f4c4dcf4SKowalski, Kamil * @internal 214f4c4dcf4SKowalski, Kamil * @brief Formats InternalError message into JSON 215f4c4dcf4SKowalski, Kamil * 216f4c4dcf4SKowalski, Kamil * See header file for more information 217f4c4dcf4SKowalski, Kamil * @endinternal 218f4c4dcf4SKowalski, Kamil */ 219b5c07418SJames Feist nlohmann::json internalError(void) 2201abe55efSEd Tanous { 221b5c07418SJames Feist return nlohmann::json{ 2223e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 223684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InternalError"}, 224f12894f8SJason M. Bills {"Message", "The request failed due to an internal service error. " 22566ac2b8cSJason M. Bills "The service is still operational."}, 22685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 227684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 2281abe55efSEd Tanous {"Resolution", "Resubmit the request. If the problem persists, " 229b5c07418SJames Feist "consider resetting the service."}}; 230b5c07418SJames Feist } 231b5c07418SJames Feist 232b5c07418SJames Feist void internalError(crow::Response& res) 233b5c07418SJames Feist { 234b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 235b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, internalError()); 236f12894f8SJason M. Bills } 237f12894f8SJason M. Bills 238f12894f8SJason M. Bills /** 239f12894f8SJason M. Bills * @internal 240f4c4dcf4SKowalski, Kamil * @brief Formats UnrecognizedRequestBody message into JSON 241f4c4dcf4SKowalski, Kamil * 242f4c4dcf4SKowalski, Kamil * See header file for more information 243f4c4dcf4SKowalski, Kamil * @endinternal 244f4c4dcf4SKowalski, Kamil */ 245b5c07418SJames Feist nlohmann::json unrecognizedRequestBody(void) 2461abe55efSEd Tanous { 247b5c07418SJames Feist return nlohmann::json{ 2483e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 249684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.UnrecognizedRequestBody"}, 250f12894f8SJason M. Bills {"Message", "The service detected a malformed request body that it " 25166ac2b8cSJason M. Bills "was unable to interpret."}, 25285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 253684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 254f12894f8SJason M. Bills {"Resolution", "Correct the request body and resubmit the request " 255b5c07418SJames Feist "if it failed."}}; 256b5c07418SJames Feist } 257b5c07418SJames Feist 258b5c07418SJames Feist void unrecognizedRequestBody(crow::Response& res) 259b5c07418SJames Feist { 260b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 261b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody()); 262f4c4dcf4SKowalski, Kamil } 263f4c4dcf4SKowalski, Kamil 264f4c4dcf4SKowalski, Kamil /** 265f4c4dcf4SKowalski, Kamil * @internal 266f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriUnauthorized message into JSON 267f4c4dcf4SKowalski, Kamil * 268f4c4dcf4SKowalski, Kamil * See header file for more information 269f4c4dcf4SKowalski, Kamil * @endinternal 270f4c4dcf4SKowalski, Kamil */ 271b5c07418SJames Feist nlohmann::json resourceAtUriUnauthorized(const std::string& arg1, 2721abe55efSEd Tanous const std::string& arg2) 2731abe55efSEd Tanous { 274b5c07418SJames Feist return nlohmann::json{ 2753e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 276684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAtUriUnauthorized"}, 277f4c4dcf4SKowalski, Kamil {"Message", "While accessing the resource at " + arg1 + 2781abe55efSEd Tanous ", the service received an authorization error " + 2791abe55efSEd Tanous arg2 + "."}, 28085659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 281684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 282f12894f8SJason M. Bills {"Resolution", "Ensure that the appropriate access is provided for " 283b5c07418SJames Feist "the service in order for it to access the URI."}}; 284b5c07418SJames Feist } 285b5c07418SJames Feist 286b5c07418SJames Feist void resourceAtUriUnauthorized(crow::Response& res, const std::string& arg1, 287b5c07418SJames Feist const std::string& arg2) 288b5c07418SJames Feist { 289b5c07418SJames Feist res.result(boost::beast::http::status::unauthorized); 290b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2)); 291f4c4dcf4SKowalski, Kamil } 292f4c4dcf4SKowalski, Kamil 293f4c4dcf4SKowalski, Kamil /** 294f4c4dcf4SKowalski, Kamil * @internal 295f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterUnknown message into JSON 296f4c4dcf4SKowalski, Kamil * 297f4c4dcf4SKowalski, Kamil * See header file for more information 298f4c4dcf4SKowalski, Kamil * @endinternal 299f4c4dcf4SKowalski, Kamil */ 300b5c07418SJames Feist nlohmann::json actionParameterUnknown(const std::string& arg1, 301b5c07418SJames Feist const std::string& arg2) 302b5c07418SJames Feist { 303b5c07418SJames Feist return nlohmann::json{ 3043e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 305684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterUnknown"}, 306b5c07418SJames Feist {"Message", "The action " + arg1 + 307b5c07418SJames Feist " was submitted with the invalid parameter " + arg2 + 308b5c07418SJames Feist "."}, 309b5c07418SJames Feist {"MessageArgs", {arg1, arg2}}, 310684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 311b5c07418SJames Feist {"Resolution", "Correct the invalid parameter and resubmit the " 312b5c07418SJames Feist "request if the operation failed."}}; 313b5c07418SJames Feist } 314b5c07418SJames Feist 315f12894f8SJason M. Bills void actionParameterUnknown(crow::Response& res, const std::string& arg1, 3161abe55efSEd Tanous const std::string& arg2) 3171abe55efSEd Tanous { 318f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 319b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2)); 320f4c4dcf4SKowalski, Kamil } 321f4c4dcf4SKowalski, Kamil 322f4c4dcf4SKowalski, Kamil /** 323f4c4dcf4SKowalski, Kamil * @internal 324f4c4dcf4SKowalski, Kamil * @brief Formats ResourceCannotBeDeleted message into JSON 325f4c4dcf4SKowalski, Kamil * 326f4c4dcf4SKowalski, Kamil * See header file for more information 327f4c4dcf4SKowalski, Kamil * @endinternal 328f4c4dcf4SKowalski, Kamil */ 329b5c07418SJames Feist nlohmann::json resourceCannotBeDeleted(void) 3301abe55efSEd Tanous { 331b5c07418SJames Feist return nlohmann::json{ 3323e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 333684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceCannotBeDeleted"}, 334f12894f8SJason M. Bills {"Message", "The delete request failed because the resource " 33566ac2b8cSJason M. Bills "requested cannot be deleted."}, 33685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 337684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 338b5c07418SJames Feist {"Resolution", "Do not attempt to delete a non-deletable resource."}}; 339b5c07418SJames Feist } 340b5c07418SJames Feist 341b5c07418SJames Feist void resourceCannotBeDeleted(crow::Response& res) 342b5c07418SJames Feist { 343b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 344b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted()); 345f4c4dcf4SKowalski, Kamil } 346f4c4dcf4SKowalski, Kamil 347f4c4dcf4SKowalski, Kamil /** 348f4c4dcf4SKowalski, Kamil * @internal 349f4c4dcf4SKowalski, Kamil * @brief Formats PropertyDuplicate message into JSON 350f4c4dcf4SKowalski, Kamil * 351f4c4dcf4SKowalski, Kamil * See header file for more information 352f4c4dcf4SKowalski, Kamil * @endinternal 353f4c4dcf4SKowalski, Kamil */ 354b5c07418SJames Feist nlohmann::json propertyDuplicate(const std::string& arg1) 3551abe55efSEd Tanous { 356b5c07418SJames Feist return nlohmann::json{ 3573e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 358684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyDuplicate"}, 359b5c07418SJames Feist {"Message", "The property " + arg1 + " was duplicated in the request."}, 36085659adfSJason M. Bills {"MessageArgs", {arg1}}, 361684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 36266ac2b8cSJason M. Bills {"Resolution", 36366ac2b8cSJason M. Bills "Remove the duplicate property from the request body and resubmit " 364b5c07418SJames Feist "the request if the operation failed."}}; 365b5c07418SJames Feist } 366b5c07418SJames Feist 367b5c07418SJames Feist void propertyDuplicate(crow::Response& res, const std::string& arg1) 368b5c07418SJames Feist { 369b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 370b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyDuplicate(arg1), arg1); 371f4c4dcf4SKowalski, Kamil } 372f4c4dcf4SKowalski, Kamil 373f4c4dcf4SKowalski, Kamil /** 374f4c4dcf4SKowalski, Kamil * @internal 375f4c4dcf4SKowalski, Kamil * @brief Formats ServiceTemporarilyUnavailable message into JSON 376f4c4dcf4SKowalski, Kamil * 377f4c4dcf4SKowalski, Kamil * See header file for more information 378f4c4dcf4SKowalski, Kamil * @endinternal 379f4c4dcf4SKowalski, Kamil */ 380b5c07418SJames Feist nlohmann::json serviceTemporarilyUnavailable(const std::string& arg1) 3811abe55efSEd Tanous { 382b5c07418SJames Feist return nlohmann::json{ 3833e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 384684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceTemporarilyUnavailable"}, 3851abe55efSEd Tanous {"Message", "The service is temporarily unavailable. Retry in " + 3861abe55efSEd Tanous arg1 + " seconds."}, 38785659adfSJason M. Bills {"MessageArgs", {arg1}}, 388684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 389f12894f8SJason M. Bills {"Resolution", "Wait for the indicated retry duration and retry " 390b5c07418SJames Feist "the operation."}}; 391b5c07418SJames Feist } 392b5c07418SJames Feist 393b5c07418SJames Feist void serviceTemporarilyUnavailable(crow::Response& res, const std::string& arg1) 394b5c07418SJames Feist { 395b5c07418SJames Feist res.addHeader("Retry-After", arg1); 396b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 397b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1)); 398f4c4dcf4SKowalski, Kamil } 399f4c4dcf4SKowalski, Kamil 400f4c4dcf4SKowalski, Kamil /** 401f4c4dcf4SKowalski, Kamil * @internal 402f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAlreadyExists message into JSON 403f4c4dcf4SKowalski, Kamil * 404f4c4dcf4SKowalski, Kamil * See header file for more information 405f4c4dcf4SKowalski, Kamil * @endinternal 406f4c4dcf4SKowalski, Kamil */ 407b5c07418SJames Feist nlohmann::json resourceAlreadyExists(const std::string& arg1, 408b5c07418SJames Feist const std::string& arg2, 409b5c07418SJames Feist const std::string& arg3) 4101abe55efSEd Tanous { 411b5c07418SJames Feist return nlohmann::json{ 4123e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 413684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAlreadyExists"}, 414f4c4dcf4SKowalski, Kamil {"Message", "The requested resource of type " + arg1 + 4151abe55efSEd Tanous " with the property " + arg2 + " with the value " + 4161abe55efSEd Tanous arg3 + " already exists."}, 41785659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 418684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 419f12894f8SJason M. Bills {"Resolution", "Do not repeat the create operation as the resource " 420b5c07418SJames Feist "has already been created."}}; 421b5c07418SJames Feist } 422b5c07418SJames Feist 423b5c07418SJames Feist void resourceAlreadyExists(crow::Response& res, const std::string& arg1, 424b5c07418SJames Feist const std::string& arg2, const std::string& arg3) 425b5c07418SJames Feist { 426b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 427b5c07418SJames Feist addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3), 428a08b46ccSJason M. Bills arg2); 429f4c4dcf4SKowalski, Kamil } 430f4c4dcf4SKowalski, Kamil 431f4c4dcf4SKowalski, Kamil /** 432f4c4dcf4SKowalski, Kamil * @internal 433f4c4dcf4SKowalski, Kamil * @brief Formats AccountForSessionNoLongerExists message into JSON 434f4c4dcf4SKowalski, Kamil * 435f4c4dcf4SKowalski, Kamil * See header file for more information 436f4c4dcf4SKowalski, Kamil * @endinternal 437f4c4dcf4SKowalski, Kamil */ 438b5c07418SJames Feist nlohmann::json accountForSessionNoLongerExists(void) 4391abe55efSEd Tanous { 440b5c07418SJames Feist return nlohmann::json{ 4413e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 442684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountForSessionNoLongerExists"}, 4431abe55efSEd Tanous {"Message", "The account for the current session has been removed, " 44466ac2b8cSJason M. Bills "thus the current session has been removed as well."}, 44585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 446684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 447b5c07418SJames Feist {"Resolution", "Attempt to connect with a valid account."}}; 448b5c07418SJames Feist } 449b5c07418SJames Feist 450b5c07418SJames Feist void accountForSessionNoLongerExists(crow::Response& res) 451b5c07418SJames Feist { 452b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 453b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists()); 454f4c4dcf4SKowalski, Kamil } 455f4c4dcf4SKowalski, Kamil 456f4c4dcf4SKowalski, Kamil /** 457f4c4dcf4SKowalski, Kamil * @internal 458f4c4dcf4SKowalski, Kamil * @brief Formats CreateFailedMissingReqProperties message into JSON 459f4c4dcf4SKowalski, Kamil * 460f4c4dcf4SKowalski, Kamil * See header file for more information 461f4c4dcf4SKowalski, Kamil * @endinternal 462f4c4dcf4SKowalski, Kamil */ 463b5c07418SJames Feist nlohmann::json createFailedMissingReqProperties(const std::string& arg1) 4641abe55efSEd Tanous { 465b5c07418SJames Feist return nlohmann::json{ 4663e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 467684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CreateFailedMissingReqProperties"}, 4681abe55efSEd Tanous {"Message", 469b5c07418SJames Feist "The create operation failed because the required property " + arg1 + 470b5c07418SJames Feist " was missing from the request."}, 47185659adfSJason M. Bills {"MessageArgs", {arg1}}, 472684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 473f4c4dcf4SKowalski, Kamil {"Resolution", 474f12894f8SJason M. Bills "Correct the body to include the required property with a valid " 475b5c07418SJames Feist "value and resubmit the request if the operation failed."}}; 476b5c07418SJames Feist } 477b5c07418SJames Feist 478b5c07418SJames Feist void createFailedMissingReqProperties(crow::Response& res, 479b5c07418SJames Feist const std::string& arg1) 480b5c07418SJames Feist { 481b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 482b5c07418SJames Feist addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1), 483a08b46ccSJason M. Bills arg1); 484f12894f8SJason M. Bills } 485f12894f8SJason M. Bills 486f12894f8SJason M. Bills /** 487f12894f8SJason M. Bills * @internal 488f12894f8SJason M. Bills * @brief Formats PropertyValueFormatError message into JSON for the specified 489f12894f8SJason M. Bills * property 490f12894f8SJason M. Bills * 491f12894f8SJason M. Bills * See header file for more information 492f12894f8SJason M. Bills * @endinternal 493f12894f8SJason M. Bills */ 494b5c07418SJames Feist nlohmann::json propertyValueFormatError(const std::string& arg1, 495a08b46ccSJason M. Bills const std::string& arg2) 496f12894f8SJason M. Bills { 497b5c07418SJames Feist return nlohmann::json{ 4983e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 499684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueFormatError"}, 500f12894f8SJason M. Bills {"Message", 501f12894f8SJason M. Bills "The value " + arg1 + " for the property " + arg2 + 502f12894f8SJason M. Bills " is of a different format than the property can accept."}, 50385659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 504684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 50566ac2b8cSJason M. Bills {"Resolution", 50666ac2b8cSJason M. Bills "Correct the value for the property in the request body and " 507b5c07418SJames Feist "resubmit the request if the operation failed."}}; 508b5c07418SJames Feist } 509b5c07418SJames Feist 510b5c07418SJames Feist void propertyValueFormatError(crow::Response& res, const std::string& arg1, 511b5c07418SJames Feist const std::string& arg2) 512b5c07418SJames Feist { 513b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 514b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); 515f12894f8SJason M. Bills } 516f12894f8SJason M. Bills 517f12894f8SJason M. Bills /** 518f12894f8SJason M. Bills * @internal 519f12894f8SJason M. Bills * @brief Formats PropertyValueNotInList message into JSON for the specified 520f12894f8SJason M. Bills * property 521f12894f8SJason M. Bills * 522f12894f8SJason M. Bills * See header file for more information 523f12894f8SJason M. Bills * @endinternal 524f12894f8SJason M. Bills */ 525b5c07418SJames Feist nlohmann::json propertyValueNotInList(const std::string& arg1, 526a08b46ccSJason M. Bills const std::string& arg2) 527f12894f8SJason M. Bills { 528b5c07418SJames Feist return nlohmann::json{ 5293e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 530684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueNotInList"}, 531f12894f8SJason M. Bills {"Message", "The value " + arg1 + " for the property " + arg2 + 532f12894f8SJason M. Bills " is not in the list of acceptable values."}, 53385659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 534684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 535b5c07418SJames Feist {"Resolution", "Choose a value from the enumeration list that " 536b5c07418SJames Feist "the implementation " 537b5c07418SJames Feist "can support and resubmit the request if the " 538b5c07418SJames Feist "operation failed."}}; 539b5c07418SJames Feist } 540b5c07418SJames Feist 541b5c07418SJames Feist void propertyValueNotInList(crow::Response& res, const std::string& arg1, 542b5c07418SJames Feist const std::string& arg2) 543b5c07418SJames Feist { 544b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 545b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueNotInList(arg1, arg2), arg2); 546f4c4dcf4SKowalski, Kamil } 547f4c4dcf4SKowalski, Kamil 548f4c4dcf4SKowalski, Kamil /** 549f4c4dcf4SKowalski, Kamil * @internal 550f4c4dcf4SKowalski, Kamil * @brief Formats ResourceAtUriInUnknownFormat message into JSON 551f4c4dcf4SKowalski, Kamil * 552f4c4dcf4SKowalski, Kamil * See header file for more information 553f4c4dcf4SKowalski, Kamil * @endinternal 554f4c4dcf4SKowalski, Kamil */ 555b5c07418SJames Feist nlohmann::json resourceAtUriInUnknownFormat(const std::string& arg1) 5561abe55efSEd Tanous { 557b5c07418SJames Feist return nlohmann::json{ 5583e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 559684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceAtUriInUnknownFormat"}, 560f4c4dcf4SKowalski, Kamil {"Message", "The resource at " + arg1 + 561f4c4dcf4SKowalski, Kamil " is in a format not recognized by the service."}, 56285659adfSJason M. Bills {"MessageArgs", {arg1}}, 563684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 564f12894f8SJason M. Bills {"Resolution", "Place an image or resource or file that is " 565b5c07418SJames Feist "recognized by the service at the URI."}}; 566b5c07418SJames Feist } 567b5c07418SJames Feist 568b5c07418SJames Feist void resourceAtUriInUnknownFormat(crow::Response& res, const std::string& arg1) 569b5c07418SJames Feist { 570b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 571b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); 572f4c4dcf4SKowalski, Kamil } 573f4c4dcf4SKowalski, Kamil 574f4c4dcf4SKowalski, Kamil /** 575f4c4dcf4SKowalski, Kamil * @internal 576*81856681SAsmitha Karunanithi * @brief Formats ServiceDisabled message into JSON 577*81856681SAsmitha Karunanithi * 578*81856681SAsmitha Karunanithi * See header file for more information 579*81856681SAsmitha Karunanithi * @endinternal 580*81856681SAsmitha Karunanithi */ 581*81856681SAsmitha Karunanithi nlohmann::json serviceDisabled(const std::string& arg1) 582*81856681SAsmitha Karunanithi { 583*81856681SAsmitha Karunanithi return nlohmann::json{ 584*81856681SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 585*81856681SAsmitha Karunanithi {"MessageId", "Base.1.11.0.ServiceDisabled"}, 586*81856681SAsmitha Karunanithi {"Message", "The operation failed because the service at " + arg1 + 587*81856681SAsmitha Karunanithi " is disabled and cannot accept requests."}, 588*81856681SAsmitha Karunanithi {"MessageArgs", {arg1}}, 589*81856681SAsmitha Karunanithi {"MessageSeverity", "Warning"}, 590*81856681SAsmitha Karunanithi {"Resolution", "Enable the service and resubmit the request if the " 591*81856681SAsmitha Karunanithi "operation failed."}}; 592*81856681SAsmitha Karunanithi } 593*81856681SAsmitha Karunanithi 594*81856681SAsmitha Karunanithi void serviceDisabled(crow::Response& res, const std::string& arg1) 595*81856681SAsmitha Karunanithi { 596*81856681SAsmitha Karunanithi res.result(boost::beast::http::status::service_unavailable); 597*81856681SAsmitha Karunanithi addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1)); 598*81856681SAsmitha Karunanithi } 599*81856681SAsmitha Karunanithi 600*81856681SAsmitha Karunanithi /** 601*81856681SAsmitha Karunanithi * @internal 602f4c4dcf4SKowalski, Kamil * @brief Formats ServiceInUnknownState message into JSON 603f4c4dcf4SKowalski, Kamil * 604f4c4dcf4SKowalski, Kamil * See header file for more information 605f4c4dcf4SKowalski, Kamil * @endinternal 606f4c4dcf4SKowalski, Kamil */ 607b5c07418SJames Feist nlohmann::json serviceInUnknownState(void) 6081abe55efSEd Tanous { 609b5c07418SJames Feist return nlohmann::json{ 6103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 611684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceInUnknownState"}, 61266ac2b8cSJason M. Bills {"Message", 61366ac2b8cSJason M. Bills "The operation failed because the service is in an unknown state " 61466ac2b8cSJason M. Bills "and can no longer take incoming requests."}, 61585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 616684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 61766ac2b8cSJason M. Bills {"Resolution", "Restart the service and resubmit the request if " 618b5c07418SJames Feist "the operation failed."}}; 619b5c07418SJames Feist } 620b5c07418SJames Feist 621b5c07418SJames Feist void serviceInUnknownState(crow::Response& res) 622b5c07418SJames Feist { 623b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 624b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceInUnknownState()); 625f4c4dcf4SKowalski, Kamil } 626f4c4dcf4SKowalski, Kamil 627f4c4dcf4SKowalski, Kamil /** 628f4c4dcf4SKowalski, Kamil * @internal 629f4c4dcf4SKowalski, Kamil * @brief Formats EventSubscriptionLimitExceeded message into JSON 630f4c4dcf4SKowalski, Kamil * 631f4c4dcf4SKowalski, Kamil * See header file for more information 632f4c4dcf4SKowalski, Kamil * @endinternal 633f4c4dcf4SKowalski, Kamil */ 634b5c07418SJames Feist nlohmann::json eventSubscriptionLimitExceeded(void) 6351abe55efSEd Tanous { 636b5c07418SJames Feist return nlohmann::json{ 6373e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 638684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.EventSubscriptionLimitExceeded"}, 639f4c4dcf4SKowalski, Kamil {"Message", 640f4c4dcf4SKowalski, Kamil "The event subscription failed due to the number of simultaneous " 641f4c4dcf4SKowalski, Kamil "subscriptions exceeding the limit of the implementation."}, 64285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 643684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 644f4c4dcf4SKowalski, Kamil {"Resolution", 645f12894f8SJason M. Bills "Reduce the number of other subscriptions before trying to " 64666ac2b8cSJason M. Bills "establish the event subscription or increase the limit of " 647b5c07418SJames Feist "simultaneous subscriptions (if supported)."}}; 648b5c07418SJames Feist } 649b5c07418SJames Feist 650b5c07418SJames Feist void eventSubscriptionLimitExceeded(crow::Response& res) 651b5c07418SJames Feist { 652789fdab3SEd Tanous res.result(boost::beast::http::status::service_unavailable); 653b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded()); 654f4c4dcf4SKowalski, Kamil } 655f4c4dcf4SKowalski, Kamil 656f4c4dcf4SKowalski, Kamil /** 657f4c4dcf4SKowalski, Kamil * @internal 658f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterMissing message into JSON 659f4c4dcf4SKowalski, Kamil * 660f4c4dcf4SKowalski, Kamil * See header file for more information 661f4c4dcf4SKowalski, Kamil * @endinternal 662f4c4dcf4SKowalski, Kamil */ 663b5c07418SJames Feist nlohmann::json actionParameterMissing(const std::string& arg1, 6641abe55efSEd Tanous const std::string& arg2) 6651abe55efSEd Tanous { 666b5c07418SJames Feist return nlohmann::json{ 6673e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 668684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterMissing"}, 669b5c07418SJames Feist {"Message", "The action " + arg1 + " requires the parameter " + arg2 + 670b5c07418SJames Feist " to be present in the request body."}, 67185659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 672684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 673f12894f8SJason M. Bills {"Resolution", 67466ac2b8cSJason M. Bills "Supply the action with the required parameter in the request " 675b5c07418SJames Feist "body when the request is resubmitted."}}; 676b5c07418SJames Feist } 677b5c07418SJames Feist 678b5c07418SJames Feist void actionParameterMissing(crow::Response& res, const std::string& arg1, 679b5c07418SJames Feist const std::string& arg2) 680b5c07418SJames Feist { 681b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 682b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterMissing(arg1, arg2)); 683f4c4dcf4SKowalski, Kamil } 684f4c4dcf4SKowalski, Kamil 685f4c4dcf4SKowalski, Kamil /** 686f4c4dcf4SKowalski, Kamil * @internal 687f4c4dcf4SKowalski, Kamil * @brief Formats StringValueTooLong message into JSON 688f4c4dcf4SKowalski, Kamil * 689f4c4dcf4SKowalski, Kamil * See header file for more information 690f4c4dcf4SKowalski, Kamil * @endinternal 691f4c4dcf4SKowalski, Kamil */ 692b5c07418SJames Feist nlohmann::json stringValueTooLong(const std::string& arg1, const int& arg2) 6931abe55efSEd Tanous { 694b5c07418SJames Feist return nlohmann::json{ 6953e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 696684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.StringValueTooLong"}, 697f4c4dcf4SKowalski, Kamil {"Message", "The string " + arg1 + " exceeds the length limit " + 698f4c4dcf4SKowalski, Kamil std::to_string(arg2) + "."}, 69985659adfSJason M. Bills {"MessageArgs", {arg1, std::to_string(arg2)}}, 700684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 701f4c4dcf4SKowalski, Kamil {"Resolution", 702b5c07418SJames Feist "Resubmit the request with an appropriate string length."}}; 703b5c07418SJames Feist } 704b5c07418SJames Feist 705b5c07418SJames Feist void stringValueTooLong(crow::Response& res, const std::string& arg1, 706b5c07418SJames Feist const int& arg2) 707b5c07418SJames Feist { 708b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 709b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, stringValueTooLong(arg1, arg2)); 710f4c4dcf4SKowalski, Kamil } 711f4c4dcf4SKowalski, Kamil 712f4c4dcf4SKowalski, Kamil /** 713f4c4dcf4SKowalski, Kamil * @internal 714cc9139ecSJason M. Bills * @brief Formats SessionTerminated message into JSON 715cc9139ecSJason M. Bills * 716cc9139ecSJason M. Bills * See header file for more information 717cc9139ecSJason M. Bills * @endinternal 718cc9139ecSJason M. Bills */ 719b5c07418SJames Feist nlohmann::json sessionTerminated(void) 720cc9139ecSJason M. Bills { 721b5c07418SJames Feist return nlohmann::json{ 7223e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 723684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionTerminated"}, 724cc9139ecSJason M. Bills {"Message", "The session was successfully terminated."}, 72585659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 726684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 727b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 728b5c07418SJames Feist } 729b5c07418SJames Feist 730b5c07418SJames Feist void sessionTerminated(crow::Response& res) 731b5c07418SJames Feist { 732b5c07418SJames Feist res.result(boost::beast::http::status::ok); 733b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, sessionTerminated()); 734cc9139ecSJason M. Bills } 735cc9139ecSJason M. Bills 736cc9139ecSJason M. Bills /** 737cc9139ecSJason M. Bills * @internal 738684bb4b8SJason M. Bills * @brief Formats SubscriptionTerminated message into JSON 739684bb4b8SJason M. Bills * 740684bb4b8SJason M. Bills * See header file for more information 741684bb4b8SJason M. Bills * @endinternal 742684bb4b8SJason M. Bills */ 743684bb4b8SJason M. Bills nlohmann::json subscriptionTerminated(void) 744684bb4b8SJason M. Bills { 745684bb4b8SJason M. Bills return nlohmann::json{ 7463e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 747684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SubscriptionTerminated"}, 748684bb4b8SJason M. Bills {"Message", "The event subscription has been terminated."}, 749684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 750684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 751684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 752684bb4b8SJason M. Bills } 753684bb4b8SJason M. Bills 754684bb4b8SJason M. Bills void subscriptionTerminated(crow::Response& res) 755684bb4b8SJason M. Bills { 756684bb4b8SJason M. Bills res.result(boost::beast::http::status::ok); 757684bb4b8SJason M. Bills addMessageToJsonRoot(res.jsonValue, subscriptionTerminated()); 758684bb4b8SJason M. Bills } 759684bb4b8SJason M. Bills 760684bb4b8SJason M. Bills /** 761684bb4b8SJason M. Bills * @internal 762cc9139ecSJason M. Bills * @brief Formats ResourceTypeIncompatible message into JSON 763cc9139ecSJason M. Bills * 764cc9139ecSJason M. Bills * See header file for more information 765cc9139ecSJason M. Bills * @endinternal 766cc9139ecSJason M. Bills */ 767b5c07418SJames Feist nlohmann::json resourceTypeIncompatible(const std::string& arg1, 768cc9139ecSJason M. Bills const std::string& arg2) 769cc9139ecSJason M. Bills { 770b5c07418SJames Feist return nlohmann::json{ 7713e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 772684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceTypeIncompatible"}, 773cc9139ecSJason M. Bills {"Message", "The @odata.type of the request body " + arg1 + 774cc9139ecSJason M. Bills " is incompatible with the @odata.type of the " 775cc9139ecSJason M. Bills "resource which is " + 776cc9139ecSJason M. Bills arg2 + "."}, 77785659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 778684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 779cc9139ecSJason M. Bills {"Resolution", "Resubmit the request with a payload compatible " 780b5c07418SJames Feist "with the resource's schema."}}; 781b5c07418SJames Feist } 782b5c07418SJames Feist 783b5c07418SJames Feist void resourceTypeIncompatible(crow::Response& res, const std::string& arg1, 784b5c07418SJames Feist const std::string& arg2) 785b5c07418SJames Feist { 786b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 787b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceTypeIncompatible(arg1, arg2)); 788cc9139ecSJason M. Bills } 789cc9139ecSJason M. Bills 790cc9139ecSJason M. Bills /** 791cc9139ecSJason M. Bills * @internal 792684bb4b8SJason M. Bills * @brief Formats ResetRequired message into JSON 793684bb4b8SJason M. Bills * 794684bb4b8SJason M. Bills * See header file for more information 795684bb4b8SJason M. Bills * @endinternal 796684bb4b8SJason M. Bills */ 797684bb4b8SJason M. Bills nlohmann::json resetRequired(const std::string& arg1, const std::string& arg2) 798684bb4b8SJason M. Bills { 799684bb4b8SJason M. Bills return nlohmann::json{ 8003e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 801684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResetRequired"}, 802684bb4b8SJason M. Bills {"Message", "In order to complete the operation, a component reset is " 803684bb4b8SJason M. Bills "required with the Reset action URI '" + 804684bb4b8SJason M. Bills arg1 + "' and ResetType '" + arg2 + "'."}, 805684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 806684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 807684bb4b8SJason M. Bills {"Resolution", 808684bb4b8SJason M. Bills "Perform the required Reset action on the specified component."}}; 809684bb4b8SJason M. Bills } 810684bb4b8SJason M. Bills 811684bb4b8SJason M. Bills void resetRequired(crow::Response& res, const std::string& arg1, 812684bb4b8SJason M. Bills const std::string& arg2) 813684bb4b8SJason M. Bills { 814684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 815684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resetRequired(arg1, arg2)); 816684bb4b8SJason M. Bills } 817684bb4b8SJason M. Bills 818684bb4b8SJason M. Bills /** 819684bb4b8SJason M. Bills * @internal 820684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOnRequired message into JSON 821684bb4b8SJason M. Bills * 822684bb4b8SJason M. Bills * See header file for more information 823684bb4b8SJason M. Bills * @endinternal 824684bb4b8SJason M. Bills */ 825684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOnRequired(const std::string& arg1) 826684bb4b8SJason M. Bills { 827684bb4b8SJason M. Bills return nlohmann::json{ 8283e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 829684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOnRequired"}, 830684bb4b8SJason M. Bills {"Message", "The Chassis with Id '" + arg1 + 831684bb4b8SJason M. Bills "' requires to be powered on to perform this request."}, 832684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 833684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 834684bb4b8SJason M. Bills {"Resolution", 835684bb4b8SJason M. Bills "Power on the specified Chassis and resubmit the request."}}; 836684bb4b8SJason M. Bills } 837684bb4b8SJason M. Bills 838684bb4b8SJason M. Bills void chassisPowerStateOnRequired(crow::Response& res, const std::string& arg1) 839684bb4b8SJason M. Bills { 840684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 841684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOnRequired(arg1)); 842684bb4b8SJason M. Bills } 843684bb4b8SJason M. Bills 844684bb4b8SJason M. Bills /** 845684bb4b8SJason M. Bills * @internal 846684bb4b8SJason M. Bills * @brief Formats ChassisPowerStateOffRequired message into JSON 847684bb4b8SJason M. Bills * 848684bb4b8SJason M. Bills * See header file for more information 849684bb4b8SJason M. Bills * @endinternal 850684bb4b8SJason M. Bills */ 851684bb4b8SJason M. Bills nlohmann::json chassisPowerStateOffRequired(const std::string& arg1) 852684bb4b8SJason M. Bills { 853684bb4b8SJason M. Bills return nlohmann::json{ 8543e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 855684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ChassisPowerStateOffRequired"}, 856684bb4b8SJason M. Bills {"Message", 857684bb4b8SJason M. Bills "The Chassis with Id '" + arg1 + 858684bb4b8SJason M. Bills "' requires to be powered off to perform this request."}, 859684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 860684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 861684bb4b8SJason M. Bills {"Resolution", 862684bb4b8SJason M. Bills "Power off the specified Chassis and resubmit the request."}}; 863684bb4b8SJason M. Bills } 864684bb4b8SJason M. Bills 865684bb4b8SJason M. Bills void chassisPowerStateOffRequired(crow::Response& res, const std::string& arg1) 866684bb4b8SJason M. Bills { 867684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 868684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, chassisPowerStateOffRequired(arg1)); 869684bb4b8SJason M. Bills } 870684bb4b8SJason M. Bills 871684bb4b8SJason M. Bills /** 872684bb4b8SJason M. Bills * @internal 873684bb4b8SJason M. Bills * @brief Formats PropertyValueConflict message into JSON 874684bb4b8SJason M. Bills * 875684bb4b8SJason M. Bills * See header file for more information 876684bb4b8SJason M. Bills * @endinternal 877684bb4b8SJason M. Bills */ 878684bb4b8SJason M. Bills nlohmann::json propertyValueConflict(const std::string& arg1, 879684bb4b8SJason M. Bills const std::string& arg2) 880684bb4b8SJason M. Bills { 881684bb4b8SJason M. Bills return nlohmann::json{ 8823e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 883684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueConflict"}, 884684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 885684bb4b8SJason M. Bills "' could not be written because its value would " 886684bb4b8SJason M. Bills "conflict with the value of the '" + 887684bb4b8SJason M. Bills arg2 + "' property."}, 888684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 889684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 890684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 891684bb4b8SJason M. Bills } 892684bb4b8SJason M. Bills 893684bb4b8SJason M. Bills void propertyValueConflict(crow::Response& res, const std::string& arg1, 894684bb4b8SJason M. Bills const std::string& arg2) 895684bb4b8SJason M. Bills { 896684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 897684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueConflict(arg1, arg2)); 898684bb4b8SJason M. Bills } 899684bb4b8SJason M. Bills 900684bb4b8SJason M. Bills /** 901684bb4b8SJason M. Bills * @internal 902684bb4b8SJason M. Bills * @brief Formats PropertyValueIncorrect message into JSON 903684bb4b8SJason M. Bills * 904684bb4b8SJason M. Bills * See header file for more information 905684bb4b8SJason M. Bills * @endinternal 906684bb4b8SJason M. Bills */ 907684bb4b8SJason M. Bills nlohmann::json propertyValueIncorrect(const std::string& arg1, 908684bb4b8SJason M. Bills const std::string& arg2) 909684bb4b8SJason M. Bills { 910684bb4b8SJason M. Bills return nlohmann::json{ 9113e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 912684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueIncorrect"}, 913684bb4b8SJason M. Bills {"Message", "The property '" + arg1 + 914684bb4b8SJason M. Bills "' with the requested value of '" + arg2 + 915684bb4b8SJason M. Bills "' could not be written because the value does not " 916684bb4b8SJason M. Bills "meet the constraints of the implementation."}, 917684bb4b8SJason M. Bills {"MessageArgs", {arg1, arg2}}, 918684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 919684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 920684bb4b8SJason M. Bills } 921684bb4b8SJason M. Bills 922684bb4b8SJason M. Bills void propertyValueIncorrect(crow::Response& res, const std::string& arg1, 923684bb4b8SJason M. Bills const std::string& arg2) 924684bb4b8SJason M. Bills { 925684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 926684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2)); 927684bb4b8SJason M. Bills } 928684bb4b8SJason M. Bills 929684bb4b8SJason M. Bills /** 930684bb4b8SJason M. Bills * @internal 931684bb4b8SJason M. Bills * @brief Formats ResourceCreationConflict message into JSON 932684bb4b8SJason M. Bills * 933684bb4b8SJason M. Bills * See header file for more information 934684bb4b8SJason M. Bills * @endinternal 935684bb4b8SJason M. Bills */ 936684bb4b8SJason M. Bills nlohmann::json resourceCreationConflict(const std::string& arg1) 937684bb4b8SJason M. Bills { 938684bb4b8SJason M. Bills return nlohmann::json{ 9393e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 940684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceCreationConflict"}, 941684bb4b8SJason M. Bills {"Message", "The resource could not be created. The service has a " 942684bb4b8SJason M. Bills "resource at URI '" + 943684bb4b8SJason M. Bills arg1 + "' that conflicts with the creation request."}, 944684bb4b8SJason M. Bills {"MessageArgs", {arg1}}, 945684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 946684bb4b8SJason M. Bills {"Resolution", "No resolution is required."}}; 947684bb4b8SJason M. Bills } 948684bb4b8SJason M. Bills 949684bb4b8SJason M. Bills void resourceCreationConflict(crow::Response& res, const std::string& arg1) 950684bb4b8SJason M. Bills { 951684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 952684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); 953684bb4b8SJason M. Bills } 954684bb4b8SJason M. Bills 955684bb4b8SJason M. Bills /** 956684bb4b8SJason M. Bills * @internal 957684bb4b8SJason M. Bills * @brief Formats MaximumErrorsExceeded message into JSON 958684bb4b8SJason M. Bills * 959684bb4b8SJason M. Bills * See header file for more information 960684bb4b8SJason M. Bills * @endinternal 961684bb4b8SJason M. Bills */ 962684bb4b8SJason M. Bills nlohmann::json maximumErrorsExceeded(void) 963684bb4b8SJason M. Bills { 964684bb4b8SJason M. Bills return nlohmann::json{ 9653e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 966684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.MaximumErrorsExceeded"}, 967684bb4b8SJason M. Bills {"Message", "Too many errors have occurred to report them all."}, 968684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 969684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 970684bb4b8SJason M. Bills {"Resolution", 971684bb4b8SJason M. Bills "Resolve other reported errors and retry the current operation."}}; 972684bb4b8SJason M. Bills } 973684bb4b8SJason M. Bills 974684bb4b8SJason M. Bills void maximumErrorsExceeded(crow::Response& res) 975684bb4b8SJason M. Bills { 976684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 977684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, maximumErrorsExceeded()); 978684bb4b8SJason M. Bills } 979684bb4b8SJason M. Bills 980684bb4b8SJason M. Bills /** 981684bb4b8SJason M. Bills * @internal 982684bb4b8SJason M. Bills * @brief Formats PreconditionFailed message into JSON 983684bb4b8SJason M. Bills * 984684bb4b8SJason M. Bills * See header file for more information 985684bb4b8SJason M. Bills * @endinternal 986684bb4b8SJason M. Bills */ 987684bb4b8SJason M. Bills nlohmann::json preconditionFailed(void) 988684bb4b8SJason M. Bills { 989684bb4b8SJason M. Bills return nlohmann::json{ 9903e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 991684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionFailed"}, 992684bb4b8SJason M. Bills {"Message", "The ETag supplied did not match the ETag required to " 993684bb4b8SJason M. Bills "change this resource."}, 994684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 995684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 996684bb4b8SJason M. Bills {"Resolution", "Try the operation again using the appropriate ETag."}}; 997684bb4b8SJason M. Bills } 998684bb4b8SJason M. Bills 999684bb4b8SJason M. Bills void preconditionFailed(crow::Response& res) 1000684bb4b8SJason M. Bills { 10014df1bee0SEd Tanous res.result(boost::beast::http::status::precondition_failed); 1002684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionFailed()); 1003684bb4b8SJason M. Bills } 1004684bb4b8SJason M. Bills 1005684bb4b8SJason M. Bills /** 1006684bb4b8SJason M. Bills * @internal 1007684bb4b8SJason M. Bills * @brief Formats PreconditionRequired message into JSON 1008684bb4b8SJason M. Bills * 1009684bb4b8SJason M. Bills * See header file for more information 1010684bb4b8SJason M. Bills * @endinternal 1011684bb4b8SJason M. Bills */ 1012684bb4b8SJason M. Bills nlohmann::json preconditionRequired(void) 1013684bb4b8SJason M. Bills { 1014684bb4b8SJason M. Bills return nlohmann::json{ 10153e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1016684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PreconditionRequired"}, 1017684bb4b8SJason M. Bills {"Message", "A precondition header or annotation is required to change " 1018684bb4b8SJason M. Bills "this resource."}, 1019684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1020684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1021684bb4b8SJason M. Bills {"Resolution", "Try the operation again using an If-Match or " 1022684bb4b8SJason M. Bills "If-None-Match header and appropriate ETag."}}; 1023684bb4b8SJason M. Bills } 1024684bb4b8SJason M. Bills 1025684bb4b8SJason M. Bills void preconditionRequired(crow::Response& res) 1026684bb4b8SJason M. Bills { 1027684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1028684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, preconditionRequired()); 1029684bb4b8SJason M. Bills } 1030684bb4b8SJason M. Bills 1031684bb4b8SJason M. Bills /** 1032684bb4b8SJason M. Bills * @internal 1033684bb4b8SJason M. Bills * @brief Formats OperationFailed message into JSON 1034684bb4b8SJason M. Bills * 1035684bb4b8SJason M. Bills * See header file for more information 1036684bb4b8SJason M. Bills * @endinternal 1037684bb4b8SJason M. Bills */ 1038684bb4b8SJason M. Bills nlohmann::json operationFailed(void) 1039684bb4b8SJason M. Bills { 1040684bb4b8SJason M. Bills return nlohmann::json{ 10413e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1042684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationFailed"}, 1043684bb4b8SJason M. Bills {"Message", 1044684bb4b8SJason M. Bills "An error occurred internal to the service as part of the overall " 1045684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1046684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1047684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1048684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1049684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1050684bb4b8SJason M. Bills } 1051684bb4b8SJason M. Bills 1052684bb4b8SJason M. Bills void operationFailed(crow::Response& res) 1053684bb4b8SJason M. Bills { 1054684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1055684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationFailed()); 1056684bb4b8SJason M. Bills } 1057684bb4b8SJason M. Bills 1058684bb4b8SJason M. Bills /** 1059684bb4b8SJason M. Bills * @internal 1060684bb4b8SJason M. Bills * @brief Formats OperationTimeout message into JSON 1061684bb4b8SJason M. Bills * 1062684bb4b8SJason M. Bills * See header file for more information 1063684bb4b8SJason M. Bills * @endinternal 1064684bb4b8SJason M. Bills */ 1065684bb4b8SJason M. Bills nlohmann::json operationTimeout(void) 1066684bb4b8SJason M. Bills { 1067684bb4b8SJason M. Bills return nlohmann::json{ 10683e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1069684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.OperationTimeout"}, 1070684bb4b8SJason M. Bills {"Message", "A timeout internal to the service occured as part of the " 1071684bb4b8SJason M. Bills "request. Partial results may have been returned."}, 1072684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1073684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1074684bb4b8SJason M. Bills {"Resolution", "Resubmit the request. If the problem persists, " 1075684bb4b8SJason M. Bills "consider resetting the service or provider."}}; 1076684bb4b8SJason M. Bills } 1077684bb4b8SJason M. Bills 1078684bb4b8SJason M. Bills void operationTimeout(crow::Response& res) 1079684bb4b8SJason M. Bills { 1080684bb4b8SJason M. Bills res.result(boost::beast::http::status::internal_server_error); 1081684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, operationTimeout()); 1082684bb4b8SJason M. Bills } 1083684bb4b8SJason M. Bills 1084684bb4b8SJason M. Bills /** 1085684bb4b8SJason M. Bills * @internal 1086f12894f8SJason M. Bills * @brief Formats PropertyValueTypeError message into JSON for the specified 1087f12894f8SJason M. Bills * property 1088f12894f8SJason M. Bills * 1089f12894f8SJason M. Bills * See header file for more information 1090f12894f8SJason M. Bills * @endinternal 1091f12894f8SJason M. Bills */ 1092b5c07418SJames Feist nlohmann::json propertyValueTypeError(const std::string& arg1, 1093a08b46ccSJason M. Bills const std::string& arg2) 1094f12894f8SJason M. Bills { 1095b5c07418SJames Feist return nlohmann::json{ 10963e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1097684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueTypeError"}, 1098f12894f8SJason M. Bills {"Message", 1099f12894f8SJason M. Bills "The value " + arg1 + " for the property " + arg2 + 1100f12894f8SJason M. Bills " is of a different type than the property can accept."}, 110185659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1102684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 110366ac2b8cSJason M. Bills {"Resolution", 110466ac2b8cSJason M. Bills "Correct the value for the property in the request body and " 1105b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1106b5c07418SJames Feist } 1107b5c07418SJames Feist 1108b5c07418SJames Feist void propertyValueTypeError(crow::Response& res, const std::string& arg1, 1109b5c07418SJames Feist const std::string& arg2) 1110b5c07418SJames Feist { 1111b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1112b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2); 1113f4c4dcf4SKowalski, Kamil } 1114f4c4dcf4SKowalski, Kamil 1115f4c4dcf4SKowalski, Kamil /** 1116f4c4dcf4SKowalski, Kamil * @internal 1117f4c4dcf4SKowalski, Kamil * @brief Formats ResourceNotFound message into JSON 1118f4c4dcf4SKowalski, Kamil * 1119f4c4dcf4SKowalski, Kamil * See header file for more information 1120f4c4dcf4SKowalski, Kamil * @endinternal 1121f4c4dcf4SKowalski, Kamil */ 1122b5c07418SJames Feist nlohmann::json resourceNotFound(const std::string& arg1, 11231abe55efSEd Tanous const std::string& arg2) 11241abe55efSEd Tanous { 1125b5c07418SJames Feist return nlohmann::json{ 11263e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1127684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceNotFound"}, 11281abe55efSEd Tanous {"Message", "The requested resource of type " + arg1 + " named " + 11291abe55efSEd Tanous arg2 + " was not found."}, 113085659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1131684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1132f4c4dcf4SKowalski, Kamil {"Resolution", 1133b5c07418SJames Feist "Provide a valid resource identifier and resubmit the request."}}; 1134b5c07418SJames Feist } 1135b5c07418SJames Feist 1136b5c07418SJames Feist void resourceNotFound(crow::Response& res, const std::string& arg1, 1137b5c07418SJames Feist const std::string& arg2) 1138b5c07418SJames Feist { 1139b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1140b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2)); 1141f4c4dcf4SKowalski, Kamil } 1142f4c4dcf4SKowalski, Kamil 1143f4c4dcf4SKowalski, Kamil /** 1144f4c4dcf4SKowalski, Kamil * @internal 1145f4c4dcf4SKowalski, Kamil * @brief Formats CouldNotEstablishConnection message into JSON 1146f4c4dcf4SKowalski, Kamil * 1147f4c4dcf4SKowalski, Kamil * See header file for more information 1148f4c4dcf4SKowalski, Kamil * @endinternal 1149f4c4dcf4SKowalski, Kamil */ 1150b5c07418SJames Feist nlohmann::json couldNotEstablishConnection(const std::string& arg1) 11511abe55efSEd Tanous { 1152b5c07418SJames Feist return nlohmann::json{ 11533e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1154684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CouldNotEstablishConnection"}, 11551abe55efSEd Tanous {"Message", 1156684bb4b8SJason M. Bills "The service failed to establish a connection with the URI " + arg1 + 1157b5c07418SJames Feist "."}, 115885659adfSJason M. Bills {"MessageArgs", {arg1}}, 1159684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 116066ac2b8cSJason M. Bills {"Resolution", 116166ac2b8cSJason M. Bills "Ensure that the URI contains a valid and reachable node name, " 1162b5c07418SJames Feist "protocol information and other URI components."}}; 1163b5c07418SJames Feist } 1164b5c07418SJames Feist 1165b5c07418SJames Feist void couldNotEstablishConnection(crow::Response& res, const std::string& arg1) 1166b5c07418SJames Feist { 1167b5c07418SJames Feist res.result(boost::beast::http::status::not_found); 1168b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); 1169f4c4dcf4SKowalski, Kamil } 1170f4c4dcf4SKowalski, Kamil 1171f4c4dcf4SKowalski, Kamil /** 1172f4c4dcf4SKowalski, Kamil * @internal 1173f12894f8SJason M. Bills * @brief Formats PropertyNotWritable message into JSON for the specified 1174f12894f8SJason M. Bills * property 1175f12894f8SJason M. Bills * 1176f12894f8SJason M. Bills * See header file for more information 1177f12894f8SJason M. Bills * @endinternal 1178f12894f8SJason M. Bills */ 1179b5c07418SJames Feist nlohmann::json propertyNotWritable(const std::string& arg1) 1180f12894f8SJason M. Bills { 1181b5c07418SJames Feist return nlohmann::json{ 11823e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1183684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyNotWritable"}, 1184b5c07418SJames Feist {"Message", "The property " + arg1 + 1185b5c07418SJames Feist " is a read only property and cannot be " 1186b5c07418SJames Feist "assigned a value."}, 118785659adfSJason M. Bills {"MessageArgs", {arg1}}, 1188684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 118966ac2b8cSJason M. Bills {"Resolution", "Remove the property from the request body and " 1190b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1191b5c07418SJames Feist } 1192b5c07418SJames Feist 1193b5c07418SJames Feist void propertyNotWritable(crow::Response& res, const std::string& arg1) 1194b5c07418SJames Feist { 1195b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1196b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1); 1197f4c4dcf4SKowalski, Kamil } 1198f4c4dcf4SKowalski, Kamil 1199f4c4dcf4SKowalski, Kamil /** 1200f4c4dcf4SKowalski, Kamil * @internal 1201f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueTypeError message into JSON 1202f4c4dcf4SKowalski, Kamil * 1203f4c4dcf4SKowalski, Kamil * See header file for more information 1204f4c4dcf4SKowalski, Kamil * @endinternal 1205f4c4dcf4SKowalski, Kamil */ 1206b5c07418SJames Feist nlohmann::json queryParameterValueTypeError(const std::string& arg1, 12071abe55efSEd Tanous const std::string& arg2) 12081abe55efSEd Tanous { 1209b5c07418SJames Feist return nlohmann::json{ 12103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1211684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueTypeError"}, 12121abe55efSEd Tanous {"Message", 12131abe55efSEd Tanous "The value " + arg1 + " for the query parameter " + arg2 + 1214f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 121585659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1216684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 121766ac2b8cSJason M. Bills {"Resolution", 121866ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1219b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1220b5c07418SJames Feist } 1221b5c07418SJames Feist 1222b5c07418SJames Feist void queryParameterValueTypeError(crow::Response& res, const std::string& arg1, 1223b5c07418SJames Feist const std::string& arg2) 1224b5c07418SJames Feist { 1225b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1226b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1227b5c07418SJames Feist queryParameterValueTypeError(arg1, arg2)); 1228f4c4dcf4SKowalski, Kamil } 1229f4c4dcf4SKowalski, Kamil 1230f4c4dcf4SKowalski, Kamil /** 1231f4c4dcf4SKowalski, Kamil * @internal 1232f4c4dcf4SKowalski, Kamil * @brief Formats ServiceShuttingDown message into JSON 1233f4c4dcf4SKowalski, Kamil * 1234f4c4dcf4SKowalski, Kamil * See header file for more information 1235f4c4dcf4SKowalski, Kamil * @endinternal 1236f4c4dcf4SKowalski, Kamil */ 1237b5c07418SJames Feist nlohmann::json serviceShuttingDown(void) 12381abe55efSEd Tanous { 1239b5c07418SJames Feist return nlohmann::json{ 12403e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1241684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ServiceShuttingDown"}, 1242f12894f8SJason M. Bills {"Message", "The operation failed because the service is shutting " 124366ac2b8cSJason M. Bills "down and can no longer take incoming requests."}, 124485659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1245684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 124666ac2b8cSJason M. Bills {"Resolution", "When the service becomes available, resubmit the " 1247b5c07418SJames Feist "request if the operation failed."}}; 1248b5c07418SJames Feist } 1249b5c07418SJames Feist 1250b5c07418SJames Feist void serviceShuttingDown(crow::Response& res) 1251b5c07418SJames Feist { 1252b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1253b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, serviceShuttingDown()); 1254f4c4dcf4SKowalski, Kamil } 1255f4c4dcf4SKowalski, Kamil 1256f4c4dcf4SKowalski, Kamil /** 1257f4c4dcf4SKowalski, Kamil * @internal 1258f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterDuplicate message into JSON 1259f4c4dcf4SKowalski, Kamil * 1260f4c4dcf4SKowalski, Kamil * See header file for more information 1261f4c4dcf4SKowalski, Kamil * @endinternal 1262f4c4dcf4SKowalski, Kamil */ 1263b5c07418SJames Feist nlohmann::json actionParameterDuplicate(const std::string& arg1, 12641abe55efSEd Tanous const std::string& arg2) 12651abe55efSEd Tanous { 1266b5c07418SJames Feist return nlohmann::json{ 12673e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1268684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterDuplicate"}, 1269f4c4dcf4SKowalski, Kamil {"Message", 1270f4c4dcf4SKowalski, Kamil "The action " + arg1 + 12711abe55efSEd Tanous " was submitted with more than one value for the parameter " + 12721abe55efSEd Tanous arg2 + "."}, 127385659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1274684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 127566ac2b8cSJason M. Bills {"Resolution", 127666ac2b8cSJason M. Bills "Resubmit the action with only one instance of the parameter in " 1277b5c07418SJames Feist "the request body if the operation failed."}}; 1278b5c07418SJames Feist } 1279b5c07418SJames Feist 1280b5c07418SJames Feist void actionParameterDuplicate(crow::Response& res, const std::string& arg1, 1281b5c07418SJames Feist const std::string& arg2) 1282b5c07418SJames Feist { 1283b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1284b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2)); 1285f4c4dcf4SKowalski, Kamil } 1286f4c4dcf4SKowalski, Kamil 1287f4c4dcf4SKowalski, Kamil /** 1288f4c4dcf4SKowalski, Kamil * @internal 1289f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterNotSupported message into JSON 1290f4c4dcf4SKowalski, Kamil * 1291f4c4dcf4SKowalski, Kamil * See header file for more information 1292f4c4dcf4SKowalski, Kamil * @endinternal 1293f4c4dcf4SKowalski, Kamil */ 1294b5c07418SJames Feist nlohmann::json actionParameterNotSupported(const std::string& arg1, 12951abe55efSEd Tanous const std::string& arg2) 12961abe55efSEd Tanous { 1297b5c07418SJames Feist return nlohmann::json{ 12983e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1299684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterNotSupported"}, 1300f4c4dcf4SKowalski, Kamil {"Message", "The parameter " + arg1 + " for the action " + arg2 + 1301f4c4dcf4SKowalski, Kamil " is not supported on the target resource."}, 130285659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1303684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 130466ac2b8cSJason M. Bills {"Resolution", "Remove the parameter supplied and resubmit the " 1305b5c07418SJames Feist "request if the operation failed."}}; 1306b5c07418SJames Feist } 1307b5c07418SJames Feist 1308b5c07418SJames Feist void actionParameterNotSupported(crow::Response& res, const std::string& arg1, 1309b5c07418SJames Feist const std::string& arg2) 1310b5c07418SJames Feist { 1311b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1312b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1313b5c07418SJames Feist actionParameterNotSupported(arg1, arg2)); 1314f4c4dcf4SKowalski, Kamil } 1315f4c4dcf4SKowalski, Kamil 1316f4c4dcf4SKowalski, Kamil /** 1317f4c4dcf4SKowalski, Kamil * @internal 1318f4c4dcf4SKowalski, Kamil * @brief Formats SourceDoesNotSupportProtocol message into JSON 1319f4c4dcf4SKowalski, Kamil * 1320f4c4dcf4SKowalski, Kamil * See header file for more information 1321f4c4dcf4SKowalski, Kamil * @endinternal 1322f4c4dcf4SKowalski, Kamil */ 1323b5c07418SJames Feist nlohmann::json sourceDoesNotSupportProtocol(const std::string& arg1, 13241abe55efSEd Tanous const std::string& arg2) 13251abe55efSEd Tanous { 1326b5c07418SJames Feist return nlohmann::json{ 13273e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1328684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SourceDoesNotSupportProtocol"}, 1329684bb4b8SJason M. Bills {"Message", "The other end of the connection at " + arg1 + 13301abe55efSEd Tanous " does not support the specified protocol " + arg2 + 13311abe55efSEd Tanous "."}, 133285659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1333684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1334b5c07418SJames Feist {"Resolution", "Change protocols or URIs. "}}; 1335b5c07418SJames Feist } 1336b5c07418SJames Feist 1337b5c07418SJames Feist void sourceDoesNotSupportProtocol(crow::Response& res, const std::string& arg1, 1338b5c07418SJames Feist const std::string& arg2) 1339b5c07418SJames Feist { 1340b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1341b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1342b5c07418SJames Feist sourceDoesNotSupportProtocol(arg1, arg2)); 1343f4c4dcf4SKowalski, Kamil } 1344f4c4dcf4SKowalski, Kamil 1345f4c4dcf4SKowalski, Kamil /** 1346f4c4dcf4SKowalski, Kamil * @internal 1347f4c4dcf4SKowalski, Kamil * @brief Formats AccountRemoved message into JSON 1348f4c4dcf4SKowalski, Kamil * 1349f4c4dcf4SKowalski, Kamil * See header file for more information 1350f4c4dcf4SKowalski, Kamil * @endinternal 1351f4c4dcf4SKowalski, Kamil */ 1352b5c07418SJames Feist nlohmann::json accountRemoved(void) 13531abe55efSEd Tanous { 13543e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1355684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountRemoved"}, 1356f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully removed."}, 135785659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1358684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1359b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1360b5c07418SJames Feist } 1361b5c07418SJames Feist 1362b5c07418SJames Feist void accountRemoved(crow::Response& res) 1363b5c07418SJames Feist { 1364b5c07418SJames Feist res.result(boost::beast::http::status::ok); 1365b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, accountRemoved()); 1366f4c4dcf4SKowalski, Kamil } 1367f4c4dcf4SKowalski, Kamil 1368f4c4dcf4SKowalski, Kamil /** 1369f4c4dcf4SKowalski, Kamil * @internal 1370f4c4dcf4SKowalski, Kamil * @brief Formats AccessDenied message into JSON 1371f4c4dcf4SKowalski, Kamil * 1372f4c4dcf4SKowalski, Kamil * See header file for more information 1373f4c4dcf4SKowalski, Kamil * @endinternal 1374f4c4dcf4SKowalski, Kamil */ 1375b5c07418SJames Feist nlohmann::json accessDenied(const std::string& arg1) 13761abe55efSEd Tanous { 1377b5c07418SJames Feist return nlohmann::json{ 13783e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1379684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccessDenied"}, 1380684bb4b8SJason M. Bills {"Message", "While attempting to establish a connection to " + arg1 + 1381b5c07418SJames Feist ", the service denied access."}, 138285659adfSJason M. Bills {"MessageArgs", {arg1}}, 1383684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 138466ac2b8cSJason M. Bills {"Resolution", "Attempt to ensure that the URI is correct and that " 1385b5c07418SJames Feist "the service has the appropriate credentials."}}; 1386b5c07418SJames Feist } 1387b5c07418SJames Feist 1388b5c07418SJames Feist void accessDenied(crow::Response& res, const std::string& arg1) 1389b5c07418SJames Feist { 1390b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1391b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); 1392f4c4dcf4SKowalski, Kamil } 1393f4c4dcf4SKowalski, Kamil 1394f4c4dcf4SKowalski, Kamil /** 1395f4c4dcf4SKowalski, Kamil * @internal 1396f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupported message into JSON 1397f4c4dcf4SKowalski, Kamil * 1398f4c4dcf4SKowalski, Kamil * See header file for more information 1399f4c4dcf4SKowalski, Kamil * @endinternal 1400f4c4dcf4SKowalski, Kamil */ 1401b5c07418SJames Feist nlohmann::json queryNotSupported(void) 14021abe55efSEd Tanous { 1403b5c07418SJames Feist return nlohmann::json{ 14043e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1405684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupported"}, 1406f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported by the implementation."}, 140785659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1408684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 140966ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1410b5c07418SJames Feist "request if the operation failed."}}; 1411b5c07418SJames Feist } 1412b5c07418SJames Feist 1413b5c07418SJames Feist void queryNotSupported(crow::Response& res) 1414b5c07418SJames Feist { 1415b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1416b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupported()); 1417f4c4dcf4SKowalski, Kamil } 1418f4c4dcf4SKowalski, Kamil 1419f4c4dcf4SKowalski, Kamil /** 1420f4c4dcf4SKowalski, Kamil * @internal 1421f4c4dcf4SKowalski, Kamil * @brief Formats CreateLimitReachedForResource message into JSON 1422f4c4dcf4SKowalski, Kamil * 1423f4c4dcf4SKowalski, Kamil * See header file for more information 1424f4c4dcf4SKowalski, Kamil * @endinternal 1425f4c4dcf4SKowalski, Kamil */ 1426b5c07418SJames Feist nlohmann::json createLimitReachedForResource(void) 14271abe55efSEd Tanous { 1428b5c07418SJames Feist return nlohmann::json{ 14293e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1430684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.CreateLimitReachedForResource"}, 14311abe55efSEd Tanous {"Message", "The create operation failed because the resource has " 143266ac2b8cSJason M. Bills "reached the limit of possible resources."}, 143385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1434684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 143566ac2b8cSJason M. Bills {"Resolution", 143666ac2b8cSJason M. Bills "Either delete resources and resubmit the request if the " 1437b5c07418SJames Feist "operation failed or do not resubmit the request."}}; 1438b5c07418SJames Feist } 1439b5c07418SJames Feist 1440b5c07418SJames Feist void createLimitReachedForResource(crow::Response& res) 1441b5c07418SJames Feist { 1442b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1443b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, createLimitReachedForResource()); 1444f4c4dcf4SKowalski, Kamil } 1445f4c4dcf4SKowalski, Kamil 1446f4c4dcf4SKowalski, Kamil /** 1447f4c4dcf4SKowalski, Kamil * @internal 1448f4c4dcf4SKowalski, Kamil * @brief Formats GeneralError message into JSON 1449f4c4dcf4SKowalski, Kamil * 1450f4c4dcf4SKowalski, Kamil * See header file for more information 1451f4c4dcf4SKowalski, Kamil * @endinternal 1452f4c4dcf4SKowalski, Kamil */ 1453b5c07418SJames Feist nlohmann::json generalError(void) 14541abe55efSEd Tanous { 14553e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1456684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.GeneralError"}, 1457b7e069efSJames Feist {"Message", 1458b7e069efSJames Feist "A general error has occurred. See Resolution for " 1459cc9139ecSJason M. Bills "information on how to resolve the error."}, 146085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1461684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1462b5c07418SJames Feist {"Resolution", "None."}}; 1463b5c07418SJames Feist } 1464b5c07418SJames Feist 1465b5c07418SJames Feist void generalError(crow::Response& res) 1466b5c07418SJames Feist { 1467b5c07418SJames Feist res.result(boost::beast::http::status::internal_server_error); 1468b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, generalError()); 1469f4c4dcf4SKowalski, Kamil } 1470f4c4dcf4SKowalski, Kamil 1471f4c4dcf4SKowalski, Kamil /** 1472f4c4dcf4SKowalski, Kamil * @internal 1473f4c4dcf4SKowalski, Kamil * @brief Formats Success message into JSON 1474f4c4dcf4SKowalski, Kamil * 1475f4c4dcf4SKowalski, Kamil * See header file for more information 1476f4c4dcf4SKowalski, Kamil * @endinternal 1477f4c4dcf4SKowalski, Kamil */ 1478b5c07418SJames Feist nlohmann::json success(void) 14791abe55efSEd Tanous { 14803e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 1481684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Success"}, 1482f4c4dcf4SKowalski, Kamil {"Message", "Successfully Completed Request"}, 148385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1484684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1485b5c07418SJames Feist {"Resolution", "None"}}; 1486b5c07418SJames Feist } 1487b5c07418SJames Feist 1488b5c07418SJames Feist void success(crow::Response& res) 1489b5c07418SJames Feist { 1490b5c07418SJames Feist // don't set res.result here because success is the default and any 1491b5c07418SJames Feist // error should overwrite the default 1492b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, success()); 1493f12894f8SJason M. Bills } 1494f12894f8SJason M. Bills 1495f12894f8SJason M. Bills /** 1496f12894f8SJason M. Bills * @internal 1497f4c4dcf4SKowalski, Kamil * @brief Formats Created message into JSON 1498f4c4dcf4SKowalski, Kamil * 1499f4c4dcf4SKowalski, Kamil * See header file for more information 1500f4c4dcf4SKowalski, Kamil * @endinternal 1501f4c4dcf4SKowalski, Kamil */ 1502b5c07418SJames Feist nlohmann::json created(void) 15031abe55efSEd Tanous { 1504b5c07418SJames Feist return nlohmann::json{ 15053e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1506684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.Created"}, 1507f4c4dcf4SKowalski, Kamil {"Message", "The resource has been created successfully"}, 150885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1509684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 1510b5c07418SJames Feist {"Resolution", "None"}}; 1511b5c07418SJames Feist } 1512b5c07418SJames Feist 1513b5c07418SJames Feist void created(crow::Response& res) 1514b5c07418SJames Feist { 1515b5c07418SJames Feist res.result(boost::beast::http::status::created); 1516b5c07418SJames Feist addMessageToJsonRoot(res.jsonValue, created()); 1517f4c4dcf4SKowalski, Kamil } 1518f4c4dcf4SKowalski, Kamil 1519f4c4dcf4SKowalski, Kamil /** 1520f4c4dcf4SKowalski, Kamil * @internal 1521cc9139ecSJason M. Bills * @brief Formats NoOperation message into JSON 1522cc9139ecSJason M. Bills * 1523cc9139ecSJason M. Bills * See header file for more information 1524cc9139ecSJason M. Bills * @endinternal 1525cc9139ecSJason M. Bills */ 1526b5c07418SJames Feist nlohmann::json noOperation(void) 1527cc9139ecSJason M. Bills { 1528b5c07418SJames Feist return nlohmann::json{ 15293e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1530684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoOperation"}, 1531cc9139ecSJason M. Bills {"Message", "The request body submitted contain no data to act " 1532cc9139ecSJason M. Bills "upon and no changes to the resource took place."}, 153385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1534684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1535cc9139ecSJason M. Bills {"Resolution", 1536b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1537b5c07418SJames Feist } 1538b5c07418SJames Feist 1539b5c07418SJames Feist void noOperation(crow::Response& res) 1540b5c07418SJames Feist { 1541b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1542b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noOperation()); 1543cc9139ecSJason M. Bills } 1544cc9139ecSJason M. Bills 1545cc9139ecSJason M. Bills /** 1546cc9139ecSJason M. Bills * @internal 1547b5c07418SJames Feist * @brief Formats PropertyUnknown message into JSON for the specified 1548b5c07418SJames Feist * property 1549f12894f8SJason M. Bills * 1550f12894f8SJason M. Bills * See header file for more information 1551f12894f8SJason M. Bills * @endinternal 1552f12894f8SJason M. Bills */ 1553b5c07418SJames Feist nlohmann::json propertyUnknown(const std::string& arg1) 1554b5c07418SJames Feist { 1555b5c07418SJames Feist return nlohmann::json{ 15563e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1557684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyUnknown"}, 1558b5c07418SJames Feist {"Message", "The property " + arg1 + 1559b5c07418SJames Feist " is not in the list of valid properties for " 1560b5c07418SJames Feist "the resource."}, 1561b5c07418SJames Feist {"MessageArgs", {arg1}}, 1562684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1563b5c07418SJames Feist {"Resolution", "Remove the unknown property from the request " 1564b5c07418SJames Feist "body and resubmit " 1565b5c07418SJames Feist "the request if the operation failed."}}; 1566b5c07418SJames Feist } 1567b5c07418SJames Feist 1568a08b46ccSJason M. Bills void propertyUnknown(crow::Response& res, const std::string& arg1) 1569f12894f8SJason M. Bills { 1570f12894f8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1571b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyUnknown(arg1), arg1); 1572f4c4dcf4SKowalski, Kamil } 1573f4c4dcf4SKowalski, Kamil 1574f4c4dcf4SKowalski, Kamil /** 1575f4c4dcf4SKowalski, Kamil * @internal 1576f4c4dcf4SKowalski, Kamil * @brief Formats NoValidSession message into JSON 1577f4c4dcf4SKowalski, Kamil * 1578f4c4dcf4SKowalski, Kamil * See header file for more information 1579f4c4dcf4SKowalski, Kamil * @endinternal 1580f4c4dcf4SKowalski, Kamil */ 1581b5c07418SJames Feist nlohmann::json noValidSession(void) 15821abe55efSEd Tanous { 1583b5c07418SJames Feist return nlohmann::json{ 15843e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1585684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.NoValidSession"}, 1586f4c4dcf4SKowalski, Kamil {"Message", 1587f4c4dcf4SKowalski, Kamil "There is no valid session established with the implementation."}, 158885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1589684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 15901abe55efSEd Tanous {"Resolution", 1591684bb4b8SJason M. Bills "Establish a session before attempting any operations."}}; 1592b5c07418SJames Feist } 1593b5c07418SJames Feist 1594b5c07418SJames Feist void noValidSession(crow::Response& res) 1595b5c07418SJames Feist { 1596b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1597b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, noValidSession()); 1598f4c4dcf4SKowalski, Kamil } 1599f4c4dcf4SKowalski, Kamil 1600f4c4dcf4SKowalski, Kamil /** 1601f4c4dcf4SKowalski, Kamil * @internal 1602f4c4dcf4SKowalski, Kamil * @brief Formats InvalidObject message into JSON 1603f4c4dcf4SKowalski, Kamil * 1604f4c4dcf4SKowalski, Kamil * See header file for more information 1605f4c4dcf4SKowalski, Kamil * @endinternal 1606f4c4dcf4SKowalski, Kamil */ 1607b5c07418SJames Feist nlohmann::json invalidObject(const std::string& arg1) 16081abe55efSEd Tanous { 1609b5c07418SJames Feist return nlohmann::json{ 16103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1611684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidObject"}, 1612f4c4dcf4SKowalski, Kamil {"Message", "The object at " + arg1 + " is invalid."}, 161385659adfSJason M. Bills {"MessageArgs", {arg1}}, 1614684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1615f12894f8SJason M. Bills {"Resolution", 161666ac2b8cSJason M. Bills "Either the object is malformed or the URI is not correct. " 1617b5c07418SJames Feist "Correct the condition and resubmit the request if it failed."}}; 1618b5c07418SJames Feist } 1619b5c07418SJames Feist 1620b5c07418SJames Feist void invalidObject(crow::Response& res, const std::string& arg1) 1621b5c07418SJames Feist { 1622b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1623b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); 1624f4c4dcf4SKowalski, Kamil } 1625f4c4dcf4SKowalski, Kamil 1626f4c4dcf4SKowalski, Kamil /** 1627f4c4dcf4SKowalski, Kamil * @internal 1628f4c4dcf4SKowalski, Kamil * @brief Formats ResourceInStandby message into JSON 1629f4c4dcf4SKowalski, Kamil * 1630f4c4dcf4SKowalski, Kamil * See header file for more information 1631f4c4dcf4SKowalski, Kamil * @endinternal 1632f4c4dcf4SKowalski, Kamil */ 1633b5c07418SJames Feist nlohmann::json resourceInStandby(void) 16341abe55efSEd Tanous { 1635b5c07418SJames Feist return nlohmann::json{ 16363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1637684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceInStandby"}, 163866ac2b8cSJason M. Bills {"Message", "The request could not be performed because the " 163966ac2b8cSJason M. Bills "resource is in standby."}, 164085659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1641684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1642f12894f8SJason M. Bills {"Resolution", "Ensure that the resource is in the correct power " 1643b5c07418SJames Feist "state and resubmit the request."}}; 1644b5c07418SJames Feist } 1645b5c07418SJames Feist 1646b5c07418SJames Feist void resourceInStandby(crow::Response& res) 1647b5c07418SJames Feist { 1648b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1649b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceInStandby()); 1650f4c4dcf4SKowalski, Kamil } 1651f4c4dcf4SKowalski, Kamil 1652f4c4dcf4SKowalski, Kamil /** 1653f4c4dcf4SKowalski, Kamil * @internal 1654f4c4dcf4SKowalski, Kamil * @brief Formats ActionParameterValueTypeError message into JSON 1655f4c4dcf4SKowalski, Kamil * 1656f4c4dcf4SKowalski, Kamil * See header file for more information 1657f4c4dcf4SKowalski, Kamil * @endinternal 1658f4c4dcf4SKowalski, Kamil */ 1659b5c07418SJames Feist nlohmann::json actionParameterValueTypeError(const std::string& arg1, 1660f4c4dcf4SKowalski, Kamil const std::string& arg2, 16611abe55efSEd Tanous const std::string& arg3) 16621abe55efSEd Tanous { 1663b5c07418SJames Feist return nlohmann::json{ 16643e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1665684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionParameterValueTypeError"}, 16661abe55efSEd Tanous {"Message", 16671abe55efSEd Tanous "The value " + arg1 + " for the parameter " + arg2 + 1668f4c4dcf4SKowalski, Kamil " in the action " + arg3 + 1669f4c4dcf4SKowalski, Kamil " is of a different type than the parameter can accept."}, 167085659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 1671684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 167266ac2b8cSJason M. Bills {"Resolution", 167366ac2b8cSJason M. Bills "Correct the value for the parameter in the request body and " 1674b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1675b5c07418SJames Feist } 1676b5c07418SJames Feist 1677b5c07418SJames Feist void actionParameterValueTypeError(crow::Response& res, const std::string& arg1, 1678b5c07418SJames Feist const std::string& arg2, 1679b5c07418SJames Feist const std::string& arg3) 1680b5c07418SJames Feist { 1681b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1682b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1683b5c07418SJames Feist actionParameterValueTypeError(arg1, arg2, arg3)); 1684f4c4dcf4SKowalski, Kamil } 1685f4c4dcf4SKowalski, Kamil 1686f4c4dcf4SKowalski, Kamil /** 1687f4c4dcf4SKowalski, Kamil * @internal 1688f4c4dcf4SKowalski, Kamil * @brief Formats SessionLimitExceeded message into JSON 1689f4c4dcf4SKowalski, Kamil * 1690f4c4dcf4SKowalski, Kamil * See header file for more information 1691f4c4dcf4SKowalski, Kamil * @endinternal 1692f4c4dcf4SKowalski, Kamil */ 1693b5c07418SJames Feist nlohmann::json sessionLimitExceeded(void) 16941abe55efSEd Tanous { 1695b5c07418SJames Feist return nlohmann::json{ 16963e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1697684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.SessionLimitExceeded"}, 1698f12894f8SJason M. Bills {"Message", "The session establishment failed due to the number of " 169966ac2b8cSJason M. Bills "simultaneous sessions exceeding the limit of the " 170066ac2b8cSJason M. Bills "implementation."}, 170185659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1702684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 170366ac2b8cSJason M. Bills {"Resolution", "Reduce the number of other sessions before trying " 170466ac2b8cSJason M. Bills "to establish the session or increase the limit of " 1705b5c07418SJames Feist "simultaneous sessions (if supported)."}}; 1706b5c07418SJames Feist } 1707b5c07418SJames Feist 1708b5c07418SJames Feist void sessionLimitExceeded(crow::Response& res) 1709b5c07418SJames Feist { 1710b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 1711b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, sessionLimitExceeded()); 1712f4c4dcf4SKowalski, Kamil } 1713f4c4dcf4SKowalski, Kamil 1714f4c4dcf4SKowalski, Kamil /** 1715f4c4dcf4SKowalski, Kamil * @internal 1716f4c4dcf4SKowalski, Kamil * @brief Formats ActionNotSupported message into JSON 1717f4c4dcf4SKowalski, Kamil * 1718f4c4dcf4SKowalski, Kamil * See header file for more information 1719f4c4dcf4SKowalski, Kamil * @endinternal 1720f4c4dcf4SKowalski, Kamil */ 1721b5c07418SJames Feist nlohmann::json actionNotSupported(const std::string& arg1) 17221abe55efSEd Tanous { 1723b5c07418SJames Feist return nlohmann::json{ 17243e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1725684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ActionNotSupported"}, 17261abe55efSEd Tanous {"Message", 17271abe55efSEd Tanous "The action " + arg1 + " is not supported by the resource."}, 172885659adfSJason M. Bills {"MessageArgs", {arg1}}, 1729684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1730f4c4dcf4SKowalski, Kamil {"Resolution", 1731f4c4dcf4SKowalski, Kamil "The action supplied cannot be resubmitted to the implementation. " 1732f12894f8SJason M. Bills " Perhaps the action was invalid, the wrong resource was the " 173366ac2b8cSJason M. Bills "target or the implementation documentation may be of " 1734b5c07418SJames Feist "assistance."}}; 1735b5c07418SJames Feist } 1736b5c07418SJames Feist 1737b5c07418SJames Feist void actionNotSupported(crow::Response& res, const std::string& arg1) 1738b5c07418SJames Feist { 1739b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1740b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1)); 1741f4c4dcf4SKowalski, Kamil } 1742f4c4dcf4SKowalski, Kamil 1743f4c4dcf4SKowalski, Kamil /** 1744f4c4dcf4SKowalski, Kamil * @internal 1745f4c4dcf4SKowalski, Kamil * @brief Formats InvalidIndex message into JSON 1746f4c4dcf4SKowalski, Kamil * 1747f4c4dcf4SKowalski, Kamil * See header file for more information 1748f4c4dcf4SKowalski, Kamil * @endinternal 1749f4c4dcf4SKowalski, Kamil */ 1750b5c07418SJames Feist nlohmann::json invalidIndex(const int& arg1) 17511abe55efSEd Tanous { 1752b5c07418SJames Feist return nlohmann::json{ 17533e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1754684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InvalidIndex"}, 1755684bb4b8SJason M. Bills {"Message", "The Index " + std::to_string(arg1) + 1756f4c4dcf4SKowalski, Kamil " is not a valid offset into the array."}, 175785659adfSJason M. Bills {"MessageArgs", {std::to_string(arg1)}}, 1758684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1759f12894f8SJason M. Bills {"Resolution", "Verify the index value provided is within the " 1760b5c07418SJames Feist "bounds of the array."}}; 1761b5c07418SJames Feist } 1762b5c07418SJames Feist 1763b5c07418SJames Feist void invalidIndex(crow::Response& res, const int& arg1) 1764b5c07418SJames Feist { 1765b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1766b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, invalidIndex(arg1)); 1767f4c4dcf4SKowalski, Kamil } 1768f4c4dcf4SKowalski, Kamil 1769f4c4dcf4SKowalski, Kamil /** 1770f4c4dcf4SKowalski, Kamil * @internal 1771f4c4dcf4SKowalski, Kamil * @brief Formats EmptyJSON message into JSON 1772f4c4dcf4SKowalski, Kamil * 1773f4c4dcf4SKowalski, Kamil * See header file for more information 1774f4c4dcf4SKowalski, Kamil * @endinternal 1775f4c4dcf4SKowalski, Kamil */ 1776b5c07418SJames Feist nlohmann::json emptyJSON(void) 17771abe55efSEd Tanous { 1778b5c07418SJames Feist return nlohmann::json{ 17793e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1780684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.EmptyJSON"}, 1781f12894f8SJason M. Bills {"Message", "The request body submitted contained an empty JSON " 178266ac2b8cSJason M. Bills "object and the service is unable to process it."}, 178385659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1784684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1785f4c4dcf4SKowalski, Kamil {"Resolution", 1786b5c07418SJames Feist "Add properties in the JSON object and resubmit the request."}}; 1787b5c07418SJames Feist } 1788b5c07418SJames Feist 1789b5c07418SJames Feist void emptyJSON(crow::Response& res) 1790b5c07418SJames Feist { 1791b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1792b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, emptyJSON()); 1793f4c4dcf4SKowalski, Kamil } 1794f4c4dcf4SKowalski, Kamil 1795f4c4dcf4SKowalski, Kamil /** 1796f4c4dcf4SKowalski, Kamil * @internal 1797f4c4dcf4SKowalski, Kamil * @brief Formats QueryNotSupportedOnResource message into JSON 1798f4c4dcf4SKowalski, Kamil * 1799f4c4dcf4SKowalski, Kamil * See header file for more information 1800f4c4dcf4SKowalski, Kamil * @endinternal 1801f4c4dcf4SKowalski, Kamil */ 1802b5c07418SJames Feist nlohmann::json queryNotSupportedOnResource(void) 18031abe55efSEd Tanous { 1804b5c07418SJames Feist return nlohmann::json{ 18053e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1806684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnResource"}, 1807f4c4dcf4SKowalski, Kamil {"Message", "Querying is not supported on the requested resource."}, 180885659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1809684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 181066ac2b8cSJason M. Bills {"Resolution", "Remove the query parameters and resubmit the " 1811b5c07418SJames Feist "request if the operation failed."}}; 1812b5c07418SJames Feist } 1813b5c07418SJames Feist 1814b5c07418SJames Feist void queryNotSupportedOnResource(crow::Response& res) 1815b5c07418SJames Feist { 1816b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1817b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource()); 1818f4c4dcf4SKowalski, Kamil } 1819f4c4dcf4SKowalski, Kamil 1820f4c4dcf4SKowalski, Kamil /** 1821f4c4dcf4SKowalski, Kamil * @internal 1822684bb4b8SJason M. Bills * @brief Formats QueryNotSupportedOnOperation message into JSON 1823684bb4b8SJason M. Bills * 1824684bb4b8SJason M. Bills * See header file for more information 1825684bb4b8SJason M. Bills * @endinternal 1826684bb4b8SJason M. Bills */ 1827684bb4b8SJason M. Bills nlohmann::json queryNotSupportedOnOperation(void) 1828684bb4b8SJason M. Bills { 1829684bb4b8SJason M. Bills return nlohmann::json{ 18303e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1831684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryNotSupportedOnOperation"}, 1832684bb4b8SJason M. Bills {"Message", "Querying is not supported with the requested operation."}, 1833684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1834684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1835684bb4b8SJason M. Bills {"Resolution", "Remove the query parameters and resubmit the request " 1836684bb4b8SJason M. Bills "if the operation failed."}}; 1837684bb4b8SJason M. Bills } 1838684bb4b8SJason M. Bills 1839684bb4b8SJason M. Bills void queryNotSupportedOnOperation(crow::Response& res) 1840684bb4b8SJason M. Bills { 1841684bb4b8SJason M. Bills res.result(boost::beast::http::status::forbidden); 1842684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation()); 1843684bb4b8SJason M. Bills } 1844684bb4b8SJason M. Bills 1845684bb4b8SJason M. Bills /** 1846684bb4b8SJason M. Bills * @internal 1847684bb4b8SJason M. Bills * @brief Formats QueryCombinationInvalid message into JSON 1848684bb4b8SJason M. Bills * 1849684bb4b8SJason M. Bills * See header file for more information 1850684bb4b8SJason M. Bills * @endinternal 1851684bb4b8SJason M. Bills */ 1852684bb4b8SJason M. Bills nlohmann::json queryCombinationInvalid(void) 1853684bb4b8SJason M. Bills { 1854684bb4b8SJason M. Bills return nlohmann::json{ 18553e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1856684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryCombinationInvalid"}, 1857684bb4b8SJason M. Bills {"Message", "Two or more query parameters in the request cannot be " 1858684bb4b8SJason M. Bills "used together."}, 1859684bb4b8SJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1860684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1861684bb4b8SJason M. Bills {"Resolution", "Remove one or more of the query parameters and " 1862684bb4b8SJason M. Bills "resubmit the request if the operation failed."}}; 1863684bb4b8SJason M. Bills } 1864684bb4b8SJason M. Bills 1865684bb4b8SJason M. Bills void queryCombinationInvalid(crow::Response& res) 1866684bb4b8SJason M. Bills { 1867684bb4b8SJason M. Bills res.result(boost::beast::http::status::bad_request); 1868684bb4b8SJason M. Bills addMessageToErrorJson(res.jsonValue, queryCombinationInvalid()); 1869684bb4b8SJason M. Bills } 1870684bb4b8SJason M. Bills 1871684bb4b8SJason M. Bills /** 1872684bb4b8SJason M. Bills * @internal 1873f4c4dcf4SKowalski, Kamil * @brief Formats InsufficientPrivilege message into JSON 1874f4c4dcf4SKowalski, Kamil * 1875f4c4dcf4SKowalski, Kamil * See header file for more information 1876f4c4dcf4SKowalski, Kamil * @endinternal 1877f4c4dcf4SKowalski, Kamil */ 1878b5c07418SJames Feist nlohmann::json insufficientPrivilege(void) 18791abe55efSEd Tanous { 1880b5c07418SJames Feist return nlohmann::json{ 18813e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1882684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.InsufficientPrivilege"}, 188366ac2b8cSJason M. Bills {"Message", "There are insufficient privileges for the account or " 188466ac2b8cSJason M. Bills "credentials associated with the current session to " 188566ac2b8cSJason M. Bills "perform the requested operation."}, 188685659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1887684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 1888f4c4dcf4SKowalski, Kamil {"Resolution", 1889f12894f8SJason M. Bills "Either abandon the operation or change the associated access " 1890b5c07418SJames Feist "rights and resubmit the request if the operation failed."}}; 1891b5c07418SJames Feist } 1892b5c07418SJames Feist 1893b5c07418SJames Feist void insufficientPrivilege(crow::Response& res) 1894b5c07418SJames Feist { 1895b5c07418SJames Feist res.result(boost::beast::http::status::forbidden); 1896b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, insufficientPrivilege()); 1897f4c4dcf4SKowalski, Kamil } 1898f4c4dcf4SKowalski, Kamil 1899f4c4dcf4SKowalski, Kamil /** 1900f4c4dcf4SKowalski, Kamil * @internal 1901f4c4dcf4SKowalski, Kamil * @brief Formats PropertyValueModified message into JSON 1902f4c4dcf4SKowalski, Kamil * 1903f4c4dcf4SKowalski, Kamil * See header file for more information 1904f4c4dcf4SKowalski, Kamil * @endinternal 1905f4c4dcf4SKowalski, Kamil */ 1906b5c07418SJames Feist nlohmann::json propertyValueModified(const std::string& arg1, 1907b5c07418SJames Feist const std::string& arg2) 1908b5c07418SJames Feist { 1909b5c07418SJames Feist return nlohmann::json{ 19103e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1911684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyValueModified"}, 1912b5c07418SJames Feist {"Message", "The property " + arg1 + " was assigned the value " + arg2 + 1913b5c07418SJames Feist " due to modification by the service."}, 1914b5c07418SJames Feist {"MessageArgs", {arg1, arg2}}, 1915684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1916b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 1917b5c07418SJames Feist } 1918b5c07418SJames Feist 1919f12894f8SJason M. Bills void propertyValueModified(crow::Response& res, const std::string& arg1, 1920a08b46ccSJason M. Bills const std::string& arg2) 19211abe55efSEd Tanous { 1922f12894f8SJason M. Bills res.result(boost::beast::http::status::ok); 1923b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1); 1924f4c4dcf4SKowalski, Kamil } 1925f4c4dcf4SKowalski, Kamil 1926f4c4dcf4SKowalski, Kamil /** 1927f4c4dcf4SKowalski, Kamil * @internal 1928f4c4dcf4SKowalski, Kamil * @brief Formats AccountNotModified message into JSON 1929f4c4dcf4SKowalski, Kamil * 1930f4c4dcf4SKowalski, Kamil * See header file for more information 1931f4c4dcf4SKowalski, Kamil * @endinternal 1932f4c4dcf4SKowalski, Kamil */ 1933b5c07418SJames Feist nlohmann::json accountNotModified(void) 19341abe55efSEd Tanous { 1935b5c07418SJames Feist return nlohmann::json{ 19363e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1937684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountNotModified"}, 1938f4c4dcf4SKowalski, Kamil {"Message", "The account modification request failed."}, 193985659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 1940684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 1941f12894f8SJason M. Bills {"Resolution", "The modification may have failed due to permission " 1942b5c07418SJames Feist "issues or issues with the request body."}}; 1943b5c07418SJames Feist } 1944b5c07418SJames Feist 1945b5c07418SJames Feist void accountNotModified(crow::Response& res) 1946b5c07418SJames Feist { 1947b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1948b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountNotModified()); 1949f4c4dcf4SKowalski, Kamil } 1950f4c4dcf4SKowalski, Kamil 1951f4c4dcf4SKowalski, Kamil /** 1952f4c4dcf4SKowalski, Kamil * @internal 1953f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterValueFormatError message into JSON 1954f4c4dcf4SKowalski, Kamil * 1955f4c4dcf4SKowalski, Kamil * See header file for more information 1956f4c4dcf4SKowalski, Kamil * @endinternal 1957f4c4dcf4SKowalski, Kamil */ 1958b5c07418SJames Feist nlohmann::json queryParameterValueFormatError(const std::string& arg1, 19591abe55efSEd Tanous const std::string& arg2) 19601abe55efSEd Tanous { 1961b5c07418SJames Feist return nlohmann::json{ 19623e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1963684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterValueFormatError"}, 1964f4c4dcf4SKowalski, Kamil {"Message", 1965f4c4dcf4SKowalski, Kamil "The value " + arg1 + " for the parameter " + arg2 + 1966f4c4dcf4SKowalski, Kamil " is of a different format than the parameter can accept."}, 196785659adfSJason M. Bills {"MessageArgs", {arg1, arg2}}, 1968684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 196966ac2b8cSJason M. Bills {"Resolution", 197066ac2b8cSJason M. Bills "Correct the value for the query parameter in the request and " 1971b5c07418SJames Feist "resubmit the request if the operation failed."}}; 1972b5c07418SJames Feist } 1973b5c07418SJames Feist 1974b5c07418SJames Feist void queryParameterValueFormatError(crow::Response& res, 1975b5c07418SJames Feist const std::string& arg1, 1976b5c07418SJames Feist const std::string& arg2) 1977b5c07418SJames Feist { 1978b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 1979b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 1980b5c07418SJames Feist queryParameterValueFormatError(arg1, arg2)); 1981f4c4dcf4SKowalski, Kamil } 1982f4c4dcf4SKowalski, Kamil 1983f4c4dcf4SKowalski, Kamil /** 1984f4c4dcf4SKowalski, Kamil * @internal 1985b5c07418SJames Feist * @brief Formats PropertyMissing message into JSON for the specified 1986b5c07418SJames Feist * property 1987f12894f8SJason M. Bills * 1988f12894f8SJason M. Bills * See header file for more information 1989f12894f8SJason M. Bills * @endinternal 1990f12894f8SJason M. Bills */ 1991b5c07418SJames Feist nlohmann::json propertyMissing(const std::string& arg1) 1992f12894f8SJason M. Bills { 1993b5c07418SJames Feist return nlohmann::json{ 19943e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 1995684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PropertyMissing"}, 1996f12894f8SJason M. Bills {"Message", "The property " + arg1 + 1997f12894f8SJason M. Bills " is a required property and must be included in " 1998f12894f8SJason M. Bills "the request."}, 199985659adfSJason M. Bills {"MessageArgs", {arg1}}, 2000684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2001f12894f8SJason M. Bills {"Resolution", 2002b5c07418SJames Feist "Ensure that the property is in the request body and has a " 2003b5c07418SJames Feist "valid " 2004b5c07418SJames Feist "value and resubmit the request if the operation failed."}}; 2005b5c07418SJames Feist } 2006b5c07418SJames Feist 2007b5c07418SJames Feist void propertyMissing(crow::Response& res, const std::string& arg1) 2008b5c07418SJames Feist { 2009b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2010b5c07418SJames Feist addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1); 2011f4c4dcf4SKowalski, Kamil } 2012f4c4dcf4SKowalski, Kamil 2013f4c4dcf4SKowalski, Kamil /** 2014f4c4dcf4SKowalski, Kamil * @internal 2015f4c4dcf4SKowalski, Kamil * @brief Formats ResourceExhaustion message into JSON 2016f4c4dcf4SKowalski, Kamil * 2017f4c4dcf4SKowalski, Kamil * See header file for more information 2018f4c4dcf4SKowalski, Kamil * @endinternal 2019f4c4dcf4SKowalski, Kamil */ 2020b5c07418SJames Feist nlohmann::json resourceExhaustion(const std::string& arg1) 20211abe55efSEd Tanous { 2022b5c07418SJames Feist return nlohmann::json{ 20233e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2024684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.ResourceExhaustion"}, 2025d425c6f6SEd Tanous {"Message", "The resource " + arg1 + 202666ac2b8cSJason M. Bills " was unable to satisfy the request due to " 202766ac2b8cSJason M. Bills "unavailability of resources."}, 202885659adfSJason M. Bills {"MessageArgs", {arg1}}, 2029684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 2030f12894f8SJason M. Bills {"Resolution", "Ensure that the resources are available and " 2031b5c07418SJames Feist "resubmit the request."}}; 2032b5c07418SJames Feist } 2033b5c07418SJames Feist 2034b5c07418SJames Feist void resourceExhaustion(crow::Response& res, const std::string& arg1) 2035b5c07418SJames Feist { 2036b5c07418SJames Feist res.result(boost::beast::http::status::service_unavailable); 2037b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1)); 2038f4c4dcf4SKowalski, Kamil } 2039f4c4dcf4SKowalski, Kamil 2040f4c4dcf4SKowalski, Kamil /** 2041f4c4dcf4SKowalski, Kamil * @internal 2042f4c4dcf4SKowalski, Kamil * @brief Formats AccountModified message into JSON 2043f4c4dcf4SKowalski, Kamil * 2044f4c4dcf4SKowalski, Kamil * See header file for more information 2045f4c4dcf4SKowalski, Kamil * @endinternal 2046f4c4dcf4SKowalski, Kamil */ 2047b5c07418SJames Feist nlohmann::json accountModified(void) 20481abe55efSEd Tanous { 20493e082749SAsmitha Karunanithi return nlohmann::json{{"@odata.type", "#Message.v1_1_1.Message"}, 2050684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.AccountModified"}, 2051f4c4dcf4SKowalski, Kamil {"Message", "The account was successfully modified."}, 205285659adfSJason M. Bills {"MessageArgs", nlohmann::json::array()}, 2053684bb4b8SJason M. Bills {"MessageSeverity", "OK"}, 2054b5c07418SJames Feist {"Resolution", "No resolution is required."}}; 2055b5c07418SJames Feist } 2056b5c07418SJames Feist 2057b5c07418SJames Feist void accountModified(crow::Response& res) 2058b5c07418SJames Feist { 2059b5c07418SJames Feist res.result(boost::beast::http::status::ok); 2060b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, accountModified()); 2061f4c4dcf4SKowalski, Kamil } 2062f4c4dcf4SKowalski, Kamil 2063f4c4dcf4SKowalski, Kamil /** 2064f4c4dcf4SKowalski, Kamil * @internal 2065f4c4dcf4SKowalski, Kamil * @brief Formats QueryParameterOutOfRange message into JSON 2066f4c4dcf4SKowalski, Kamil * 2067f4c4dcf4SKowalski, Kamil * See header file for more information 2068f4c4dcf4SKowalski, Kamil * @endinternal 2069f4c4dcf4SKowalski, Kamil */ 2070b5c07418SJames Feist nlohmann::json queryParameterOutOfRange(const std::string& arg1, 2071b5c07418SJames Feist const std::string& arg2, 2072b5c07418SJames Feist const std::string& arg3) 20731abe55efSEd Tanous { 2074b5c07418SJames Feist return nlohmann::json{ 20753e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2076684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.QueryParameterOutOfRange"}, 2077b5c07418SJames Feist {"Message", "The value " + arg1 + " for the query parameter " + arg2 + 2078b5c07418SJames Feist " is out of range " + arg3 + "."}, 207985659adfSJason M. Bills {"MessageArgs", {arg1, arg2, arg3}}, 2080684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2081f4c4dcf4SKowalski, Kamil {"Resolution", 2082f12894f8SJason M. Bills "Reduce the value for the query parameter to a value that is " 208366ac2b8cSJason M. Bills "within range, such as a start or count value that is within " 208466ac2b8cSJason M. Bills "bounds of the number of resources in a collection or a page that " 2085b5c07418SJames Feist "is within the range of valid pages."}}; 2086b5c07418SJames Feist } 2087b5c07418SJames Feist 2088b5c07418SJames Feist void queryParameterOutOfRange(crow::Response& res, const std::string& arg1, 2089b5c07418SJames Feist const std::string& arg2, const std::string& arg3) 2090b5c07418SJames Feist { 2091b5c07418SJames Feist res.result(boost::beast::http::status::bad_request); 2092b5c07418SJames Feist addMessageToErrorJson(res.jsonValue, 2093b5c07418SJames Feist queryParameterOutOfRange(arg1, arg2, arg3)); 2094f4c4dcf4SKowalski, Kamil } 2095f4c4dcf4SKowalski, Kamil 20963bf4e632SJoseph Reynolds /** 20973bf4e632SJoseph Reynolds * @internal 20983bf4e632SJoseph Reynolds * @brief Formats PasswordChangeRequired message into JSON 20993bf4e632SJoseph Reynolds * 21003bf4e632SJoseph Reynolds * See header file for more information 21013bf4e632SJoseph Reynolds * @endinternal 21023bf4e632SJoseph Reynolds */ 21033bf4e632SJoseph Reynolds void passwordChangeRequired(crow::Response& res, const std::string& arg1) 21043bf4e632SJoseph Reynolds { 21053bf4e632SJoseph Reynolds messages::addMessageToJsonRoot( 21063bf4e632SJoseph Reynolds res.jsonValue, 21073bf4e632SJoseph Reynolds nlohmann::json{ 21083bf4e632SJoseph Reynolds {"@odata.type", "/redfish/v1/$metadata#Message.v1_5_0.Message"}, 2109684bb4b8SJason M. Bills {"MessageId", "Base.1.8.1.PasswordChangeRequired"}, 21103bf4e632SJoseph Reynolds {"Message", "The password provided for this account must be " 21113bf4e632SJoseph Reynolds "changed before access is granted. PATCH the " 21123bf4e632SJoseph Reynolds "'Password' property for this account located at " 21133bf4e632SJoseph Reynolds "the target URI '" + 21143bf4e632SJoseph Reynolds arg1 + "' to complete this process."}, 21153bf4e632SJoseph Reynolds {"MessageArgs", {arg1}}, 2116684bb4b8SJason M. Bills {"MessageSeverity", "Critical"}, 21173bf4e632SJoseph Reynolds {"Resolution", "Change the password for this account using " 21183bf4e632SJoseph Reynolds "a PATCH to the 'Password' property at the URI " 21193bf4e632SJoseph Reynolds "provided."}}); 21203bf4e632SJoseph Reynolds } 21213bf4e632SJoseph Reynolds 21224cde5d90SJames Feist void invalidUpload(crow::Response& res, const std::string& arg1, 21234cde5d90SJames Feist const std::string& arg2) 21244cde5d90SJames Feist { 21254cde5d90SJames Feist res.result(boost::beast::http::status::bad_request); 21264cde5d90SJames Feist addMessageToErrorJson(res.jsonValue, invalidUpload(arg1, arg2)); 21274cde5d90SJames Feist } 21284cde5d90SJames Feist 21294cde5d90SJames Feist /** 21304cde5d90SJames Feist * @internal 21314cde5d90SJames Feist * @brief Formats Invalid File message into JSON 21324cde5d90SJames Feist * 21334cde5d90SJames Feist * See header file for more information 21344cde5d90SJames Feist * @endinternal 21354cde5d90SJames Feist */ 21364cde5d90SJames Feist nlohmann::json invalidUpload(const std::string& arg1, const std::string& arg2) 21374cde5d90SJames Feist { 21384cde5d90SJames Feist return nlohmann::json{ 21393e082749SAsmitha Karunanithi {"@odata.type", "/redfish/v1/$metadata#Message.v1_1_1.Message"}, 21404a0bf539SManojkiran Eda {"MessageId", "OpenBMC.0.2.InvalidUpload"}, 21414cde5d90SJames Feist {"Message", "Invalid file uploaded to " + arg1 + ": " + arg2 + "."}, 21424cde5d90SJames Feist {"MessageArgs", {arg1, arg2}}, 2143684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 21444cde5d90SJames Feist {"Resolution", "None."}}; 21454cde5d90SJames Feist } 21464cde5d90SJames Feist 2147dd28ba82SAppaRao Puli /** 2148dd28ba82SAppaRao Puli * @internal 2149dd28ba82SAppaRao Puli * @brief Formats MutualExclusiveProperties into JSON 2150dd28ba82SAppaRao Puli * 2151dd28ba82SAppaRao Puli * See header file for more information 2152dd28ba82SAppaRao Puli * @endinternal 2153dd28ba82SAppaRao Puli */ 2154dd28ba82SAppaRao Puli nlohmann::json mutualExclusiveProperties(const std::string& arg1, 2155dd28ba82SAppaRao Puli const std::string& arg2) 2156dd28ba82SAppaRao Puli { 2157dd28ba82SAppaRao Puli return nlohmann::json{ 21583e082749SAsmitha Karunanithi {"@odata.type", "#Message.v1_1_1.Message"}, 2159dd28ba82SAppaRao Puli {"MessageId", "Base.1.5.0.MutualExclusiveProperties"}, 2160dd28ba82SAppaRao Puli {"Message", "The properties " + arg1 + " and " + arg2 + 2161dd28ba82SAppaRao Puli " are mutually exclusive."}, 2162dd28ba82SAppaRao Puli {"MessageArgs", {arg1, arg2}}, 2163684bb4b8SJason M. Bills {"MessageSeverity", "Warning"}, 2164dd28ba82SAppaRao Puli {"Resolution", 2165dd28ba82SAppaRao Puli "Ensure that the request body doesn't contain mutually exclusive " 2166dd28ba82SAppaRao Puli "properties and resubmit the request."}}; 2167dd28ba82SAppaRao Puli } 2168dd28ba82SAppaRao Puli 2169dd28ba82SAppaRao Puli void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, 2170dd28ba82SAppaRao Puli const std::string& arg2) 2171dd28ba82SAppaRao Puli { 2172dd28ba82SAppaRao Puli res.result(boost::beast::http::status::bad_request); 2173dd28ba82SAppaRao Puli addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2)); 2174dd28ba82SAppaRao Puli } 2175dd28ba82SAppaRao Puli 2176f4c4dcf4SKowalski, Kamil } // namespace messages 2177f4c4dcf4SKowalski, Kamil 2178d425c6f6SEd Tanous } // namespace redfish 2179