lordgamez commented on code in PR #2176:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2176#discussion_r3428469802


##########
libminifi/src/core/state/nodes/AgentInformation.cpp:
##########
@@ -17,46 +17,94 @@
  */
 #include "core/state/nodes/AgentInformation.h"
 
-#include "minifi-cpp/agent/agent_version.h"
-#include "core/Resource.h"
 #include "core/ClassLoader.h"
-#include "utils/OsUtils.h"
+#include "core/Resource.h"
 #include "core/state/nodes/SchedulingNodes.h"
 #include "core/state/nodes/SupportedOperations.h"
+#include "minifi-c/minifi-c.h"
+#include "minifi-cpp/agent/agent_version.h"
+#include "minifi-cpp/controllers/AttributeProviderService.h"
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "minifi-cpp/controllers/RecordSetReader.h"
+#include "minifi-cpp/controllers/RecordSetWriter.h"
+#include "minifi-cpp/controllers/SSLContextServiceInterface.h"
+#include "utils/OsUtils.h"
+#include "range/v3/algorithm/contains.hpp"
 
 namespace org::apache::nifi::minifi::state::response {
 
 utils::ProcessCpuUsageTracker AgentStatus::cpu_load_tracker_;
 std::mutex AgentStatus::cpu_load_tracker_mutex_;
 
 namespace {
+
+std::string allowedTypeGroupName(const std::string_view allowed_type) {
+  constexpr std::string_view APACHE_GROUP_STR = "org.apache.nifi.minifi";
+  if (allowed_type.starts_with(APACHE_GROUP_STR)) {
+    return std::string{APACHE_GROUP_STR};
+  }
+  return std::string{allowed_type.substr(0, allowed_type.find_last_of('.'))};
+}
+
+constexpr std::string_view shortNameFromFullName(std::string_view sv) {
+  auto pos = sv.rfind('.');
+  return (pos == std::string_view::npos) ? sv : sv.substr(pos + 1);
+}
+
+bool minifiSystemAllowedType(const std::string_view allowed_type) {
+  constexpr auto system_allowed_types = std::to_array<std::string_view>({
+      controllers::SSLContextServiceInterface::ProvidesApi.type,
+      core::RecordSetWriter::ProvidesApi.type,
+      core::RecordSetReader::ProvidesApi.type,
+      controllers::ProxyConfigurationServiceInterface::ProvidesApi.type,
+      controllers::AttributeProviderService::ProvidesApi.type});
+  return ranges::contains(system_allowed_types, allowed_type);

Review Comment:
   It's not really what I suggested, but we discussed that the originally 
suggested improvement should be a separate PR. Until that is implemented the 
same issue persists that when any new system allowed type is introduced it 
needs to be manually inserted here which is not trivial to find and easily 
missed, does not really matter if it's inlined or extracted to a container.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to