refactored s3connection
This commit is contained in:
parent
15154a3b59
commit
7d9c151b5b
1 changed files with 1 additions and 2 deletions
|
|
@ -41,11 +41,10 @@ public class S3Connection {
|
||||||
private static AmazonS3 getS3Client(String endpoint, int port, String accessKey,
|
private static AmazonS3 getS3Client(String endpoint, int port, String accessKey,
|
||||||
String secretKey) {
|
String secretKey) {
|
||||||
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
|
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
|
||||||
String s3Endpoint = endpoint;
|
|
||||||
String region = Region.getRegion(Regions.DEFAULT_REGION).toString();
|
String region = Region.getRegion(Regions.DEFAULT_REGION).toString();
|
||||||
|
|
||||||
return AmazonS3ClientBuilder.standard()
|
return AmazonS3ClientBuilder.standard()
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(s3Endpoint, region))
|
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region))
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue