diff options
author | Ramesh Iyyar <rameshi1@in.ibm.com> | 2022-03-18 06:20:52 +0300 |
---|---|---|
committer | Ramesh Iyyar <rameshi1@in.ibm.com> | 2022-03-30 17:37:57 +0300 |
commit | 2a6af81c81101a5ade887d7119a48fa6818255fb (patch) | |
tree | 80a1172a69692e455226faeb9f6e6d8fbd5b3e08 | |
parent | 9629907de7880c0853bb4d5b9c624c452a598861 (diff) | |
download | bmcweb-2a6af81c81101a5ade887d7119a48fa6818255fb.tar.xz |
registry: Add PropertyValueResourceConflict registry
- Added the PropertyValueResourceConflict message registry that
might used to send when the request is failed due to some other
resource state or configuration.
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: I2c03aee88442f6abe55f2a9f574211b8214aa30c
-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 |