You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/11/19 12:56:46 UTC

[camel] branch master updated (669745e -> 60928aa)

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

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


    from 669745e  (chores) Simplified assertions (#4632)
     new c6f4642  CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration
     new b45ccc5  CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, added integration tests
     new 02c0653  CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, Fixed CS
     new 793679d  CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, if Presigner is autowired, do not close it
     new 60928aa  CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, CS

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../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    | 19 +++--
 ...reateDownloadLinkOperationIntegrationTest.java} | 17 ++++-
 ...hProvidedPresignerOperationLocalstackTest.java} | 15 +++-
 .../dsl/Aws2S3ComponentBuilderFactory.java         | 16 ++++
 .../endpoint/dsl/AWS2S3EndpointBuilderFactory.java | 88 ++++++++++++++++++++++
 .../modules/ROOT/pages/aws2-s3-component.adoc      |  6 +-
 13 files changed, 190 insertions(+), 19 deletions(-)
 copy components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/{localstack/S3CreateDownloadLinkOperationLocalstackTest.java => integration/S3CreateDownloadLinkOperationIntegrationTest.java} (80%)
 copy components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/{S3CreateDownloadLinkOperationLocalstackTest.java => S3CreateDownloadLinkWithProvidedPresignerOperationLocalstackTest.java} (83%)


[camel] 03/05: CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, Fixed CS

Posted by ac...@apache.org.
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 02c0653a517c09690c933736d3fb696e7c20797a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 19 13:48:03 2020 +0100

    CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, Fixed CS
---
 .../s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java
index aaf8097..4b081f8 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java
@@ -29,7 +29,6 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Disabled;
 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;
@@ -44,7 +43,7 @@ public class S3CreateDownloadLinkOperationIntegrationTest extends CamelTestSuppo
     S3Client client
             = S3Client.builder().credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("xxx", "yyy")))
                     .region(Region.EU_WEST_1).build();
-    
+
     @EndpointInject
     private ProducerTemplate template;
 


[camel] 05/05: CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, CS

Posted by ac...@apache.org.
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 60928aadcd90a10865168fa9d12daa6eb9f892f5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 19 13:55:30 2020 +0100

    CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, CS
---
 .../main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 8dbdabf..d980f48 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
@@ -545,7 +545,7 @@ public class AWS2S3Producer extends DefaultProducer {
 
         Message message = getMessageForResponse(exchange);
         message.setBody(presignedGetObjectRequest.url().toString());
-        
+
         if (ObjectHelper.isEmpty(getConfiguration().getAmazonS3Presigner())) {
             presigner.close();
         }


[camel] 01/05: CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration

Posted by ac...@apache.org.
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 <an...@gmail.com>
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


[camel] 02/05: CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, added integration tests

Posted by ac...@apache.org.
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 b45ccc55822f77ef33aae2402d172570546c4566
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 19 13:32:35 2020 +0100

    CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, added integration tests
---
 ...CreateDownloadLinkOperationIntegrationTest.java | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java
new file mode 100644
index 0000000..aaf8097
--- /dev/null
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CreateDownloadLinkOperationIntegrationTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.integration;
+
+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.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+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.S3Client;
+
+import static org.junit.Assert.assertNotNull;
+
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
+public class S3CreateDownloadLinkOperationIntegrationTest extends CamelTestSupport {
+
+    @BindToRegistry("amazonS3Client")
+    S3Client client
+            = S3Client.builder().credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("xxx", "yyy")))
+                    .region(Region.EU_WEST_1).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 + "&accessKey=xxx&secretKey=yyy&region=eu-west-1")
+                        .to("mock:result");
+
+            }
+        };
+    }
+}


[camel] 04/05: CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, if Presigner is autowired, do not close it

Posted by ac...@apache.org.
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 793679d83b86abe38e4528bd83073bb046cc83c2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 19 13:49:56 2020 +0100

    CAMEL-15867 - Camel-AWS2-S3: Add a an Autowired S3Presigner UriParam in Configuration, if Presigner is autowired, do not close it
---
 .../java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 c928d01..8dbdabf 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
@@ -545,8 +545,10 @@ public class AWS2S3Producer extends DefaultProducer {
 
         Message message = getMessageForResponse(exchange);
         message.setBody(presignedGetObjectRequest.url().toString());
-
-        presigner.close();
+        
+        if (ObjectHelper.isEmpty(getConfiguration().getAmazonS3Presigner())) {
+            presigner.close();
+        }
     }
 
     private AWS2S3Operations determineOperation(Exchange exchange) {