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/03/20 14:48:36 UTC

[camel] branch master updated (0ff02c5 -> d560772)

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 0ff02c5  CAMEL-14658 - Fixed CS
     new 6d09a35  CAMEL-14658 - Provide a simpler way to connect to a local s3 instance
     new 71cde90  CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, added a test
     new d560772  CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, Fixed CS

The 3 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:
 .../component/aws/s3/S3ComponentConfigurer.java    |  2 +
 .../component/aws/s3/S3EndpointConfigurer.java     |  2 +
 .../org/apache/camel/component/aws/s3/aws-s3.json  |  2 +
 .../src/main/docs/aws-s3-component.adoc            |  6 +-
 .../camel/component/aws/s3/S3Configuration.java    | 14 ++++
 .../apache/camel/component/aws/s3/S3Producer.java  |  2 +-
 .../s3/client/impl/S3ClientIAMOptimizedImpl.java   |  6 ++
 .../aws/s3/client/impl/S3ClientStandardImpl.java   | 12 ++++
 .../aws/s3/S3ComponentConfigurationTest.java       | 15 +++++
 .../S3ObjectRangeOperationIntegrationTest.java     |  2 +-
 .../dsl/AwsS3ComponentBuilderFactory.java          | 14 ++++
 .../endpoint/dsl/S3EndpointBuilderFactory.java     | 78 ++++++++++++++++++++++
 12 files changed, 151 insertions(+), 4 deletions(-)


[camel] 03/03: CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, 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 d560772f1551a25e104bcfb8eabdd4265c5da6d2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 20 15:47:05 2020 +0100

    CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, Fixed CS
---
 .../org/apache/camel/component/aws/s3/S3Configuration.java   | 12 ++++++------
 .../java/org/apache/camel/component/aws/s3/S3Producer.java   |  2 +-
 .../aws/s3/client/impl/S3ClientIAMOptimizedImpl.java         |  4 ++--
 .../component/aws/s3/client/impl/S3ClientStandardImpl.java   |  8 ++++----
 .../camel/component/aws/s3/S3ComponentConfigurationTest.java |  2 +-
 .../integration/S3ObjectRangeOperationIntegrationTest.java   |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
index dc9215c..f5892fd 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
@@ -146,17 +146,17 @@ public class S3Configuration implements Cloneable {
     }
 
     public EndpointConfiguration getEndpointConfiguration() {
-		return endpointConfiguration;
-	}
+        return endpointConfiguration;
+    }
 
     /**
      * Amazon AWS Endpoint Configuration
      */
-	public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration) {
-		this.endpointConfiguration = endpointConfiguration;
-	}
+    public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration) {
+        this.endpointConfiguration = endpointConfiguration;
+    }
 
-	public AmazonS3 getAmazonS3Client() {
+    public AmazonS3 getAmazonS3Client() {
         return amazonS3Client;
     }
 
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
index b4f8c63..488e02f 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
@@ -186,7 +186,7 @@ public class S3Producer extends DefaultProducer {
                 partSize = Math.min(partSize, contentLength - filePosition);
 
                 UploadPartRequest uploadRequest = new UploadPartRequest().withBucketName(getConfiguration().getBucketName()).withKey(keyName)
-                        .withUploadId(initResponse.getUploadId()).withPartNumber(part).withFileOffset(filePosition).withFile(filePayload).withPartSize(partSize);
+                    .withUploadId(initResponse.getUploadId()).withPartNumber(part).withFileOffset(filePosition).withFile(filePayload).withPartSize(partSize);
 
                 LOG.trace("Uploading part [{}] for {}", part, keyName);
                 partETags.add(getEndpoint().getS3Client().uploadPart(uploadRequest).getPartETag());
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
index abb5128..26b3624 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
@@ -88,7 +88,7 @@ public class S3ClientIAMOptimizedImpl implements S3Client {
             }
             clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
             if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-            	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
             }
             client = clientBuilder.build();
         } else {
@@ -97,7 +97,7 @@ public class S3ClientIAMOptimizedImpl implements S3Client {
             }
             encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
             if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-            	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
             }
             client = encClientBuilder.build();
         }
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
index 08ba1b7..4ae3f44 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
@@ -89,7 +89,7 @@ public class S3ClientStandardImpl implements S3Client {
                 }
                 clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-                	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                    clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
                 }
                 client = clientBuilder.build();
             } else {
@@ -98,7 +98,7 @@ public class S3ClientStandardImpl implements S3Client {
                 }
                 encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-                	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                    encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
                 }
                 client = encClientBuilder.build();
             }
