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:37 UTC
[camel] 01/03: CAMEL-14658 - Provide a simpler way to connect to a
local s3 instance
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.