You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "szaszm (via GitHub)" <gi...@apache.org> on 2026/03/02 19:37:25 UTC
Re: [PR] MINIFICPP-2644 Add proxy controller service support for AWS and Azure processors [nifi-minifi-cpp]
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