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

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2255ed575a6afa5b81591353a1b664a5642a44db
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Jan 29 11:24:43 2018 +0100

    CAMEL-12205 - Camel-AWS S3: Add parameters to specify S3ClientOptions - 
DualstackEnabled option
---
 components/camel-aws/src/main/docs/aws-s3-component.adoc   |  3 ++-
 .../org/apache/camel/component/aws/s3/S3Configuration.java | 14 +++++++++++++-
 .../java/org/apache/camel/component/aws/s3/S3Endpoint.java |  4 ++++
 .../component/aws/s3/S3ComponentConfigurationTest.java     | 12 ++++++++++++
 .../aws/s3/springboot/S3ComponentConfiguration.java        |  9 +++++++++
 5 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws/src/main/docs/aws-s3-component.adoc 
b/components/camel-aws/src/main/docs/aws-s3-component.adoc
index edccb1c..9deb61d 100644
--- a/components/camel-aws/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-s3-component.adoc
@@ -77,7 +77,7 @@ with the following path and query parameters:
 | *bucketNameOrArn* | *Required* Bucket name or ARN |  | String
 |===
 
-==== Query Parameters (47 parameters):
+==== Query Parameters (48 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
@@ -114,6 +114,7 @@ with the following path and query parameters:
 | *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
 | *accelerateModeEnabled* ( advanced) | Define if Accelerate Mode enabled is 
true or false | false | boolean
 | *chunkedEncodingDisabled* ( advanced) | Define if disabled Chunked Encoding 
is true or false | false | boolean
+| *dualstackEnabled* ( advanced) | Define if Dualstack enabled is true or 
false | false | boolean
 | *backoffErrorThreshold* (scheduler) | The number of subsequent error polls 
(failed due some error) that should happen before the backoffMultipler should 
kick-in. |  | int
 | *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls 
that should happen before the backoffMultipler should kick-in. |  | int
 | *backoffMultiplier* (scheduler) | To let the scheduled polling consumer 
backoff if there has been a number of subsequent idles/errors in a row. The 
multiplier is then the number of polls that will be skipped before the next 
actual attempt is happening again. When this option is in use then 
backoffIdleThreshold and/or backoffErrorThreshold must also be configured. |  | 
int
diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
index 2edbb3c..7759d64 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.aws.s3;
 
 import com.amazonaws.services.s3.AmazonS3;
-import com.amazonaws.services.s3.S3ClientOptions;
 import com.amazonaws.services.s3.model.EncryptionMaterials;
 
 import org.apache.camel.RuntimeCamelException;
@@ -77,6 +76,8 @@ public class S3Configuration implements Cloneable {
     private boolean chunkedEncodingDisabled;
     @UriParam(label = "common, advanced", defaultValue = "false")
     private boolean accelerateModeEnabled;
+    @UriParam(label = "common, advanced", defaultValue = "false")
+    private boolean dualstackEnabled;
     @UriParam(label = "producer,advanced", defaultValue = "false")
     private boolean useAwsKMS;
     @UriParam(label = "producer,advanced")
@@ -409,6 +410,17 @@ public class S3Configuration implements Cloneable {
         this.accelerateModeEnabled = accelerateModeEnabled;
     }
 
+    /**
+     * Define if Dualstack enabled is true or false
+     */
+    public boolean isDualstackEnabled() {
+        return dualstackEnabled;
+    }
+
+    public void setDualstackEnabled(boolean dualstackEnabled) {
+        this.dualstackEnabled = dualstackEnabled;
+    }
+
     boolean hasProxyConfiguration() {
         return ObjectHelper.isNotEmpty(getProxyHost()) && 
ObjectHelper.isNotEmpty(getProxyPort());
     }
diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index a0196dd..c19211a 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -264,6 +264,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 clientBuilder = 
clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 clientBuilder = 
clientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 clientBuilder = 
clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
+                clientBuilder = 
clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
                 client = clientBuilder.build();
             } else {
                 if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
@@ -272,6 +273,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 encClientBuilder = 
encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 encClientBuilder = 
encClientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 encClientBuilder = 
encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
+                encClientBuilder = 
encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
                 client = encClientBuilder.build();
             }
         } else {
@@ -290,6 +292,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 clientBuilder = 
clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 clientBuilder = 
clientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 clientBuilder = 
clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
+                clientBuilder = 
clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
                 client = clientBuilder.build();
                 
             } else {
@@ -299,6 +302,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 encClientBuilder = 
encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 encClientBuilder = 
encClientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 encClientBuilder = 
encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
+                encClientBuilder = 
encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
                 client = encClientBuilder.build();
             }
         }
diff --git 
a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
 
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
index 8ebae26..8d87590 100644
--- 
a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
+++ 
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
@@ -196,6 +196,18 @@ public class S3ComponentConfigurationTest extends 
CamelTestSupport {
     }
     
     @Test
+    public void createEndpointWithDualstack() throws Exception {
+        
+        S3Component component = new S3Component(context);
+        S3Endpoint endpoint = (S3Endpoint) 
component.createEndpoint("aws-s3://MyBucket?dualstackEnabled=true&accessKey=xxx&secretKey=yyy&region=US_WEST_1");
+
+        assertEquals("MyBucket", endpoint.getConfiguration().getBucketName());
+        assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
+        assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
+        assertTrue(endpoint.getConfiguration().isDualstackEnabled());
+    }
+    
+    @Test
     public void createEndpointWithoutSecretKeyAndAccessKeyConfiguration() 
throws Exception {
         AmazonS3ClientMock mock = new AmazonS3ClientMock();
         
diff --git 
a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
index c09047c..05e2903 100644
--- 
a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
+++ 
b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
@@ -243,6 +243,7 @@ public class S3ComponentConfiguration
          * Define if Accelerate Mode enabled is true or false
          */
         private Boolean accelerateModeEnabled = false;
+        private Boolean dualstackEnabled = false;
 
         public Long getPartSize() {
             return partSize;
@@ -460,5 +461,13 @@ public class S3ComponentConfiguration
         public void setAccelerateModeEnabled(Boolean accelerateModeEnabled) {
             this.accelerateModeEnabled = accelerateModeEnabled;
         }
+
+        public Boolean getDualstackEnabled() {
+            return dualstackEnabled;
+        }
+
+        public void setDualstackEnabled(Boolean dualstackEnabled) {
+            this.dualstackEnabled = dualstackEnabled;
+        }
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to