diff options
author | Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com> | 2022-09-16 18:49:55 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-10-11 20:18:51 +0300 |
commit | b4ad4c05eeb2104de3becaf704fa1055f72e8b61 (patch) | |
tree | 4b4bf596318be9fe82d9b31d4bbdf27a281985ea /redfish-core | |
parent | 8e31778e76b90c9a36ef40fff898d6218c649df6 (diff) | |
download | bmcweb-b4ad4c05eeb2104de3becaf704fa1055f72e8b61.tar.xz |
bmcweb: Add strictAccountTypes error message
Error message to be thrown when StrictAccountTypes is true and the
specified value(s) for AccountTypes or OEMAccountTypes was not accepted.
Testing:
strictAccountTypes() error message was tested while testing redfish
PATCH API for patching AccountTypes.
Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
Change-Id: I13abcd142ddfb04a2a187c9373fa996ecfe987a1
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/include/error_messages.hpp | 11 | ||||
-rw-r--r-- | redfish-core/src/error_messages.cpp | 19 |
2 files changed, 30 insertions, 0 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp index d686b5e9e0..0c3c2fca1b 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -676,6 +676,17 @@ void sourceDoesNotSupportProtocol(crow::Response& res, std::string_view arg2); /** + * @brief Formats StrictAccountTypes message into JSON + * Message body: Indicates the request failed because a set of `AccountTypes` or + * `OEMAccountTypes` was not accepted while `StrictAccountTypes` is set to `true + * @param[in] arg1 Parameter of message that will replace %1 in its body. + * + * @returns Message StrictAccountTypes formatted to JSON */ +nlohmann::json strictAccountTypes(std::string_view arg1); + +void strictAccountTypes(crow::Response& res, std::string_view arg1); + +/** * @brief Formats AccountRemoved message into JSON * Message body: "The account was successfully removed." * diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp index 1bfce24504..5f055bfca7 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -1148,6 +1148,25 @@ void sourceDoesNotSupportProtocol(crow::Response& res, /** * @internal + * @brief Formats StrictAccountTypes message into JSON + * + * See header file for more information + * @endinternal + */ +nlohmann::json strictAccountTypes(std::string_view arg1) +{ + return getLog(redfish::registries::base::Index::strictAccountTypes, + std::to_array({arg1})); +} + +void strictAccountTypes(crow::Response& res, std::string_view arg1) +{ + res.result(boost::beast::http::status::bad_request); + addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1)); +} + +/** + * @internal * @brief Formats AccountRemoved message into JSON * * See header file for more information |