Skip to content

Commit

Permalink
OAP-224 oap-storage-cloud: jclouds -> aws sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
galaxina committed Nov 27, 2024
1 parent ec72ba9 commit b6529f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b6529f1

Please sign in to comment.