camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: Use the AWS S3 client builder and AmazonS3 client instead of deprecated stuff in camel-cdi S3 example
Date Tue, 19 Dec 2017 09:35:00 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 50b88e3  Use the AWS S3 client builder and AmazonS3 client instead of deprecated
stuff in camel-cdi S3 example
50b88e3 is described below

commit 50b88e39db85d5b8368298a6389b89e110049355
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Tue Dec 19 10:32:23 2017 +0100

    Use the AWS S3 client builder and AmazonS3 client instead of deprecated stuff in camel-cdi
S3 example
---
 .../org/apache/camel/example/cdi/aws/s3/Application.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/examples/camel-example-cdi-aws-s3/src/main/java/org/apache/camel/example/cdi/aws/s3/Application.java
b/examples/camel-example-cdi-aws-s3/src/main/java/org/apache/camel/example/cdi/aws/s3/Application.java
index e9dfc04..d68674e 100644
--- a/examples/camel-example-cdi-aws-s3/src/main/java/org/apache/camel/example/cdi/aws/s3/Application.java
+++ b/examples/camel-example-cdi-aws-s3/src/main/java/org/apache/camel/example/cdi/aws/s3/Application.java
@@ -21,8 +21,13 @@ import java.io.File;
 import javax.enterprise.inject.Produces;
 import javax.inject.Named;
 
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.AWSCredentialsProvider;
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.regions.Regions;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
 
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.builder.RouteBuilder;
@@ -46,10 +51,11 @@ public class Application {
         
         @Produces
         @Named("amazonS3Client")
-        AmazonS3Client amazonS3Client() {
-            BasicAWSCredentials basicAwsCredentials = new BasicAWSCredentials("XXXXXXXX",
"XXXXXXXXX");
-            AmazonS3Client client = new AmazonS3Client(basicAwsCredentials);
-            return client;
+        AmazonS3 amazonS3Client() {
+            AWSCredentials credentials = new BasicAWSCredentials("XXXXX", "XXXXX");
+            AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
+            AmazonS3ClientBuilder clientBuilder = AmazonS3ClientBuilder.standard().withRegion(Regions.US_WEST_1).withCredentials(credentialsProvider);
+            return clientBuilder.build();
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Mime
View raw message