Search in sources :

Example 6 with AwsCredentials

use of software.amazon.awssdk.auth.credentials.AwsCredentials in project ddf by codice.

the class MetacardS3StorageRoute method getS3Client.

private S3Client getS3Client() {
    Region region = Region.of(getS3Region());
    if (StringUtils.isNotBlank(s3AccessKey)) {
        AwsCredentials awsCredentials = AwsBasicCredentials.create(s3AccessKey, s3SecretKey);
        AwsCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(awsCredentials);
        return S3Client.builder().credentialsProvider(credentialsProvider).endpointOverride(URI.create(s3Endpoint)).region(region).build();
    }
    return S3Client.builder().endpointOverride(URI.create(s3Endpoint)).region(region).build();
}
Also used : AwsCredentials(software.amazon.awssdk.auth.credentials.AwsCredentials) AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region)

Aggregations

AwsCredentials (software.amazon.awssdk.auth.credentials.AwsCredentials)6 Test (org.junit.Test)4 AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)4 Properties (java.util.Properties)3 ProfileCredentialsProvider (software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider)2 StaticCredentialsProvider (software.amazon.awssdk.auth.credentials.StaticCredentialsProvider)1 Region (software.amazon.awssdk.regions.Region)1