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
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index d686b5e..0c3c2fc 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -676,6 +676,17 @@
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 1bfce24..5f055bf 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -1148,6 +1148,25 @@
/**
* @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