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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]