@@ -118,7 +118,7 @@ public class S3ClientStandardImpl implements S3Client {
                 }
                 clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-                	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                    clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
                 }
                 client = clientBuilder.build();
             } else {
@@ -127,7 +127,7 @@ public class S3ClientStandardImpl implements S3Client {
                 }
                 encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
                 if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
-                	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                    encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
                 }
                 client = encClientBuilder.build();
             }
diff --git a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
index 43aa227..ad11884 100644
--- a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
+++ b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
@@ -240,7 +240,7 @@ public class S3ComponentConfigurationTest extends CamelTestSupport {
         S3Component component = context.getComponent("aws-s3", S3Component.class);
         component.createEndpoint("aws-s3://MyTopic?amazonS3Client=#amazonS3Client");
     }
-    
+
     @Test
     public void createEndpointWithEndpointConfiguration() throws Exception {
 
diff --git a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/integration/S3ObjectRangeOperationIntegrationTest.java b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/integration/S3ObjectRangeOperationIntegrationTest.java
index dfebc8c..039dd55 100644
--- a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/integration/S3ObjectRangeOperationIntegrationTest.java
+++ b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/integration/S3ObjectRangeOperationIntegrationTest.java
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
 
 @Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
 public class S3ObjectRangeOperationIntegrationTest extends CamelTestSupport {
-    
+
     private static final Logger LOG = LoggerFactory.getLogger(S3ObjectRangeOperationIntegrationTest.class);
 
     @BindToRegistry("amazonS3Client")


[camel] 01/03: CAMEL-14658 - Provide a simpler way to connect to a local s3 instance

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 6d09a35ffbda9c7e0d3279b50cfe21974a3d6dc3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 20 15:35:39 2020 +0100

    CAMEL-14658 - Provide a simpler way to connect to a local s3 instance
---
 .../component/aws/s3/S3ComponentConfigurer.java    |  2 +
 .../component/aws/s3/S3EndpointConfigurer.java     |  2 +
 .../org/apache/camel/component/aws/s3/aws-s3.json  |  2 +
 .../src/main/docs/aws-s3-component.adoc            |  6 +-
 .../camel/component/aws/s3/S3Configuration.java    | 16 ++++-
 .../s3/client/impl/S3ClientIAMOptimizedImpl.java   |  6 ++
 .../aws/s3/client/impl/S3ClientStandardImpl.java   | 12 ++++
 .../dsl/AwsS3ComponentBuilderFactory.java          | 14 ++++
 .../endpoint/dsl/S3EndpointBuilderFactory.java     | 78 ++++++++++++++++++++++
 9 files changed, 135 insertions(+), 3 deletions(-)

diff --git a/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3ComponentConfigurer.java b/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3ComponentConfigurer.java
index f47db36..85451a2 100644
--- a/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3ComponentConfigurer.java
+++ b/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3ComponentConfigurer.java
@@ -50,6 +50,8 @@ public class S3ComponentConfigurer extends PropertyConfigurerSupport implements
         case "dualstackEnabled": getOrCreateConfiguration(target).setDualstackEnabled(property(camelContext, boolean.class, value)); return true;
         case "encryptionmaterials":
         case "encryptionMaterials": getOrCreateConfiguration(target).setEncryptionMaterials(property(camelContext, com.amazonaws.services.s3.model.EncryptionMaterials.class, value)); return true;
+        case "endpointconfiguration":
+        case "endpointConfiguration": getOrCreateConfiguration(target).setEndpointConfiguration(property(camelContext, com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration.class, value)); return true;
         case "filename":
         case "fileName": getOrCreateConfiguration(target).setFileName(property(camelContext, java.lang.String.class, value)); return true;
         case "forceglobalbucketaccessenabled":
diff --git a/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3EndpointConfigurer.java b/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3EndpointConfigurer.java
index 18ea361..b0a4309 100644
--- a/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3EndpointConfigurer.java
+++ b/components/camel-aws-s3/src/generated/java/org/apache/camel/component/aws/s3/S3EndpointConfigurer.java
@@ -49,6 +49,8 @@ public class S3EndpointConfigurer extends PropertyConfigurerSupport implements G
         case "dualstackEnabled": target.getConfiguration().setDualstackEnabled(property(camelContext, boolean.class, value)); return true;
         case "encryptionmaterials":
         case "encryptionMaterials": target.getConfiguration().setEncryptionMaterials(property(camelContext, com.amazonaws.services.s3.model.EncryptionMaterials.class, value)); return true;
+        case "endpointconfiguration":
+        case "endpointConfiguration": target.getConfiguration().setEndpointConfiguration(property(camelContext, com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration.class, value)); return true;
         case "exceptionhandler":
         case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
         case "exchangepattern":
diff --git a/components/camel-aws-s3/src/generated/resources/org/apache/camel/component/aws/s3/aws-s3.json b/components/camel-aws-s3/src/generated/resources/org/apache/camel/component/aws/s3/aws-s3.json
index 464c78c..1d1f0be 100644
--- a/components/camel-aws-s3/src/generated/resources/org/apache/camel/component/aws/s3/aws-s3.json
+++ b/components/camel-aws-s3/src/generated/resources/org/apache/camel/component/aws/s3/aws-s3.json
@@ -22,6 +22,7 @@
     "amazonS3Client": { "kind": "property", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.services.s3.AmazonS3", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
     "autoCreateBucket": { "kind": "property", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Setting the autocreation of the bucket" },
     "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws.s3.S3Configuration", "deprecated": false, "secret": false, "description": "The component configuration" },
+    "endpointConfiguration": { "kind": "property", "displayName": "Endpoint Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Amazon AWS Endpoint Configuration" },
     "pathStyleAccess": { "kind": "property", "displayName": "Path Style Access", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Whether or not the S3 client should use path style access" },
     "policy": { "kind": "property", "displayName": "Policy", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "The policy for this queue to set in the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method." },
     "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SQS client" },
@@ -61,6 +62,7 @@
     "bucketNameOrArn": { "kind": "path", "displayName": "Bucket Name Or Arn", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "Bucket name or ARN" },
     "amazonS3Client": { "kind": "parameter", "displayName": "Amazon S3 Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.services.s3.AmazonS3", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Reference to a com.amazonaws.services.s3.AmazonS3 in the registry." },
     "autoCreateBucket": { "kind": "parameter", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Setting the autocreation of the bucket" },
+    "endpointConfiguration": { "kind": "parameter", "displayName": "Endpoint Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Amazon AWS Endpoint Configuration" },
     "pathStyleAccess": { "kind": "parameter", "displayName": "Path Style Access", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "Whether or not the S3 client should use path style access" },
     "policy": { "kind": "parameter", "displayName": "Policy", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "The policy for this queue to set in the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method." },
     "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.s3.S3Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SQS client" },
diff --git a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
index 3e2ffa0..10ea7f1 100644
--- a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
@@ -40,7 +40,7 @@ from("aws-s3://helloBucket?accessKey=yourAccessKey&secretKey=yourSecretKey&prefi
 
 
 // component options: START
-The AWS S3 Storage Service component supports 37 options, which are listed below.
+The AWS S3 Storage Service component supports 38 options, which are listed below.
 
 
 
@@ -50,6 +50,7 @@ The AWS S3 Storage Service component supports 37 options, which are listed below
 | *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. |  | AmazonS3
 | *autoCreateBucket* (common) | Setting the autocreation of the bucket | true | boolean
 | *configuration* (common) | The component configuration |  | S3Configuration
+| *endpointConfiguration* (common) | Amazon AWS Endpoint Configuration |  | EndpointConfiguration
 | *pathStyleAccess* (common) | Whether or not the S3 client should use path style access | false | boolean
 | *policy* (common) | The policy for this queue to set in the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method. |  | String
 | *proxyHost* (common) | To define a proxy host when instantiating the SQS client |  | String
@@ -116,7 +117,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (57 parameters):
+=== Query Parameters (58 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -124,6 +125,7 @@ with the following path and query parameters:
 | Name | Description | Default | Type
 | *amazonS3Client* (common) | Reference to a com.amazonaws.services.s3.AmazonS3 in the registry. |  | AmazonS3
 | *autoCreateBucket* (common) | Setting the autocreation of the bucket | true | boolean
+| *endpointConfiguration* (common) | Amazon AWS Endpoint Configuration |  | EndpointConfiguration
 | *pathStyleAccess* (common) | Whether or not the S3 client should use path style access | false | boolean
 | *policy* (common) | The policy for this queue to set in the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method. |  | String
 | *proxyHost* (common) | To define a proxy host when instantiating the SQS client |  | String
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
index 52eb96f..dc9215c 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.aws.s3;
 
 import com.amazonaws.Protocol;
+import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
 import com.amazonaws.services.s3.AmazonS3;
 import com.amazonaws.services.s3.model.EncryptionMaterials;
 import org.apache.camel.RuntimeCamelException;
@@ -34,6 +35,8 @@ public class S3Configuration implements Cloneable {
     private String accessKey;
     @UriParam(label = "security", secret = true)
     private String secretKey;
+    @UriParam
+    private EndpointConfiguration endpointConfiguration;
     @UriParam(label = "consumer")
     private String fileName;
     @UriParam(label = "consumer")
@@ -142,7 +145,18 @@ public class S3Configuration implements Cloneable {
         this.secretKey = secretKey;
     }
 
-    public AmazonS3 getAmazonS3Client() {
+    public EndpointConfiguration getEndpointConfiguration() {
+		return endpointConfiguration;
+	}
+
+    /**
+     * Amazon AWS Endpoint Configuration
+     */
+	public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration) {
+		this.endpointConfiguration = endpointConfiguration;
+	}
+
+	public AmazonS3 getAmazonS3Client() {
         return amazonS3Client;
     }
 
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
index 76dc46b..abb5128 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java
@@ -87,12 +87,18 @@ public class S3ClientIAMOptimizedImpl implements S3Client {
                 clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
             }
             clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+            if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+            	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+            }
             client = clientBuilder.build();
         } else {
             if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
                 encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
             }
             encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+            if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+            	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+            }
             client = encClientBuilder.build();
         }
 
diff --git a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
index 1705058..08ba1b7 100644
--- a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
+++ b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientStandardImpl.java
@@ -88,12 +88,18 @@ public class S3ClientStandardImpl implements S3Client {
                     clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
                 }
                 clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+                if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+                	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                }
                 client = clientBuilder.build();
             } else {
                 if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
                     encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
                 }
                 encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+                if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+                	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                }
                 client = encClientBuilder.build();
             }
         } else {
@@ -111,12 +117,18 @@ public class S3ClientStandardImpl implements S3Client {
                     clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
                 }
                 clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+                if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+                	clientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                }
                 client = clientBuilder.build();
             } else {
                 if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
                     encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
                 }
                 encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess());
