You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lordgamez (via GitHub)" <gi...@apache.org> on 2025/10/09 11:19:43 UTC

[PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

lordgamez opened a new pull request, #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045

   https://issues.apache.org/jira/browse/MINIFICPP-2644
   
   -------------------
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2841079794


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,44 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+enum class ProxyType {
+  HTTP,
+  HTTPS
+};
+
+class ProxyConfigurationServiceInterface : public virtual core::controller::ControllerService {

Review Comment:
   I'd keep the naming consistent with NiFi and call this ProxyConfigurationService



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r3111855319


##########
core-framework/include/controllers/ProxyConfiguration.h:
##########
@@ -18,16 +17,18 @@
 #pragma once
 
 #include <string>
-#include <cstdint>
+#include <optional>
 
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
 
-namespace org::apache::nifi::minifi::aws {
+namespace org::apache::nifi::minifi::controllers {
 
-struct ProxyOptions {
-  std::string host;
-  uint32_t port = 0;
-  std::string username;
-  std::string password;
+struct ProxyConfiguration {
+  ProxyType proxy_type;
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;

Review Comment:
   I'd make proxy_port a raw uint16_t, it's always going to be set anyway, or we can use 0 as a default value if need be. Also let's move the username + password into a separate struct with not optional string fields, and have an optional<ProxyCredentials> here. 



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2888705234


##########
libminifi/include/controllers/ProxyConfigurationService.h:
##########
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <mutex>
+
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "controllers/ProxyConfiguration.h"
+#include "core/controller/ControllerService.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/PropertyValidator.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+class ProxyConfigurationService : public core::controller::ControllerServiceImpl, public ProxyConfigurationServiceInterface {

Review Comment:
   I'm not sure it's a good idea, I think we should be consistent with our own naming conventions. For example we have AzureStorageCredentialsService and SSLContextService, while these are named StandardAzureCredentialsControllerService and StandardSSLContextService in NiFi. I also think adding the "Standard" prefix just adds confusion for the user when there are no other proxy services so there is no need for the additional adjective.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2523743740


##########
CONTROLLERS.md:
##########
@@ -244,6 +245,24 @@ In the list below, the names of required properties appear in bold. Any other pr
 | **File**                  |               |                  | Path to a file to store state                                                                                                                          |
 
 
+## ProxyConfigurationService
+
+### Description
+
+Provides a set of configurations for different MiNiFi C++ components to use a proxy server.

Review Comment:
   Good point, we only support HTTP proxy at the moment. The controller is based on the NiFi counterpart https://nifi.apache.org/components/org.apache.nifi.proxy.StandardProxyConfigurationService/ where the proxy type can be specified if there are additional options. We can add that in the future if we want to support more protocols. Currently the cloud providers usually support only HTTP proxies, the newer AWS SDK should support HTTPS as well. Added additional info to the description in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/2b46713093565c2e54d6e0bbea6ec8723679096c



##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   As we only support HTTP proxies for now only these parameters are used, they can be extended or refactored to different methods when other protocols are introduced.
   



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#issuecomment-3385747570

   The clang tidy errors are already fixed in https://github.com/apache/nifi-minifi-cpp/pull/2040


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#issuecomment-3396143164

   The issues listed in the [clang tidy checks](https://github.com/apache/nifi-minifi-cpp/actions/runs/18376508312/job/52351727876?pr=2045) are fixed in the following PR: github.com/apache/nifi-minifi-cpp/pull/2040


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2523744268


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   As we only support HTTP proxies for now only these parameters are used, they can be extended or refactored when other protocols are introduced.
   



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "martinzink (via GitHub)" <gi...@apache.org>.
martinzink merged PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r3130923021


##########
extensions/azure/tests/ListAzureDataLakeStorageTests.cpp:
##########
@@ -256,4 +256,27 @@ TEST_CASE_METHOD(ListAzureDataLakeStorageTestsFixture, "Both SAS Token and Stora
   REQUIRE_THROWS_AS(test_controller_.runSession(plan_, true), minifi::Exception);
 }
 
+TEST_CASE_METHOD(ListAzureDataLakeStorageTestsFixture, "List data lake storage files using proxy", "[azureDataLakeStorageParameters]") {
+  auto proxy_configuration_service = plan_->addController("ProxyConfigurationService", "ProxyConfigurationService");
+  plan_->setProperty(proxy_configuration_service, "Proxy Server Host", "https://host");
+  plan_->setProperty(proxy_configuration_service, "Proxy Server Port", "1234");
+  plan_->setProperty(proxy_configuration_service, "Proxy User Name", "username");
+  plan_->setProperty(proxy_configuration_service, "Proxy User Password", "password");
+  plan_->setProperty(proxy_configuration_service, "Proxy Type", "HTTPS");

Review Comment:
   HTTPS is no longer supported, we should change it to HTTP



##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   We can remove the optional member now



##########
extensions/azure/storage/AzureDataLakeStorageClient.cpp:
##########
@@ -35,13 +35,24 @@ AzureDataLakeStorageClient::AzureDataLakeStorageClient() {
   utils::AzureSdkLogger::initialize();
 }
 
-std::unique_ptr<Azure::Storage::Files::DataLake::DataLakeFileSystemClient> AzureDataLakeStorageClient::createClient(
-    const AzureStorageCredentials& credentials, const std::string& file_system_name, std::optional<uint64_t> number_of_retries) {
+std::unique_ptr<Azure::Storage::Files::DataLake::DataLakeFileSystemClient> AzureDataLakeStorageClient::createClient(const AzureStorageCredentials& credentials,
+    const std::string& file_system_name, std::optional<uint64_t> number_of_retries, const std::optional<minifi::controllers::ProxyConfiguration>& proxy_configuration) {

Review Comment:
   An optional non-owning reference can be more simply represented as a pointer
   ```suggestion
       const std::string& file_system_name, std::optional<uint64_t> number_of_retries, minifi::controllers::ProxyConfiguration* const proxy_configuration) {
   ```



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2888841922


##########
extensions/azure/tests/DeleteAzureBlobStorageTests.cpp:
##########
@@ -339,4 +339,30 @@ TEST_CASE_METHOD(DeleteAzureBlobStorageTestsFixture, "Test Azure blob delete wit
   REQUIRE(failed_flowfiles[0] == TEST_DATA);
 }
 
+TEST_CASE_METHOD(DeleteAzureBlobStorageTestsFixture, "Test Azure blob delete using proxy", "[azureBlobStorageDelete]") {

Review Comment:
   I kept the tests for the Put and List processors as the List processors are a bit different and removed the others in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/f70ac212f7eefc06ab27f7471fd92a5c8f9f39ba



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2682384215


##########
extensions/aws/processors/AwsProcessor.cpp:
##########
@@ -69,10 +69,21 @@ std::optional<Aws::Auth::AWSCredentials> AwsProcessor::getAWSCredentials(
 aws::ProxyOptions AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
   aws::ProxyOptions proxy;
 
-  proxy.host = minifi::utils::parseOptionalProperty(context, ProxyHost, flow_file).value_or("");
-  proxy.port = gsl::narrow<uint32_t>(minifi::utils::parseOptionalU64Property(context, ProxyPort, flow_file).value_or(0));
-  proxy.username = minifi::utils::parseOptionalProperty(context, ProxyUsername, flow_file).value_or("");
-  proxy.password = minifi::utils::parseOptionalProperty(context, ProxyPassword, flow_file).value_or("");
+  auto proxy_controller_service = minifi::utils::parseOptionalControllerService<minifi::controllers::ProxyConfigurationServiceInterface>(context, ProxyConfigurationService, getUUID());
+  if (proxy_controller_service) {
+    proxy.host = proxy_controller_service->getHost();
+    auto port_opt = proxy_controller_service->getPort();
+    proxy.port = port_opt ? *port_opt : 0;
+    auto username_opt = proxy_controller_service->getUsername();
+    proxy.username = username_opt ? *username_opt : "";
+    auto password_opt = proxy_controller_service->getPassword();
+    proxy.password = password_opt ? *password_opt : "";

Review Comment:
   very minor, but why not
   ```suggestion
       proxy.host = proxy_controller_service->getHost();
       proxy.port = proxy_controller_service->getPort().value_or(0);
       proxy.username = proxy_controller_service->getUsername().value_or("");
       proxy.password = proxy_controller_service->getPassword().value_or("");
   ```
   as it is done in the else branch?



##########
CONTROLLERS.md:
##########
@@ -244,6 +245,24 @@ In the list below, the names of required properties appear in bold. Any other pr
 | **File**                  |               |                  | Path to a file to store state                                                                                                                          |
 
 
+## ProxyConfigurationService
+
+### Description
+
+Provides a set of configurations for different MiNiFi C++ components to use a proxy server. Currently these properties can only be used for HTTP proxy configuration, not other protocols are supported at this time.

Review Comment:
   ```suggestion
   Provides a set of configurations for various MiNiFi C++ components to use a proxy server. Currently these properties can only be used for HTTP proxy configuration, no other protocols are supported at this time.
   ```



##########
libminifi/include/controllers/ProxyConfigurationService.h:
##########
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <mutex>
+
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "controllers/ProxyConfiguration.h"
+#include "core/controller/ControllerService.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/PropertyValidator.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+class ProxyConfigurationService : public core::controller::ControllerServiceImpl, public ProxyConfigurationServiceInterface {
+ public:
+  explicit ProxyConfigurationService(std::string_view name, const utils::Identifier& uuid = {})
+      : ControllerServiceImpl(name, uuid) {
+  }
+
+  MINIFIAPI static constexpr const char* Description = "Provides a set of configurations for different MiNiFi C++ components to use a proxy server. "
+      "Currently these properties can only be used for HTTP proxy configuration, not other protocols are supported at this time.";
+
+  MINIFIAPI static constexpr auto ProxyServerHost = core::PropertyDefinitionBuilder<>::createProperty("Proxy Server Host")
+      .withDescription("Proxy server hostname or ip-address.")
+      .isRequired(true)
+      .build();

Review Comment:
   this property could have a NON_BLANK_VALIDATOR



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r3086644785


##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   Updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/bbefc33c9d66b3ad2a11fc1ef8de8817468898c5



##########
extensions/aws/processors/AwsProcessor.cpp:
##########
@@ -66,15 +66,25 @@ std::optional<Aws::Auth::AWSCredentials> AwsProcessor::getAWSCredentials(
   return aws_credentials_provider.getAWSCredentials();
 }
 
-aws::ProxyOptions AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
-  aws::ProxyOptions proxy;
-
-  proxy.host = minifi::utils::parseOptionalProperty(context, ProxyHost, flow_file).value_or("");
-  proxy.port = gsl::narrow<uint32_t>(minifi::utils::parseOptionalU64Property(context, ProxyPort, flow_file).value_or(0));
-  proxy.username = minifi::utils::parseOptionalProperty(context, ProxyUsername, flow_file).value_or("");
-  proxy.password = minifi::utils::parseOptionalProperty(context, ProxyPassword, flow_file).value_or("");
+minifi::controllers::ProxyConfiguration AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
+  minifi::controllers::ProxyConfiguration proxy;
+
+  auto proxy_controller_service = minifi::utils::parseOptionalControllerService<minifi::controllers::ProxyConfigurationServiceInterface>(context, ProxyConfigurationService, getUUID());
+  if (proxy_controller_service) {
+    proxy.proxy_type = proxy_controller_service->getProxyType();
+    proxy.proxy_host = proxy_controller_service->getHost();
+    proxy.proxy_port = proxy_controller_service->getPort().value_or(0);
+    proxy.proxy_user = proxy_controller_service->getUsername().value_or("");
+    proxy.proxy_password = proxy_controller_service->getPassword().value_or("");
+  } else {
+    proxy.proxy_type = minifi::utils::parseOptionalEnumProperty<minifi::controllers::ProxyType>(context, ProxyType).value_or(minifi::controllers::ProxyType::HTTP);

Review Comment:
   Added DIRECT option in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/bbefc33c9d66b3ad2a11fc1ef8de8817468898c5, but I kept the HTTP as the default as the main intention should be to use a proxy when a controller is added.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2823222224


##########
extensions/aws/processors/AwsProcessor.cpp:
##########
@@ -69,10 +69,21 @@ std::optional<Aws::Auth::AWSCredentials> AwsProcessor::getAWSCredentials(
 aws::ProxyOptions AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
   aws::ProxyOptions proxy;
 
-  proxy.host = minifi::utils::parseOptionalProperty(context, ProxyHost, flow_file).value_or("");
-  proxy.port = gsl::narrow<uint32_t>(minifi::utils::parseOptionalU64Property(context, ProxyPort, flow_file).value_or(0));
-  proxy.username = minifi::utils::parseOptionalProperty(context, ProxyUsername, flow_file).value_or("");
-  proxy.password = minifi::utils::parseOptionalProperty(context, ProxyPassword, flow_file).value_or("");
+  auto proxy_controller_service = minifi::utils::parseOptionalControllerService<minifi::controllers::ProxyConfigurationServiceInterface>(context, ProxyConfigurationService, getUUID());
+  if (proxy_controller_service) {
+    proxy.host = proxy_controller_service->getHost();
+    auto port_opt = proxy_controller_service->getPort();
+    proxy.port = port_opt ? *port_opt : 0;
+    auto username_opt = proxy_controller_service->getUsername();
+    proxy.username = username_opt ? *username_opt : "";
+    auto password_opt = proxy_controller_service->getPassword();
+    proxy.password = password_opt ? *password_opt : "";

Review Comment:
   Good point, updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/fa7ded8afdf472df14255ff2cbba4be47eed6271



##########
CONTROLLERS.md:
##########
@@ -244,6 +245,24 @@ In the list below, the names of required properties appear in bold. Any other pr
 | **File**                  |               |                  | Path to a file to store state                                                                                                                          |
 
 
+## ProxyConfigurationService
+
+### Description
+
+Provides a set of configurations for different MiNiFi C++ components to use a proxy server. Currently these properties can only be used for HTTP proxy configuration, not other protocols are supported at this time.

Review Comment:
   Updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/fa7ded8afdf472df14255ff2cbba4be47eed6271



##########
libminifi/include/controllers/ProxyConfigurationService.h:
##########
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <mutex>
+
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "controllers/ProxyConfiguration.h"
+#include "core/controller/ControllerService.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/PropertyValidator.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+class ProxyConfigurationService : public core::controller::ControllerServiceImpl, public ProxyConfigurationServiceInterface {
+ public:
+  explicit ProxyConfigurationService(std::string_view name, const utils::Identifier& uuid = {})
+      : ControllerServiceImpl(name, uuid) {
+  }
+
+  MINIFIAPI static constexpr const char* Description = "Provides a set of configurations for different MiNiFi C++ components to use a proxy server. "
+      "Currently these properties can only be used for HTTP proxy configuration, not other protocols are supported at this time.";
+
+  MINIFIAPI static constexpr auto ProxyServerHost = core::PropertyDefinitionBuilder<>::createProperty("Proxy Server Host")
+      .withDescription("Proxy server hostname or ip-address.")
+      .isRequired(true)
+      .build();

Review Comment:
   Updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/fa7ded8afdf472df14255ff2cbba4be47eed6271



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2676772274


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   I updated the interface to use a getter-only interface to be consistent with the SSLContextServiceInterface, I also added a type enum in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/12e4262eaac5fa2972484f30210ac73132e9de35



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2580840579


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   I think a getter-only interface could work. I would also add a proxy type getter, even if the type enum only has one possible value today, so older processors can detect future versions of the service that are incompatible.
   
   I think we could also do a flat struct with the first field being a type enum field, if the interface always returns a heap allocated object: that way future versions can grow the struct without breaking its layout. I'd prefer this approach.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r3155140496


##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   Removed optional in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/29da0bdc1203b7bf69d6813c1d8ebeec2f9763f1



##########
core-framework/include/controllers/ProxyConfiguration.h:
##########
@@ -18,16 +17,18 @@
 #pragma once
 
 #include <string>
-#include <cstdint>
+#include <optional>
 
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
 
-namespace org::apache::nifi::minifi::aws {
+namespace org::apache::nifi::minifi::controllers {
 
-struct ProxyOptions {
-  std::string host;
-  uint32_t port = 0;
-  std::string username;
-  std::string password;
+struct ProxyConfiguration {
+  ProxyType proxy_type;
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;

Review Comment:
   Updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/29da0bdc1203b7bf69d6813c1d8ebeec2f9763f1



##########
extensions/azure/tests/ListAzureDataLakeStorageTests.cpp:
##########
@@ -256,4 +256,27 @@ TEST_CASE_METHOD(ListAzureDataLakeStorageTestsFixture, "Both SAS Token and Stora
   REQUIRE_THROWS_AS(test_controller_.runSession(plan_, true), minifi::Exception);
 }
 
+TEST_CASE_METHOD(ListAzureDataLakeStorageTestsFixture, "List data lake storage files using proxy", "[azureDataLakeStorageParameters]") {
+  auto proxy_configuration_service = plan_->addController("ProxyConfigurationService", "ProxyConfigurationService");
+  plan_->setProperty(proxy_configuration_service, "Proxy Server Host", "https://host");
+  plan_->setProperty(proxy_configuration_service, "Proxy Server Port", "1234");
+  plan_->setProperty(proxy_configuration_service, "Proxy User Name", "username");
+  plan_->setProperty(proxy_configuration_service, "Proxy User Password", "password");
+  plan_->setProperty(proxy_configuration_service, "Proxy Type", "HTTPS");

Review Comment:
   Removed in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/29da0bdc1203b7bf69d6813c1d8ebeec2f9763f1



##########
extensions/azure/storage/AzureDataLakeStorageClient.cpp:
##########
@@ -35,13 +35,24 @@ AzureDataLakeStorageClient::AzureDataLakeStorageClient() {
   utils::AzureSdkLogger::initialize();
 }
 
-std::unique_ptr<Azure::Storage::Files::DataLake::DataLakeFileSystemClient> AzureDataLakeStorageClient::createClient(
-    const AzureStorageCredentials& credentials, const std::string& file_system_name, std::optional<uint64_t> number_of_retries) {
+std::unique_ptr<Azure::Storage::Files::DataLake::DataLakeFileSystemClient> AzureDataLakeStorageClient::createClient(const AzureStorageCredentials& credentials,
+    const std::string& file_system_name, std::optional<uint64_t> number_of_retries, const std::optional<minifi::controllers::ProxyConfiguration>& proxy_configuration) {

Review Comment:
   Removed optional so it is a const ref now in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/29da0bdc1203b7bf69d6813c1d8ebeec2f9763f1



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2416720950


##########
PROCESSORS.md:
##########
@@ -638,7 +640,6 @@ In the list below, the names of required properties appear in bold. Any other pr
 
 | Name                             | Default Value | Allowable Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Description                                                                                                                                                                                                                                          
                                                        |
 |----------------------------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -------------------------------------------------------|
-| **Bucket**                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | The S3 bucket<br/>**Supports Expression Language: true**                                                                                                                                                                                             
                                                        |
 | Access Key                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | AWS account access key<br/>**Supports Expression Language: true**                                                                                                                                                                                    
                                                        |

Review Comment:
   The **Bucket** property line was removed from line 643 but added back at line 656. This appears to be an unintentional reordering that could confuse users expecting properties to be in a consistent order across similar processors.



##########
PROCESSORS.md:
##########
@@ -1038,7 +1043,6 @@ In the list below, the names of required properties appear in bold. Any other pr
 
 | Name                             | Default Value | Allowable Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Description                                                                                                                                                                                                                                          
                                                        |
 |----------------------------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -------------------------------------------------------|
-| **Bucket**                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | The S3 bucket<br/>**Supports Expression Language: true**                                                                                                                                                                                             
                                                        |
 | Access Key                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | AWS account access key<br/>**Supports Expression Language: true**                                                                                                                                                                                    
                                                        |

Review Comment:
   Similar to the previous comment, the **Bucket** property was removed from line 1045 but added back at line 1059. This inconsistent property ordering should be maintained across all AWS processor documentation.



##########
PROCESSORS.md:
##########
@@ -2601,7 +2612,6 @@ In the list below, the names of required properties appear in bold. Any other pr
 
 | Name                                   | Default Value            | Allowable Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Description                                                                                                                                                                                                                         
                                                                         |
 |----------------------------------------|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ------------------------------------------------------------------------|
-| **Bucket**                             |                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | The S3 bucket<br/>**Supports Expression Language: true**                                                                                                                                                                            
                                                                         |
 | Access Key                             |                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | AWS account access key<br/>**Supports Expression Language: true**                                                                                                                                                                   
                                                                         |

Review Comment:
   The **Bucket** property reordering pattern appears again - removed from line 2614 but added back at line 2628. All AWS processor documentation should maintain consistent property ordering.



##########
PROCESSORS.md:
##########
@@ -1698,7 +1706,6 @@ In the list below, the names of required properties appear in bold. Any other pr
 
 | Name                             | Default Value | Allowable Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Description                                                                                                                                                                                                                                          
                                                        |
 |----------------------------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -------------------------------------------------------|
-| **Bucket**                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | The S3 bucket<br/>**Supports Expression Language: true**                                                                                                                                                                                             
                                                        |
 | Access Key                       |               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | AWS account access key<br/>**Supports Expression Language: true**                                                                                                                                                                                    
                                                        |

Review Comment:
   The **Bucket** property ordering issue continues here - removed from line 1708 but added back at line 1722. This pattern should be consistent across all AWS processor documentation sections.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2536032818


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   If we add this type definition to the API, we can't change it later without breaking API.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2537155859


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   We could change this to have separate getter function for each field like we do on the SSLContextServiceInterface, in that way that can be extended when new properties are introduced, what do you think?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2523491692


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   details like this should not be on the API. username/password can be optional and replaced by other auth methods in some other proxy protocols. Possibly even hostname and port can vary.



##########
CONTROLLERS.md:
##########
@@ -244,6 +245,24 @@ In the list below, the names of required properties appear in bold. Any other pr
 | **File**                  |               |                  | Path to a file to store state                                                                                                                          |
 
 
+## ProxyConfigurationService
+
+### Description
+
+Provides a set of configurations for different MiNiFi C++ components to use a proxy server.

Review Comment:
   The proxy protocol is not specified anywhere. Typical options include http, https, socks4, socks4a, socks5. We should document what this service uses and leave the door open for more protocols in the future.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r3086644869


##########
extensions/aws/processors/AwsProcessor.cpp:
##########
@@ -66,15 +66,25 @@ std::optional<Aws::Auth::AWSCredentials> AwsProcessor::getAWSCredentials(
   return aws_credentials_provider.getAWSCredentials();
 }
 
-aws::ProxyOptions AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
-  aws::ProxyOptions proxy;
-
-  proxy.host = minifi::utils::parseOptionalProperty(context, ProxyHost, flow_file).value_or("");
-  proxy.port = gsl::narrow<uint32_t>(minifi::utils::parseOptionalU64Property(context, ProxyPort, flow_file).value_or(0));
-  proxy.username = minifi::utils::parseOptionalProperty(context, ProxyUsername, flow_file).value_or("");
-  proxy.password = minifi::utils::parseOptionalProperty(context, ProxyPassword, flow_file).value_or("");
+minifi::controllers::ProxyConfiguration AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
+  minifi::controllers::ProxyConfiguration proxy;
+
+  auto proxy_controller_service = minifi::utils::parseOptionalControllerService<minifi::controllers::ProxyConfigurationServiceInterface>(context, ProxyConfigurationService, getUUID());
+  if (proxy_controller_service) {
+    proxy.proxy_type = proxy_controller_service->getProxyType();
+    proxy.proxy_host = proxy_controller_service->getHost();
+    proxy.proxy_port = proxy_controller_service->getPort().value_or(0);
+    proxy.proxy_user = proxy_controller_service->getUsername().value_or("");
+    proxy.proxy_password = proxy_controller_service->getPassword().value_or("");
+  } else {
+    proxy.proxy_type = minifi::utils::parseOptionalEnumProperty<minifi::controllers::ProxyType>(context, ProxyType).value_or(minifi::controllers::ProxyType::HTTP);

Review Comment:
   Added DIRECT option in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/8890e9fe63b26c4f38dc59af04906e40c737b5cf, but I kept the HTTP as the default as the main intention should be to use a proxy when a controller is added.



##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   Updated in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/8890e9fe63b26c4f38dc59af04906e40c737b5cf



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2888613141


##########
extensions/aws/processors/AwsProcessor.h:
##########
@@ -131,6 +132,11 @@ class AwsProcessor : public core::ProcessorImpl {  // NOLINT(cppcoreguidelines-s
       .withValidator(core::StandardPropertyValidators::NON_BLANK_VALIDATOR)
       .supportsExpressionLanguage(true)
       .build();
+  EXTENSIONAPI static constexpr auto ProxyType = core::PropertyDefinitionBuilder<magic_enum::enum_count<minifi::controllers::ProxyType>()>::createProperty("Proxy Type")
+      .withDescription("Proxy type")
+      .withDefaultValue(magic_enum::enum_name(minifi::controllers::ProxyType::HTTP))
+      .withAllowedValues(magic_enum::enum_names<minifi::controllers::ProxyType>())
+      .build();

Review Comment:
   It is also present in the controller service, but the proxy properties were already present in the AWS processors before introducing the proxy controller service, so this needs to be added here too. Maybe we can deprecate it in the future and remove them to only use the proxy controller service. In NiFi 2.0 they also removed the proxy properties leaving the proxy configuration service property. I would not suggest using the existing proxy properties for host, port, username, password, but require adding a controller service just for the proxy type.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2888647315


##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   I'm not sure I'm convinced about this. What do you mean by "one more impossible state unrepresentable"? It seem a bit unintuitive to me. When the user adds a proxy controller service their intention is to use a proxy, if they do not want to use a proxy they should not add a service at all. What would be the benefit of adding a proxy service and configure it to not to use a proxy?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2840700934


##########
extensions/aws/processors/AwsProcessor.h:
##########
@@ -131,6 +132,11 @@ class AwsProcessor : public core::ProcessorImpl {  // NOLINT(cppcoreguidelines-s
       .withValidator(core::StandardPropertyValidators::NON_BLANK_VALIDATOR)
       .supportsExpressionLanguage(true)
       .build();
+  EXTENSIONAPI static constexpr auto ProxyType = core::PropertyDefinitionBuilder<magic_enum::enum_count<minifi::controllers::ProxyType>()>::createProperty("Proxy Type")
+      .withDescription("Proxy type")
+      .withDefaultValue(magic_enum::enum_name(minifi::controllers::ProxyType::HTTP))
+      .withAllowedValues(magic_enum::enum_names<minifi::controllers::ProxyType>())
+      .build();

Review Comment:
   this belongs in the ProxyConfigurationService, not in the processors. In NiFi the same controller service specifies all proxy details, including the type/protocol.



##########
extensions/aws/processors/AwsProcessor.cpp:
##########
@@ -66,15 +66,25 @@ std::optional<Aws::Auth::AWSCredentials> AwsProcessor::getAWSCredentials(
   return aws_credentials_provider.getAWSCredentials();
 }
 
-aws::ProxyOptions AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
-  aws::ProxyOptions proxy;
-
-  proxy.host = minifi::utils::parseOptionalProperty(context, ProxyHost, flow_file).value_or("");
-  proxy.port = gsl::narrow<uint32_t>(minifi::utils::parseOptionalU64Property(context, ProxyPort, flow_file).value_or(0));
-  proxy.username = minifi::utils::parseOptionalProperty(context, ProxyUsername, flow_file).value_or("");
-  proxy.password = minifi::utils::parseOptionalProperty(context, ProxyPassword, flow_file).value_or("");
+minifi::controllers::ProxyConfiguration AwsProcessor::getProxy(core::ProcessContext& context, const core::FlowFile* const flow_file) {
+  minifi::controllers::ProxyConfiguration proxy;
+
+  auto proxy_controller_service = minifi::utils::parseOptionalControllerService<minifi::controllers::ProxyConfigurationServiceInterface>(context, ProxyConfigurationService, getUUID());
+  if (proxy_controller_service) {
+    proxy.proxy_type = proxy_controller_service->getProxyType();
+    proxy.proxy_host = proxy_controller_service->getHost();
+    proxy.proxy_port = proxy_controller_service->getPort().value_or(0);
+    proxy.proxy_user = proxy_controller_service->getUsername().value_or("");
+    proxy.proxy_password = proxy_controller_service->getPassword().value_or("");
+  } else {
+    proxy.proxy_type = minifi::utils::parseOptionalEnumProperty<minifi::controllers::ProxyType>(context, ProxyType).value_or(minifi::controllers::ProxyType::HTTP);

Review Comment:
   We should add a DIRECT option and make it the default.



##########
extensions/azure/storage/DataLakeStorageClient.h:
##########
@@ -39,6 +41,7 @@ struct AzureDataLakeStorageParameters {
   std::string file_system_name;
   std::string directory_name;
   std::optional<uint64_t> number_of_retries;
+  std::optional<minifi::controllers::ProxyConfiguration> proxy_configuration;

Review Comment:
   Instead of an optional member, it could default to type==DIRECT, which means no proxy. That would make one more impossible state unrepresentable, which is considered a best practice nowadays.



##########
libminifi/include/controllers/ProxyConfigurationService.h:
##########
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <mutex>
+
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "controllers/ProxyConfiguration.h"
+#include "core/controller/ControllerService.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/PropertyValidator.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+class ProxyConfigurationService : public core::controller::ControllerServiceImpl, public ProxyConfigurationServiceInterface {

Review Comment:
   I'd keep the naming consistent with NiFi and call this StandardProxyConfigurationService



##########
extensions/azure/tests/DeleteAzureBlobStorageTests.cpp:
##########
@@ -339,4 +339,30 @@ TEST_CASE_METHOD(DeleteAzureBlobStorageTestsFixture, "Test Azure blob delete wit
   REQUIRE(failed_flowfiles[0] == TEST_DATA);
 }
 
+TEST_CASE_METHOD(DeleteAzureBlobStorageTestsFixture, "Test Azure blob delete using proxy", "[azureBlobStorageDelete]") {

Review Comment:
   Since this logic is in shared code, I'd only add one unit test, not one for each processor.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2536946794


##########
minifi-api/include/minifi-cpp/controllers/ProxyConfigurationServiceInterface.h:
##########
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "minifi-cpp/core/controller/ControllerService.h"
+#include "minifi-cpp/core/ControllerServiceApiDefinition.h"
+
+namespace org::apache::nifi::minifi::controllers {
+
+struct ProxyConfiguration {
+  std::string proxy_host;
+  std::optional<uint16_t> proxy_port;
+  std::optional<std::string> proxy_user;
+  std::optional<std::string> proxy_password;
+};

Review Comment:
   I'm not sure what would be the best way to define this to adjust it to the future C API. In the current form I think it will only be extended, so non of the current field will be changed in the future. We should discuss this how these cases should be handled in the future, because I think additional fields being added to a struct on the API can be common. We can either define some additional `reserved` fields on the C API for future extensions, we can define some accessors on the C API so the struct itself will not be published to the API, or we can just break it when needed if we can predict that it will not be changed for a long time. I think we still have some time for think about this as controller services will not be supported on the C API for a while. What do you suggest in this case?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #2045:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2045#discussion_r2523743740


##########
CONTROLLERS.md:
##########
@@ -244,6 +245,24 @@ In the list below, the names of required properties appear in bold. Any other pr
 | **File**                  |               |                  | Path to a file to store state                                                                                                                          |
 
 
+## ProxyConfigurationService
+
+### Description
+
+Provides a set of configurations for different MiNiFi C++ components to use a proxy server.

Review Comment:
   Good point, we only support HTTP proxy at the moment. The controller is based on the NiFi counterpart https://nifi.apache.org/components/org.apache.nifi.proxy.StandardProxyConfigurationService/ where the proxy type can be specified if there are additional options. We can add that in the future if we want to support more protocols. Currently the cloud providers usually support only HTTP proxies, the newer AWS SDK should support HTTPS as well, we can introduce that later if needed. Added additional info to the description in https://github.com/apache/nifi-minifi-cpp/pull/2045/commits/2b46713093565c2e54d6e0bbea6ec8723679096c



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org