Add Support for ActionParameterNotInList Message
This commit adds support for the ActionParameterNotInList Redfish DMTF
error message.
Change-Id: I7fd9b7c952e7ffa4c7c4c585ae28315b40556a21
Signed-off-by: Alex Schendel <alex.schendel@intel.com>
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 0c3c2fc..08e8a3b 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -95,6 +95,24 @@
std::string_view arg3);
/**
+ * @brief Formats ActionParameterValueNotInList message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
+ * is not in the list of acceptable values."
+ *
+ * @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 ActionParameterValueFormatError formatted to JSON */
+nlohmann::json actionParameterValueNotInList(std::string_view arg1,
+ std::string_view arg2,
+ std::string_view arg3);
+
+void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
+ std::string_view arg2,
+ std::string_view arg3);
+
+/**
* @brief Formats InternalError message into JSON
* Message body: "The request failed due to an internal service error. The
* service is still operational."
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index bee3140..77531f0 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -244,6 +244,30 @@
/**
* @internal
+ * @brief Formats ActionParameterValueNotInList message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueNotInList(std::string_view arg1,
+ std::string_view arg2,
+ std::string_view arg3)
+{
+ return getLog(
+ redfish::registries::base::Index::actionParameterValueNotInList,
+ std::to_array({arg1, arg2, arg3}));
+}
+
+void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
+ std::string_view arg2, std::string_view arg3)
+{
+ res.result(boost::beast::http::status::bad_request);
+ addMessageToErrorJson(res.jsonValue,
+ actionParameterValueNotInList(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
* @brief Formats InternalError message into JSON
*
* See header file for more information