Generate resource event
Generate Resource event registry
Tested: On last patch of series. No behavior changes.
Change-Id: I924919db0e7fbde8ed698de6b59b86f788de9708
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/include/resource_messages.hpp b/redfish-core/include/resource_messages.hpp
index 7a71151..dd3c280 100644
--- a/redfish-core/include/resource_messages.hpp
+++ b/redfish-core/include/resource_messages.hpp
@@ -1,45 +1,96 @@
#pragma once
+/****************************************************************
+ * READ THIS WARNING FIRST
+ * This is an auto-generated header which contains definitions
+ * for Redfish DMTF defined messages.
+ * DO NOT modify this registry outside of running the
+ * parse_registries.py script. The definitions contained within
+ * this file are owned by DMTF. Any modifications to these files
+ * should be first pushed to the relevant registry in the DMTF
+ * github organization.
+ ***************************************************************/
-#include "registries/resource_event_message_registry.hpp"
+#include "http_response.hpp"
+#include <boost/url/url_view_base.hpp>
#include <nlohmann/json.hpp>
+#include <cstdint>
+#include <source_location>
+#include <string>
+#include <string_view>
+
+// IWYU pragma: no_forward_declare crow::Response
+
namespace redfish
{
+
namespace messages
{
+nlohmann::json resourceCreated();
-inline nlohmann::json
- getLogResourceEvent(redfish::registries::resource_event::Index name,
- std::span<std::string_view> args)
-{
- size_t index = static_cast<size_t>(name);
- if (index >= redfish::registries::resource_event::registry.size())
- {
- return {};
- }
- return getLogFromRegistry(redfish::registries::resource_event::header,
- redfish::registries::resource_event::registry,
- index, args);
-}
+nlohmann::json resourceRemoved();
-inline nlohmann::json resourceChanged()
-{
- return getLogResourceEvent(
- redfish::registries::resource_event::Index::resourceChanged, {});
-}
+nlohmann::json resourceErrorsDetected(std::string_view arg1,
+ std::string_view arg2);
-inline nlohmann::json resourceCreated()
-{
- return getLogResourceEvent(
- redfish::registries::resource_event::Index::resourceCreated, {});
-}
+nlohmann::json resourceErrorsCorrected(std::string_view arg1,
+ std::string_view arg2);
-inline nlohmann::json resourceRemoved()
-{
- return getLogResourceEvent(
- redfish::registries::resource_event::Index::resourceRemoved, {});
-}
+nlohmann::json resourceErrorThresholdExceeded(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json
+ resourceErrorThresholdCleared(std::string_view arg1, std::string_view arg2);
+
+nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json resourceStatusChangedOK(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json
+ resourceStatusChangedWarning(std::string_view arg1, std::string_view arg2);
+
+nlohmann::json
+ resourceStatusChangedCritical(std::string_view arg1, std::string_view arg2);
+
+nlohmann::json resourceStateChanged(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json resourcePoweredOn(std::string_view arg1);
+
+nlohmann::json resourcePoweringOn(std::string_view arg1);
+
+nlohmann::json resourcePoweredOff(std::string_view arg1);
+
+nlohmann::json resourcePoweringOff(std::string_view arg1);
+
+nlohmann::json resourcePaused(std::string_view arg1);
+
+nlohmann::json uRIForResourceChanged();
+
+nlohmann::json resourceChanged();
+
+nlohmann::json resourceVersionIncompatible(std::string_view arg1);
+
+nlohmann::json resourceSelfTestFailed(std::string_view arg1);
+
+nlohmann::json resourceSelfTestCompleted();
+
+nlohmann::json testMessage();
+
+nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2);
+
+nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2);
+
+nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2);
} // namespace messages
} // namespace redfish
diff --git a/redfish-core/src/resource_messages.cpp b/redfish-core/src/resource_messages.cpp
new file mode 100644
index 0000000..00023a8
--- /dev/null
+++ b/redfish-core/src/resource_messages.cpp
@@ -0,0 +1,426 @@
+/****************************************************************
+ * READ THIS WARNING FIRST
+ * This is an auto-generated header which contains definitions
+ * for Redfish DMTF defined messages.
+ * DO NOT modify this registry outside of running the
+ * parse_registries.py script. The definitions contained within
+ * this file are owned by DMTF. Any modifications to these files
+ * should be first pushed to the relevant registry in the DMTF
+ * github organization.
+ ***************************************************************/
+#include "resource_messages.hpp"
+
+#include "registries.hpp"
+#include "registries/resource_event_message_registry.hpp"
+
+#include <nlohmann/json.hpp>
+
+#include <array>
+#include <cstddef>
+#include <span>
+#include <string_view>
+
+// Clang can't seem to decide whether this header needs to be included or not,
+// and is inconsistent. Include it for now
+// NOLINTNEXTLINE(misc-include-cleaner)
+#include <utility>
+
+namespace redfish
+{
+
+namespace messages
+{
+
+static nlohmann::json getLog(redfish::registries::resource_event::Index name,
+ std::span<const std::string_view> args)
+{
+ size_t index = static_cast<size_t>(name);
+ if (index >= redfish::registries::resource_event::registry.size())
+ {
+ return {};
+ }
+ return getLogFromRegistry(redfish::registries::resource_event::header,
+ redfish::registries::resource_event::registry,
+ index, args);
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceCreated message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceCreated()
+{
+ return getLog(redfish::registries::resource_event::Index::resourceCreated,
+ {});
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceRemoved message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceRemoved()
+{
+ return getLog(redfish::registries::resource_event::Index::resourceRemoved,
+ {});
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceErrorsDetected message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceErrorsDetected(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceErrorsDetected,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceErrorsCorrected message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceErrorsCorrected(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceErrorsCorrected,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceErrorThresholdExceeded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+ resourceErrorThresholdExceeded(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceErrorThresholdExceeded,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceErrorThresholdCleared message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+ resourceErrorThresholdCleared(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceErrorThresholdCleared,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceWarningThresholdExceeded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceWarningThresholdExceeded,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceWarningThresholdCleared message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceWarningThresholdCleared,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceStatusChangedOK message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceStatusChangedOK(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceStatusChangedOK,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceStatusChangedWarning message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+ resourceStatusChangedWarning(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceStatusChangedWarning,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceStatusChangedCritical message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+ resourceStatusChangedCritical(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::
+ resourceStatusChangedCritical,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceStateChanged message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceStateChanged(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceStateChanged,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourcePoweredOn message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourcePoweredOn(std::string_view arg1)
+{
+ return getLog(redfish::registries::resource_event::Index::resourcePoweredOn,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourcePoweringOn message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourcePoweringOn(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourcePoweringOn,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourcePoweredOff message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourcePoweredOff(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourcePoweredOff,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourcePoweringOff message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourcePoweringOff(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourcePoweringOff,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourcePaused message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourcePaused(std::string_view arg1)
+{
+ return getLog(redfish::registries::resource_event::Index::resourcePaused,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats URIForResourceChanged message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json uRIForResourceChanged()
+{
+ return getLog(
+ redfish::registries::resource_event::Index::uRIForResourceChanged, {});
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceChanged message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceChanged()
+{
+ return getLog(redfish::registries::resource_event::Index::resourceChanged,
+ {});
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceVersionIncompatible message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceVersionIncompatible(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceVersionIncompatible,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceSelfTestFailed message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceSelfTestFailed(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceSelfTestFailed,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceSelfTestCompleted message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceSelfTestCompleted()
+{
+ return getLog(
+ redfish::registries::resource_event::Index::resourceSelfTestCompleted,
+ {});
+}
+
+/**
+ * @internal
+ * @brief Formats TestMessage message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json testMessage()
+{
+ return getLog(redfish::registries::resource_event::Index::testMessage, {});
+}
+
+/**
+ * @internal
+ * @brief Formats AggregationSourceDiscovered message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(
+ redfish::registries::resource_event::Index::aggregationSourceDiscovered,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats LicenseExpired message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::licenseExpired,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats LicenseChanged message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::licenseChanged,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats LicenseAdded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2)
+{
+ return getLog(redfish::registries::resource_event::Index::licenseAdded,
+ std::to_array({arg1, arg2}));
+}
+
+} // namespace messages
+} // namespace redfish