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 2018/01/29 10:45:38 UTC
[camel] 05/05: CAMEL-12205 - Camel-AWS S3: Add parameters to
specify S3ClientOptions - ForceGlobalBucketAccess option
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 838a1bc85265a2b89e21a6bc05077fc19f9247eb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jan 29 11:44:40 2018 +0100
CAMEL-12205 - Camel-AWS S3: Add parameters to specify S3ClientOptions - ForceGlobalBucketAccess option
---
components/camel-aws/src/main/docs/aws-s3-component.adoc | 3 ++-
.../org/apache/camel/component/aws/s3/S3Configuration.java | 13 +++++++++++++
.../java/org/apache/camel/component/aws/s3/S3Endpoint.java | 4 ++++
.../component/aws/s3/S3ComponentConfigurationTest.java | 12 ++++++++++++
.../aws/s3/springboot/S3ComponentConfiguration.java | 13 +++++++++++++
5 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/components/camel-aws/src/main/docs/aws-s3-component.adoc b/components/camel-aws/src/main/docs/aws-s3-component.adoc
index 0ab33ca..c55ddaa 100644
--- a/components/camel-aws/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-s3-component.adoc
@@ -77,7 +77,7 @@ with the following path and query parameters:
| *bucketNameOrArn* | *Required* Bucket name or ARN | | String
|===
-==== Query Parameters (49 parameters):
+==== Query Parameters (50 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
@@ -115,6 +115,7 @@ with the following path and query parameters:
| *accelerateModeEnabled* ( advanced) | Define if Accelerate Mode enabled is true or false | false | boolean
| *chunkedEncodingDisabled* ( advanced) | Define if disabled Chunked Encoding is true or false | false | boolean
| *dualstackEnabled* ( advanced) | Define if Dualstack enabled is true or false | false | boolean
+| *forceGlobalBucketAccess Enabled* ( advanced) | Define if Force Global Bucket Access enabled is true or false | false | boolean
| *payloadSigningEnabled* ( advanced) | Define if Payload Signing enabled is true or false | false | boolean
| *backoffErrorThreshold* (scheduler) | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | | int
| *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | | int
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
index d0fd8f2..f580633 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
@@ -80,6 +80,8 @@ public class S3Configuration implements Cloneable {
private boolean dualstackEnabled;
@UriParam(label = "common, advanced", defaultValue = "false")
private boolean payloadSigningEnabled;
+ @UriParam(label = "common, advanced", defaultValue = "false")
+ private boolean forceGlobalBucketAccessEnabled;
@UriParam(label = "producer,advanced", defaultValue = "false")
private boolean useAwsKMS;
@UriParam(label = "producer,advanced")
@@ -434,6 +436,17 @@ public class S3Configuration implements Cloneable {
this.payloadSigningEnabled = payloadSigningEnabled;
}
+ public boolean isForceGlobalBucketAccessEnabled() {
+ return forceGlobalBucketAccessEnabled;
+ }
+
+ /**
+ * Define if Force Global Bucket Access enabled is true or false
+ */
+ public void setForceGlobalBucketAccessEnabled(boolean forceGlobalBucketAccessEnabled) {
+ this.forceGlobalBucketAccessEnabled = forceGlobalBucketAccessEnabled;
+ }
+
boolean hasProxyConfiguration() {
return ObjectHelper.isNotEmpty(getProxyHost()) && ObjectHelper.isNotEmpty(getProxyPort());
}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index 6ce9e33..1d930e0 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -266,6 +266,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
clientBuilder = clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
clientBuilder = clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
clientBuilder = clientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
+ clientBuilder = clientBuilder.withForceGlobalBucketAccessEnabled(configuration.isForceGlobalBucketAccessEnabled());
client = clientBuilder.build();
} else {
if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
@@ -276,6 +277,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
encClientBuilder = encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
encClientBuilder = encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
encClientBuilder = encClientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
+ encClientBuilder = encClientBuilder.withForceGlobalBucketAccessEnabled(configuration.isForceGlobalBucketAccessEnabled());
client = encClientBuilder.build();
}
} else {
@@ -296,6 +298,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
clientBuilder = clientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
clientBuilder = clientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
clientBuilder = clientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
+ clientBuilder = clientBuilder.withForceGlobalBucketAccessEnabled(configuration.isForceGlobalBucketAccessEnabled());
client = clientBuilder.build();
} else {
@@ -307,6 +310,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
encClientBuilder = encClientBuilder.withAccelerateModeEnabled(configuration.isAccelerateModeEnabled());
encClientBuilder = encClientBuilder.withDualstackEnabled(configuration.isDualstackEnabled());
encClientBuilder = encClientBuilder.withPayloadSigningEnabled(configuration.isPayloadSigningEnabled());
+ encClientBuilder = encClientBuilder.withForceGlobalBucketAccessEnabled(configuration.isForceGlobalBucketAccessEnabled());
client = encClientBuilder.build();
}
}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
index 754834d..2e1faf0 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
@@ -220,6 +220,18 @@ public class S3ComponentConfigurationTest extends CamelTestSupport {
}
@Test
+ public void createEndpointWithForceGlobalBucketAccess() throws Exception {
+
+ S3Component component = new S3Component(context);
+ S3Endpoint endpoint = (S3Endpoint) component.createEndpoint("aws-s3://MyBucket?forceGlobalBucketAccessEnabled=true&accessKey=xxx&secretKey=yyy®ion=US_WEST_1");
+
+ assertEquals("MyBucket", endpoint.getConfiguration().getBucketName());
+ assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
+ assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
+ assertTrue(endpoint.getConfiguration().isForceGlobalBucketAccessEnabled());
+ }
+
+ @Test
public void createEndpointWithoutSecretKeyAndAccessKeyConfiguration() throws Exception {
AmazonS3ClientMock mock = new AmazonS3ClientMock();
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
index a800215..8442ce3 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentConfiguration.java
@@ -251,6 +251,10 @@ public class S3ComponentConfiguration
* Define if Payload Signing enabled is true or false
*/
private Boolean payloadSigningEnabled = false;
+ /**
+ * Define if Force Global Bucket Access enabled is true or false
+ */
+ private Boolean forceGlobalBucketAccessEnabled = false;
public Long getPartSize() {
return partSize;
@@ -484,5 +488,14 @@ public class S3ComponentConfiguration
public void setPayloadSigningEnabled(Boolean payloadSigningEnabled) {
this.payloadSigningEnabled = payloadSigningEnabled;
}
+
+ public Boolean getForceGlobalBucketAccessEnabled() {
+ return forceGlobalBucketAccessEnabled;
+ }
+
+ public void setForceGlobalBucketAccessEnabled(
+ Boolean forceGlobalBucketAccessEnabled) {
+ this.forceGlobalBucketAccessEnabled = forceGlobalBucketAccessEnabled;
+ }
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
acosentino@apache.org.