Add extra subscription params support
OriginResource allows filtering messages on a per-device basis. This
was already listed as supported in our docs.
RegistryPrefixes is also added.
Tested: Unit tests pass.
Change-Id: Idfde8416f2f466ce11957177e052b540fc669888
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/event_service_store.hpp b/include/event_service_store.hpp
index 8501fff..9761eb5 100644
--- a/include/event_service_store.hpp
+++ b/include/event_service_store.hpp
@@ -25,6 +25,7 @@
std::vector<std::string> resourceTypes;
boost::beast::http::fields httpHeaders;
std::vector<std::string> metricReportDefinitions;
+ std::vector<std::string> originResources;
static std::shared_ptr<UserSubscription> fromJson(
const nlohmann::json::object_t& j, const bool loadFromOldConfig = false)
@@ -215,6 +216,25 @@
subvalue->metricReportDefinitions.emplace_back(*value);
}
}
+ else if (element.first == "OriginResources")
+ {
+ const nlohmann::json::array_t* obj =
+ element.second.get_ptr<const nlohmann::json::array_t*>();
+ if (obj == nullptr)
+ {
+ continue;
+ }
+ for (const auto& val : *obj)
+ {
+ const std::string* value =
+ val.get_ptr<const std::string*>();
+ if (value == nullptr)
+ {
+ continue;
+ }
+ subvalue->originResources.emplace_back(*value);
+ }
+ }
else
{
BMCWEB_LOG_ERROR(