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 c6f464297c5e256dfa84ba07dcd33cb23896fac7
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Nov 19 12:22:36 2020 +0100

    CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in 
Configuration
---
 .../camel/catalog/docs/aws2-s3-component.adoc      |   6 +-
 .../aws2/s3/AWS2S3ComponentConfigurer.java         |   8 +-
 .../aws2/s3/AWS2S3EndpointConfigurer.java          |   8 +-
 .../aws2/s3/AWS2S3EndpointUriFactory.java          |   3 +-
 .../apache/camel/component/aws2/s3/aws2-s3.json    |   2 +
 .../src/main/docs/aws2-s3-component.adoc           |   6 +-
 .../component/aws2/s3/AWS2S3Configuration.java     |  15 +++
 .../camel/component/aws2/s3/AWS2S3Producer.java    |  15 ++-
 ...thProvidedPresignerOperationLocalstackTest.java | 101 +++++++++++++++++++++
 .../dsl/Aws2S3ComponentBuilderFactory.java         |  16 ++++
 .../endpoint/dsl/AWS2S3EndpointBuilderFactory.java |  88 ++++++++++++++++++
 .../modules/ROOT/pages/aws2-s3-component.adoc      |   6 +-
 12 files changed, 260 insertions(+), 14 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
index ebbd654..a94d3cc 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-s3-component.adoc
@@ -47,7 +47,7 @@ 
from("aws2-s3://helloBucket?accessKey=yourAccessKey&secretKey=yourSecretKey&pref
 
 
 // component options: START
-The AWS 2 S3 Storage Service component supports 41 options, which are listed 
below.
+The AWS 2 S3 Storage Service component supports 42 options, which are listed 
below.
 
 
 
@@ -55,6 +55,7 @@ The AWS 2 S3 Storage Service component supports 41 options, 
which are listed bel
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *configuration* (common) | The component configuration |  | 
AWS2S3Configuration
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
@@ -127,13 +128,14 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (60 parameters):
+=== Query Parameters (61 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
 | *pojoRequest* (common) | If we want to use a POJO request as body or not | 
false | boolean
diff --git 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
index 2354055..2852bd5 100644
--- 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
+++ 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3ComponentConfigurer.java
@@ -32,6 +32,8 @@ public class AWS2S3ComponentConfigurer extends 
PropertyConfigurerSupport impleme
         case "accessKey": 
getOrCreateConfiguration(target).setAccessKey(property(camelContext, 
java.lang.String.class, value)); return true;
         case "amazons3client":
         case "amazonS3Client": 
getOrCreateConfiguration(target).setAmazonS3Client(property(camelContext, 
software.amazon.awssdk.services.s3.S3Client.class, value)); return true;
+        case "amazons3presigner":
+        case "amazonS3Presigner": 
getOrCreateConfiguration(target).setAmazonS3Presigner(property(camelContext, 
software.amazon.awssdk.services.s3.presigner.S3Presigner.class, value)); return 
true;
         case "autocreatebucket":
         case "autoCreateBucket": 
getOrCreateConfiguration(target).setAutoCreateBucket(property(camelContext, 
boolean.class, value)); return true;
         case "autoclosebody":
@@ -110,7 +112,7 @@ public class AWS2S3ComponentConfigurer extends 
PropertyConfigurerSupport impleme
 
     @Override
     public String[] getAutowiredNames() {
-        return new String[]{"amazonS3Client"};
+        return new String[]{"amazonS3Client","amazonS3Presigner"};
     }
 
     @Override
@@ -120,6 +122,8 @@ public class AWS2S3ComponentConfigurer extends 
PropertyConfigurerSupport impleme
         case "accessKey": return java.lang.String.class;
         case "amazons3client":
         case "amazonS3Client": return 
software.amazon.awssdk.services.s3.S3Client.class;
+        case "amazons3presigner":
+        case "amazonS3Presigner": return 
software.amazon.awssdk.services.s3.presigner.S3Presigner.class;
         case "autocreatebucket":
         case "autoCreateBucket": return boolean.class;
         case "autoclosebody":
@@ -204,6 +208,8 @@ public class AWS2S3ComponentConfigurer extends 
PropertyConfigurerSupport impleme
         case "accessKey": return 
getOrCreateConfiguration(target).getAccessKey();
         case "amazons3client":
         case "amazonS3Client": return 
getOrCreateConfiguration(target).getAmazonS3Client();
+        case "amazons3presigner":
+        case "amazonS3Presigner": return 
getOrCreateConfiguration(target).getAmazonS3Presigner();
         case "autocreatebucket":
         case "autoCreateBucket": return 
getOrCreateConfiguration(target).isAutoCreateBucket();
         case "autoclosebody":
diff --git 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
index fbb8e5a..eca7a1e 100644
--- 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
+++ 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointConfigurer.java
@@ -25,6 +25,8 @@ public class AWS2S3EndpointConfigurer extends 
PropertyConfigurerSupport implemen
         case "accessKey": 
target.getConfiguration().setAccessKey(property(camelContext, 
java.lang.String.class, value)); return true;
         case "amazons3client":
         case "amazonS3Client": 
target.getConfiguration().setAmazonS3Client(property(camelContext, 
software.amazon.awssdk.services.s3.S3Client.class, value)); return true;
+        case "amazons3presigner":
+        case "amazonS3Presigner": 
target.getConfiguration().setAmazonS3Presigner(property(camelContext, 
software.amazon.awssdk.services.s3.presigner.S3Presigner.class, value)); return 
true;
         case "autocreatebucket":
         case "autoCreateBucket": 
target.getConfiguration().setAutoCreateBucket(property(camelContext, 
boolean.class, value)); return true;
         case "autoclosebody":
@@ -138,7 +140,7 @@ public class AWS2S3EndpointConfigurer extends 
PropertyConfigurerSupport implemen
 
     @Override
     public String[] getAutowiredNames() {
-        return new String[]{"amazonS3Client"};
+        return new String[]{"amazonS3Client","amazonS3Presigner"};
     }
 
     @Override
@@ -148,6 +150,8 @@ public class AWS2S3EndpointConfigurer extends 
PropertyConfigurerSupport implemen
         case "accessKey": return java.lang.String.class;
         case "amazons3client":
         case "amazonS3Client": return 
software.amazon.awssdk.services.s3.S3Client.class;
+        case "amazons3presigner":
+        case "amazonS3Presigner": return 
software.amazon.awssdk.services.s3.presigner.S3Presigner.class;
         case "autocreatebucket":
         case "autoCreateBucket": return boolean.class;
         case "autoclosebody":
@@ -267,6 +271,8 @@ public class AWS2S3EndpointConfigurer extends 
PropertyConfigurerSupport implemen
         case "accessKey": return target.getConfiguration().getAccessKey();
         case "amazons3client":
         case "amazonS3Client": return 
target.getConfiguration().getAmazonS3Client();
+        case "amazons3presigner":
+        case "amazonS3Presigner": return 
target.getConfiguration().getAmazonS3Presigner();
         case "autocreatebucket":
         case "autoCreateBucket": return 
target.getConfiguration().isAutoCreateBucket();
         case "autoclosebody":
diff --git 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointUriFactory.java
 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointUriFactory.java
index a57fb6d..963515f 100644
--- 
a/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointUriFactory.java
+++ 
b/components/camel-aws2-s3/src/generated/java/org/apache/camel/component/aws2/s3/AWS2S3EndpointUriFactory.java
@@ -20,7 +20,7 @@ public class AWS2S3EndpointUriFactory extends 
org.apache.camel.support.component
     private static final Set<String> PROPERTY_NAMES;
     private static final Set<String> SECRET_PROPERTY_NAMES;
     static {
-        Set<String> props = new HashSet<>(61);
+        Set<String> props = new HashSet<>(62);
         props.add("useIAMCredentials");
         props.add("customerAlgorithm");
         props.add("fileName");
@@ -58,6 +58,7 @@ public class AWS2S3EndpointUriFactory extends 
org.apache.camel.support.component
         props.add("exceptionHandler");
         props.add("backoffMultiplier");
         props.add("destinationBucket");
+        props.add("amazonS3Presigner");
         props.add("partSize");
         props.add("scheduler");
         props.add("multiPartUpload");
diff --git 
a/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
 
b/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
index aa75c86..7b4beba 100644
--- 
a/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
+++ 
b/components/camel-aws2-s3/src/generated/resources/org/apache/camel/component/aws2/s3/aws2-s3.json
@@ -23,6 +23,7 @@
   },
   "componentProperties": {
     "amazonS3Client": { "kind": "property", "displayName": "Amazon S3 Client", 
"group": "common", "label": "", "required": false, "type": "object", 
"javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry." },
+    "amazonS3Presigner": { "kind": "property", "displayName": "Amazon S3 
Presigner", "group": "common", "label": "", "required": false, "type": 
"object", "javaType": 
"software.amazon.awssdk.services.s3.presigner.S3Presigner", "deprecated": 
false, "deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "An S3 Presigner for 
Request, used mainly in createD [...]
     "autoCreateBucket": { "kind": "property", "displayName": "Auto Create 
Bucket", "group": "common", "label": "common", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfter [...]
     "configuration": { "kind": "property", "displayName": "Configuration", 
"group": "common", "label": "", "required": false, "type": "object", 
"javaType": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
component configuration" },
     "overrideEndpoint": { "kind": "property", "displayName": "Override 
Endpoint", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpoin [...]
@@ -67,6 +68,7 @@
   "properties": {
     "bucketNameOrArn": { "kind": "path", "displayName": "Bucket Name Or Arn", 
"group": "common", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "Bucket name or ARN" },
     "amazonS3Client": { "kind": "parameter", "displayName": "Amazon S3 
Client", "group": "common", "label": "", "required": false, "type": "object", 
"javaType": "software.amazon.awssdk.services.s3.S3Client", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry." },
+    "amazonS3Presigner": { "kind": "parameter", "displayName": "Amazon S3 
Presigner", "group": "common", "label": "", "required": false, "type": 
"object", "javaType": 
"software.amazon.awssdk.services.s3.presigner.S3Presigner", "deprecated": 
false, "deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": "org.apache.camel.component.aws2.s3.AWS2S3Configuration", 
"configurationField": "configuration", "description": "An S3 Presigner for 
Request, used mainly in create [...]
     "autoCreateBucket": { "kind": "parameter", "displayName": "Auto Create 
Bucket", "group": "common", "label": "common", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfte [...]
     "overrideEndpoint": { "kind": "parameter", "displayName": "Override 
Endpoint", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpoi [...]
     "pojoRequest": { "kind": "parameter", "displayName": "Pojo Request", 
"group": "common", "label": "", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.aws2.s3.AWS2S3Configuration", "configurationField": 
"configuration", "description": "If we want to use a POJO request as body or 
not" },
diff --git a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc 
b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
index ebbd654..a94d3cc 100644
--- a/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
+++ b/components/camel-aws2-s3/src/main/docs/aws2-s3-component.adoc
@@ -47,7 +47,7 @@ 
from("aws2-s3://helloBucket?accessKey=yourAccessKey&secretKey=yourSecretKey&pref
 
 
 // component options: START
-The AWS 2 S3 Storage Service component supports 41 options, which are listed 
below.
+The AWS 2 S3 Storage Service component supports 42 options, which are listed 
below.
 
 
 
@@ -55,6 +55,7 @@ The AWS 2 S3 Storage Service component supports 41 options, 
which are listed bel
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *configuration* (common) | The component configuration |  | 
AWS2S3Configuration
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
@@ -127,13 +128,14 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (60 parameters):
+=== Query Parameters (61 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
 | *pojoRequest* (common) | If we want to use a POJO request as body or not | 
false | boolean
diff --git 
a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
 
b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
index eedddbc..c0c5c84 100644
--- 
a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
+++ 
b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Configuration.java
@@ -22,6 +22,7 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import software.amazon.awssdk.core.Protocol;
 import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.presigner.S3Presigner;
 
 @UriParams
 public class AWS2S3Configuration implements Cloneable {
@@ -30,6 +31,9 @@ public class AWS2S3Configuration implements Cloneable {
     @UriParam
     @Metadata(autowired = true)
     private S3Client amazonS3Client;
+    @UriParam
+    @Metadata(autowired = true)
+    private S3Presigner amazonS3Presigner;
     @UriParam(label = "security", secret = true)
     private String accessKey;
     @UriParam(label = "security", secret = true)
@@ -547,6 +551,17 @@ public class AWS2S3Configuration implements Cloneable {
         this.trustAllCertificates = trustAllCertificates;
     }
 
+    public S3Presigner getAmazonS3Presigner() {
+        return amazonS3Presigner;
+    }
+
+    /**
+     * An S3 Presigner for Request, used mainly in createDownloadLink operation
+     */
+    public void setAmazonS3Presigner(S3Presigner amazonS3Presigner) {
+        this.amazonS3Presigner = amazonS3Presigner;
+    }
+
     public AWS2S3Configuration copy() {
         try {
             return (AWS2S3Configuration) super.clone();
diff --git 
a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
 
b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index 0756e55..c928d01 100644
--- 
a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ 
b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -518,13 +518,18 @@ public class AWS2S3Producer extends DefaultProducer {
         if (expirationMillis != null) {
             milliSeconds += expirationMillis;
         } else {
-            milliSeconds += 1000 * 60 * 60; // Default: Add 1 hour.
+            milliSeconds += 1000 * 60 * 60;
         }
+        S3Presigner presigner;
 
-        S3Presigner presigner = S3Presigner.builder()
-                .credentialsProvider(StaticCredentialsProvider.create(
-                        
AwsBasicCredentials.create(getConfiguration().getAccessKey(), 
getConfiguration().getSecretKey())))
-                .region(Region.of(getConfiguration().getRegion())).build();
+        if 
(ObjectHelper.isNotEmpty(getConfiguration().getAmazonS3Presigner())) {
+            presigner = getConfiguration().getAmazonS3Presigner();
+        } else {
+            presigner = S3Presigner.builder()
+                    .credentialsProvider(StaticCredentialsProvider.create(
+                            
AwsBasicCredentials.create(getConfiguration().getAccessKey(), 
getConfiguration().getSecretKey())))
+                    .region(Region.of(getConfiguration().getRegion())).build();
+        }
 
         GetObjectRequest getObjectRequest = GetObjectRequest.builder()
                 .bucket(bucketName)
diff --git 
a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3CreateDownloadLinkWithProvidedPresignerOperationLocalstackTest.java
 
b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3CreateDownloadLinkWithProvidedPresignerOperationLocalstackTest.java
new file mode 100644
index 0000000..bdd4f78
--- /dev/null
+++ 
b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3CreateDownloadLinkWithProvidedPresignerOperationLocalstackTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.aws2.s3.localstack;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.aws2.s3.AWS2S3Constants;
+import org.apache.camel.component.aws2.s3.AWS2S3Operations;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.s3.presigner.S3Presigner;
+
+import static org.junit.Assert.assertNotNull;
+
+public class S3CreateDownloadLinkWithProvidedPresignerOperationLocalstackTest 
extends Aws2S3BaseTest {
+
+    @BindToRegistry("amazonS3Presigner")
+    S3Presigner presigner
+            = S3Presigner.builder()
+                    
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("xxx",
 "yyy")))
+                    .region(Region.of(Region.EU_WEST_1.toString())).build();
+
+    @EndpointInject
+    private ProducerTemplate template;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void sendIn() throws Exception {
+        result.expectedMessageCount(1);
+
+        template.send("direct:listBucket", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(AWS2S3Constants.S3_OPERATION, 
AWS2S3Operations.listBuckets);
+            }
+        });
+
+        template.send("direct:addObject", ExchangePattern.InOnly, new 
Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(AWS2S3Constants.KEY, 
"CamelUnitTest2");
+                exchange.getIn().setBody("This is my bucket content.");
+                exchange.getIn().removeHeader(AWS2S3Constants.S3_OPERATION);
+            }
+        });
+
+        Exchange ex1 = template.request("direct:createDownloadLink", new 
Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(AWS2S3Constants.KEY, 
"CamelUnitTest2");
+                exchange.getIn().setHeader(AWS2S3Constants.BUCKET_NAME, 
"mycamel2");
+                exchange.getIn().setHeader(AWS2S3Constants.S3_OPERATION, 
AWS2S3Operations.createDownloadLink);
+            }
+        });
+
+        assertNotNull(ex1.getMessage().getBody());
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String awsEndpoint = 
"aws2-s3://mycamel2?autoCreateBucket=true";
+
+                from("direct:listBucket").to(awsEndpoint);
+
+                from("direct:addObject").to(awsEndpoint);
+
+                from("direct:createDownloadLink").to(awsEndpoint)
+                        .to("mock:result");
+
+            }
+        };
+    }
+}
diff --git 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2S3ComponentBuilderFactory.java
 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2S3ComponentBuilderFactory.java
index 936389b..2e32378 100644
--- 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2S3ComponentBuilderFactory.java
+++ 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2S3ComponentBuilderFactory.java
@@ -64,6 +64,21 @@ public interface Aws2S3ComponentBuilderFactory {
             return this;
         }
         /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option is a:
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default Aws2S3ComponentBuilder amazonS3Presigner(
+                software.amazon.awssdk.services.s3.presigner.S3Presigner 
amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
          * Setting the autocreation of the S3 bucket bucketName. This will 
apply
          * also in case of moveAfterRead option enabled and it will create the
          * destinationBucket if it doesn't exist already.
@@ -634,6 +649,7 @@ public interface Aws2S3ComponentBuilderFactory {
                 Object value) {
             switch (name) {
             case "amazonS3Client": getOrCreateConfiguration((AWS2S3Component) 
component).setAmazonS3Client((software.amazon.awssdk.services.s3.S3Client) 
value); return true;
+            case "amazonS3Presigner": 
getOrCreateConfiguration((AWS2S3Component) 
component).setAmazonS3Presigner((software.amazon.awssdk.services.s3.presigner.S3Presigner)
 value); return true;
             case "autoCreateBucket": 
getOrCreateConfiguration((AWS2S3Component) 
component).setAutoCreateBucket((boolean) value); return true;
             case "configuration": ((AWS2S3Component) 
component).setConfiguration((org.apache.camel.component.aws2.s3.AWS2S3Configuration)
 value); return true;
             case "overrideEndpoint": 
getOrCreateConfiguration((AWS2S3Component) 
component).setOverrideEndpoint((boolean) value); return true;
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
index 16a15b2..50d4b5c 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AWS2S3EndpointBuilderFactory.java
@@ -75,6 +75,36 @@ public interface AWS2S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option is a:
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointConsumerBuilder amazonS3Presigner(
+                Object amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option will be converted to a
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointConsumerBuilder amazonS3Presigner(
+                String amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
          * Setting the autocreation of the S3 bucket bucketName. This will 
apply
          * also in case of moveAfterRead option enabled and it will create the
          * destinationBucket if it doesn't exist already.
@@ -1303,6 +1333,36 @@ public interface AWS2S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option is a:
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointProducerBuilder amazonS3Presigner(
+                Object amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option will be converted to a
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointProducerBuilder amazonS3Presigner(
+                String amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
          * Setting the autocreation of the S3 bucket bucketName. This will 
apply
          * also in case of moveAfterRead option enabled and it will create the
          * destinationBucket if it doesn't exist already.
@@ -1911,6 +1971,34 @@ public interface AWS2S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option is a:
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointBuilder amazonS3Presigner(Object 
amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
+         * An S3 Presigner for Request, used mainly in createDownloadLink
+         * operation.
+         * 
+         * The option will be converted to a
+         * 
<code>software.amazon.awssdk.services.s3.presigner.S3Presigner</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default AWS2S3EndpointBuilder amazonS3Presigner(String 
amazonS3Presigner) {
+            doSetProperty("amazonS3Presigner", amazonS3Presigner);
+            return this;
+        }
+        /**
          * Setting the autocreation of the S3 bucket bucketName. This will 
apply
          * also in case of moveAfterRead option enabled and it will create the
          * destinationBucket if it doesn't exist already.
diff --git a/docs/components/modules/ROOT/pages/aws2-s3-component.adoc 
b/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
index ff211a9..b2e0809 100644
--- a/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-s3-component.adoc
@@ -49,7 +49,7 @@ 
from("aws2-s3://helloBucket?accessKey=yourAccessKey&secretKey=yourSecretKey&pref
 
 
 // component options: START
-The AWS 2 S3 Storage Service component supports 41 options, which are listed 
below.
+The AWS 2 S3 Storage Service component supports 42 options, which are listed 
below.
 
 
 
@@ -57,6 +57,7 @@ The AWS 2 S3 Storage Service component supports 41 options, 
which are listed bel
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *configuration* (common) | The component configuration |  | 
AWS2S3Configuration
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
@@ -129,13 +130,14 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (60 parameters):
+=== Query Parameters (61 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | *Autowired* Reference to a 
com.amazonaws.services.s3.AmazonS3 in the registry. |  | S3Client
+| *amazonS3Presigner* (common) | *Autowired* An S3 Presigner for Request, used 
mainly in createDownloadLink operation |  | S3Presigner
 | *autoCreateBucket* (common) | Setting the autocreation of the S3 bucket 
bucketName. This will apply also in case of moveAfterRead option enabled and it 
will create the destinationBucket if it doesn't exist already. | true | boolean
 | *overrideEndpoint* (common) | Set the need for overidding the endpoint. This 
option needs to be used in combination with uriEndpointOverride option | false 
| boolean
 | *pojoRequest* (common) | If we want to use a POJO request as body or not | 
false | boolean

Reply via email to