diff options
-rw-r--r-- | redfish-core/include/error_messages.hpp | 19 | ||||
-rw-r--r-- | redfish-core/src/error_messages.cpp | 26 |
2 files changed, 45 insertions, 0 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp index 6993a9d016..9b35e6dac6 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -406,6 +406,25 @@ void propertyValueConflict(crow::Response& res, std::string_view arg1, std::string_view arg2); /** + * @brief Formats PropertyValueResourceConflict message into JSON + * Message body: "The property '%1' with the requested value of '%2' could + * not be written because the value conflicts with the state or configuration + * of the resource at '%3'." + * + * @param[in] arg1 Parameter of message that will replace %1 in its body. + * @param[in] arg2 Parameter of message that will replace %2 in its body. + * @param[in] arg3 Parameter of message that will replace %3 in its body. + * + * @returns Message PropertyValueResourceConflict to JSON */ +nlohmann::json propertyValueResourceConflict(std::string_view arg1, + std::string_view arg2, + const boost::urls::url_view& arg3); + +void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, + std::string_view arg2, + const boost::urls::url_view& arg3); + +/** * @brief Formats PropertyValueIncorrect message into JSON * Message body: "The property '<arg1>' with the requested value of '<arg2>' * could not be written because the value does not meet the constraints of the diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp index 7733db3947..8f8b00bf5d 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -730,6 +730,32 @@ void propertyValueConflict(crow::Response& res, std::string_view arg1, /** * @internal + * @brief Formats PropertyValueResourceConflict message into JSON + * + * See header file for more information + * @endinternal + */ +nlohmann::json propertyValueResourceConflict(std::string_view arg1, + std::string_view arg2, + const boost::urls::url_view& arg3) +{ + return getLog( + redfish::registries::base::Index::propertyValueResourceConflict, + std::to_array( + {arg1, arg2, std::string_view{arg3.data(), arg3.size()}})); +} + +void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, + std::string_view arg2, + const boost::urls::url_view& arg3) +{ + res.result(boost::beast::http::status::conflict); + addMessageToErrorJson(res.jsonValue, + propertyValueResourceConflict(arg1, arg2, arg3)); +} + +/** + * @internal * @brief Formats PropertyValueIncorrect message into JSON * * See header file for more information |