Adds redfish error for GenerateSecretKeyRequired

This commit contains the redfish error to be returned when it finds
that MFA is enabled and the user has to generate secret key to proceed
further.

Used and tested in https://gerrit.openbmc.org/c/openbmc/bmcweb/+/74938.

Change-Id: If13b96729510fc7b165aa792f1e1d23a811ca733
Signed-off-by: Jishnu CM <jishnunambiarcm@duck.com>
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 020c33e..7ac53e7 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -1117,6 +1117,23 @@
 void arraySizeTooLong(crow::Response& res, std::string_view property,
                       uint64_t length);
 
+/**
+ * @brief Formats GenerateSecretKeyRequired message into JSON
+ * Message body: Secret key needs to be generated for the account before
+ * accessing the service. Account has to provide a time based OTP from the
+ * device configured with the secret key before access is granted. The secret
+ * key can be generated with a `POST` to the `GenerateSecretKey` action for
+ * the account located at the target URI '%1'.
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message GenerateSecretKeyRequired formatted to JSON */
+
+nlohmann::json
+    generateSecretKeyRequired(const boost::urls::url_view_base& arg1);
+
+void generateSecretKeyRequired(crow::Response& res,
+                               const boost::urls::url_view_base& arg1);
 } // namespace messages
 
 } // namespace redfish
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 0253f10..13ba85e 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -1916,6 +1916,26 @@
     return ret;
 }
 
+nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::generateSecretKeyRequired,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+/**
+ * @internal
+ * @brief Formats GenerateSecretKeyRequired message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+void generateSecretKeyRequired(crow::Response& res,
+                               const boost::urls::url_view_base& arg1)
+{
+    messages::addMessageToJsonRoot(res.jsonValue,
+                                   generateSecretKeyRequired(arg1));
+}
+
 } // namespace messages
 
 } // namespace redfish