+                if (ObjectHelper.isNotEmpty(configuration.getEndpointConfiguration())) {
+                	encClientBuilder.withEndpointConfiguration(configuration.getEndpointConfiguration());
+                }
                 client = encClientBuilder.build();
             }
         }
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsS3ComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsS3ComponentBuilderFactory.java
index d91aab3..59e97c3 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsS3ComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsS3ComponentBuilderFactory.java
@@ -87,6 +87,19 @@ public interface AwsS3ComponentBuilderFactory {
             return this;
         }
         /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option is a:
+         * <code>com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default AwsS3ComponentBuilder endpointConfiguration(
+                com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
          * Whether or not the S3 client should use path style access.
          * 
          * The option is a: <code>boolean</code> type.
@@ -568,6 +581,7 @@ public interface AwsS3ComponentBuilderFactory {
             case "amazonS3Client": getOrCreateConfiguration((S3Component) component).setAmazonS3Client((com.amazonaws.services.s3.AmazonS3) value); return true;
             case "autoCreateBucket": getOrCreateConfiguration((S3Component) component).setAutoCreateBucket((boolean) value); return true;
             case "configuration": ((S3Component) component).setConfiguration((org.apache.camel.component.aws.s3.S3Configuration) value); return true;
+            case "endpointConfiguration": getOrCreateConfiguration((S3Component) component).setEndpointConfiguration((com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration) value); return true;
             case "pathStyleAccess": getOrCreateConfiguration((S3Component) component).setPathStyleAccess((boolean) value); return true;
             case "policy": getOrCreateConfiguration((S3Component) component).setPolicy((java.lang.String) value); return true;
             case "proxyHost": getOrCreateConfiguration((S3Component) component).setProxyHost((java.lang.String) value); return true;
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
index 9a278d9..3035e00 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
@@ -98,6 +98,32 @@ public interface S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option is a:
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointConsumerBuilder endpointConfiguration(
+                Object endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option will be converted to a
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointConsumerBuilder endpointConfiguration(
+                String endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
          * Whether or not the S3 client should use path style access.
          * 
          * The option is a: <code>boolean</code> type.
@@ -1292,6 +1318,32 @@ public interface S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option is a:
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointProducerBuilder endpointConfiguration(
+                Object endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option will be converted to a
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointProducerBuilder endpointConfiguration(
+                String endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
          * Whether or not the S3 client should use path style access.
          * 
          * The option is a: <code>boolean</code> type.
@@ -1982,6 +2034,32 @@ public interface S3EndpointBuilderFactory {
             return this;
         }
         /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option is a:
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointBuilder endpointConfiguration(
+                Object endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
+         * Amazon AWS Endpoint Configuration.
+         * 
+         * The option will be converted to a
+         * <code>com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration</code> type.
+         * 
+         * Group: common
+         */
+        default S3EndpointBuilder endpointConfiguration(
+                String endpointConfiguration) {
+            doSetProperty("endpointConfiguration", endpointConfiguration);
+            return this;
+        }
+        /**
          * Whether or not the S3 client should use path style access.
          * 
          * The option is a: <code>boolean</code> type.


[camel] 02/03: CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, added a test

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 71cde90f107f892119711b79a2175b044012324b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 20 15:42:29 2020 +0100

    CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, added a test
---
 .../component/aws/s3/S3ComponentConfigurationTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
index d1e1259..43aa227 100644
--- a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
+++ b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.aws.s3;
 
+import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
 import com.amazonaws.regions.Regions;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
@@ -239,4 +240,18 @@ public class S3ComponentConfigurationTest extends CamelTestSupport {
         S3Component component = context.getComponent("aws-s3", S3Component.class);
         component.createEndpoint("aws-s3://MyTopic?amazonS3Client=#amazonS3Client");
     }
+    
+    @Test
+    public void createEndpointWithEndpointConfiguration() throws Exception {
+
+        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("localhost", Regions.US_EAST_1.toString());
+        context.getRegistry().bind("endpointConfiguration", endpointConfiguration);
+        S3Component component = context.getComponent("aws-s3", S3Component.class);
+        S3Endpoint endpoint = (S3Endpoint)component.createEndpoint("aws-s3://MyBucket?endpointConfiguration=#endpointConfiguration&accessKey=xxx&secretKey=yyy&region=US_WEST_1");
+
+        assertEquals("MyBucket", endpoint.getConfiguration().getBucketName());
+        assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
+        assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
+        assertNotNull(endpoint.getConfiguration().getEndpointConfiguration());
+    }
 }