From b6529f1176563fc5d72e31d567f3596884d91f5e Mon Sep 17 00:00:00 2001 From: "igor.petrenko" Date: Wed, 27 Nov 2024 14:20:30 +0200 Subject: [PATCH] OAP-224 oap-storage-cloud: jclouds -> aws sdk --- .../oap/storage/cloud/awss3/FileSystemCloudApiS3.java | 8 +++++--- .../src/main/java/oap/storage/cloud/S3MockFixture.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/oap-storage/oap-storage-cloud-aws-s3/src/main/java/oap/storage/cloud/awss3/FileSystemCloudApiS3.java b/oap-storage/oap-storage-cloud-aws-s3/src/main/java/oap/storage/cloud/awss3/FileSystemCloudApiS3.java index 53b4bb4f4..692c1b510 100644 --- a/oap-storage/oap-storage-cloud-aws-s3/src/main/java/oap/storage/cloud/awss3/FileSystemCloudApiS3.java +++ b/oap-storage/oap-storage-cloud-aws-s3/src/main/java/oap/storage/cloud/awss3/FileSystemCloudApiS3.java @@ -89,12 +89,9 @@ @Slf4j public class FileSystemCloudApiS3 implements FileSystemCloudApi { - private final FileSystemConfiguration fileSystemConfiguration; private final S3AsyncClient s3Client; public FileSystemCloudApiS3( FileSystemConfiguration fileSystemConfiguration, String bucketName ) { - this.fileSystemConfiguration = fileSystemConfiguration; - S3AsyncClientBuilder builder = S3AsyncClient.builder(); Object endpoint = fileSystemConfiguration.get( "s3", bucketName, "jclouds.endpoint" ); @@ -111,6 +108,11 @@ public FileSystemCloudApiS3( FileSystemConfiguration fileSystemConfiguration, St builder = builder.credentialsProvider( StaticCredentialsProvider.create( AwsBasicCredentials.create( accessKey.toString(), accessSecret.toString() ) ) ); } + Object region = fileSystemConfiguration.get( "s3", bucketName, "jclouds.region" ); + if( region != null ) { + builder = builder.region( Region.of( region.toString() ) ); + } + builder = builder.multipartEnabled( true ); s3Client = builder.build(); diff --git a/oap-storage/oap-storage-cloud-test/src/main/java/oap/storage/cloud/S3MockFixture.java b/oap-storage/oap-storage-cloud-test/src/main/java/oap/storage/cloud/S3MockFixture.java index dada31de4..186d0a8b0 100644 --- a/oap-storage/oap-storage-cloud-test/src/main/java/oap/storage/cloud/S3MockFixture.java +++ b/oap-storage/oap-storage-cloud-test/src/main/java/oap/storage/cloud/S3MockFixture.java @@ -186,6 +186,7 @@ public FileSystemConfiguration getFileSystemConfiguration( String container ) { return new FileSystemConfiguration( Map.of( "fs.s3.clouds.identity", "access_key", "fs.s3.clouds.credential", "access_secret", + "fs.s3.clouds.region", Region.AWS_GLOBAL.id(), "fs.s3.clouds.s3.virtual-host-buckets", false, "fs.s3.clouds.endpoint", "http://localhost:" + getHttpPort(), "fs.s3.clouds.headers", "DEBUG",