This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit bf1dfd0615a8c1eb2f8b90480c8a70ca3b86cba4
Author: Mark Payne <[email protected]>
AuthorDate: Thu Jan 18 17:08:38 2024 -0500

    NIFI-12637 Handle migrating Proxy properties for InvokeHTTP
    
    This closes #8270
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../org/apache/nifi/processors/standard/InvokeHTTP.java    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
index fc378e0ce8..1c477d319b 100644
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
@@ -597,6 +597,20 @@ public class InvokeHTTP extends AbstractProcessor {
 
     @Override
     public void migrateProperties(final PropertyConfiguration config) {
+        if (config.isPropertySet("Proxy Host")) {
+            final Map<String, String> serviceProperties = new HashMap<>();
+            serviceProperties.put("proxy-type", 
config.getRawPropertyValue("Proxy Type").map(String::toUpperCase).orElse(null));
+            serviceProperties.put("proxy-server-host", 
config.getRawPropertyValue("Proxy Host").orElse(null));
+            serviceProperties.put("proxy-server-port", 
config.getRawPropertyValue("Proxy Port").orElse(null));
+            serviceProperties.put("proxy-user-name", 
config.getRawPropertyValue("invokehttp-proxy-user").orElse(null));
+            serviceProperties.put("proxy-user-password", 
config.getRawPropertyValue("invokehttp-proxy-password").orElse(null));
+
+            final String serviceId = 
config.createControllerService("org.apache.nifi.proxy.StandardProxyConfigurationService",
 serviceProperties);
+            config.setProperty(PROXY_CONFIGURATION_SERVICE, serviceId);
+        } else {
+            config.removeProperty("Proxy Type");
+        }
+
         config.renameProperty("Read Timeout", SOCKET_READ_TIMEOUT.getName());
         config.renameProperty("Remote URL", HTTP_URL.getName());
         config.renameProperty("disable-http2", HTTP2_DISABLED.getName());

Reply via email to