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 ad5614cca93722a0e04d2430fbdeaa2f5dae196f
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Jan 29 11:36:47 2018 +0100

    CAMEL-12205 - Camel-AWS S3: Add parameters to specify S3ClientOptions - 
PayloadSigningEnabled option
---
 .../camel-aws/src/main/docs/aws-s3-component.adoc   |  3 ++-
 .../camel/component/aws/s3/S3Configuration.java     | 21 +++++++++++++++++----
 .../apache/camel/component/aws/s3/S3Endpoint.java   |  4 ++++
 .../aws/s3/S3ComponentConfigurationTest.java        | 12 ++++++++++++
 .../aws/s3/springboot/S3ComponentConfiguration.java | 15 +++++++++++++++
 5 files changed, 50 insertions(+), 5 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 9deb61d..0ab33ca 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 (48 parameters):
+==== Query Parameters (49 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
@@ -115,6 +115,7 @@ with the following path and query parameters:
 | *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
+| *payloadSigningEnabled* ( advanced) | Define if Payload Signing 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 7759d64..d0fd8f2 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
@@ -78,6 +78,8 @@ public class S3Configuration implements Cloneable {
     private boolean accelerateModeEnabled;
     @UriParam(label = "common, advanced", defaultValue = "false")
     private boolean dualstackEnabled;
+    @UriParam(label = "common, advanced", defaultValue = "false")
+    private boolean payloadSigningEnabled;
     @UriParam(label = "producer,advanced", defaultValue = "false")
     private boolean useAwsKMS;
     @UriParam(label = "producer,advanced")
@@ -410,17 +412,28 @@ public class S3Configuration implements Cloneable {
         this.accelerateModeEnabled = accelerateModeEnabled;
     }
 
-    /**
-     * Define if Dualstack enabled is true or false
-     */
     public boolean isDualstackEnabled() {
         return dualstackEnabled;
     }
-
+    
+    /**
+     * Define if Dualstack enabled is true or false
+     */
     public void setDualstackEnabled(boolean dualstackEnabled) {
         this.dualstackEnabled = dualstackEnabled;
     }
 
+    public boolean isPayloadSigningEnabled() {
+        return payloadSigningEnabled;
+    }
+
+    /**
+     * Define if Payload Signing enabled is true or false
+     */
+    public void setPayloadSigningEnabled(boolean payloadSigningEnabled) {
+        this.payloadSigningEnabled = payloadSigningEnabled;
+    }
+
     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 c19211a..6ce9e33 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
@@ -265,6 +265,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 clientBuilder = 
clientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 clientBuilder = 
clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
                 clientBuilder = 
clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
+                clientBuilder = 
clientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
                 client = clientBuilder.build();
             } else {
                 if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
@@ -274,6 +275,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 encClientBuilder = 
encClientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 encClientBuilder = 
encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
                 encClientBuilder = 
encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
+                encClientBuilder = 
encClientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
                 client = encClientBuilder.build();
             }
         } else {
@@ -293,6 +295,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 clientBuilder = 
clientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 clientBuilder = 
clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
                 clientBuilder = 
clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
+                clientBuilder = 
clientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
                 client = clientBuilder.build();
                 
             } else {
@@ -303,6 +306,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 encClientBuilder = 
encClientBuilder.withChunkedEncodingDisabled(configuration.isChunkedEncodingDisabled());
                 encClientBuilder = 
encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
                 encClientBuilder = 
encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
+                encClientBuilder = 
encClientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
                 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 8d87590..754834d 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
@@ -208,6 +208,18 @@ public class S3ComponentConfigurationTest extends 
CamelTestSupport {
     }
     
     @Test
+    public void createEndpointWithPayloadSigning() throws Exception {
+        
+        S3Component component = new S3Component(context);
+        S3Endpoint endpoint = (S3Endpoint) 
component.createEndpoint("aws-s3://MyBucket?payloadSigningEnabled=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().isPayloadSigningEnabled());
+    }
+    
+    @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 05e2903..a800215 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,7 +243,14 @@ public class S3ComponentConfiguration
          * Define if Accelerate Mode enabled is true or false
          */
         private Boolean accelerateModeEnabled = false;
+        /**
+         * Define if Dualstack enabled is true or false
+         */
         private Boolean dualstackEnabled = false;
+        /**
+         * Define if Payload Signing enabled is true or false
+         */
+        private Boolean payloadSigningEnabled = false;
 
         public Long getPartSize() {
             return partSize;
@@ -469,5 +476,13 @@ public class S3ComponentConfiguration
         public void setDualstackEnabled(Boolean dualstackEnabled) {
             this.dualstackEnabled = dualstackEnabled;
         }
+
+        public Boolean getPayloadSigningEnabled() {
+            return payloadSigningEnabled;
+        }
+
+        public void setPayloadSigningEnabled(Boolean payloadSigningEnabled) {
+            this.payloadSigningEnabled = payloadSigningEnabled;
+        }
     }
 }
\ No newline at end of file

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

Reply via email to