Example usage for org.apache.hadoop.fs.s3a S3AUtils createAWSCredentialProvider

List of usage examples for org.apache.hadoop.fs.s3a S3AUtils createAWSCredentialProvider

Introduction

In this page you can find the example usage for org.apache.hadoop.fs.s3a S3AUtils createAWSCredentialProvider.

Prototype

public static AWSCredentialsProvider createAWSCredentialProvider(Configuration conf, Class<?> credClass,
        URI uri) throws IOException 

Source Link

Document

Create an AWS credential provider from its class by using reflection.

Usage

From source file:com.thinkbiganalytics.kylo.catalog.aws.S3FileSystemProvider.java

License:Apache License

/**
 * Gets a custom credentials provider from the specified Hadoop configuration.
 *//*w  ww  . ja va2s. c om*/
@Nonnull
@VisibleForTesting
Optional<AWSCredentialsProvider> getCustomCredentialsProvider(@Nonnull final URI uri,
        @Nonnull final Configuration conf) {
    return Optional.ofNullable(conf.getClass("fs.s3.customAWSCredentialsProvider", null)).map(providerClass -> {
        try {
            return S3AUtils.createAWSCredentialProvider(conf, providerClass, uri);
        } catch (final IOException e) {
            throw new IllegalArgumentException("Unable to create S3 client: " + e, e);
        }
    });
}