Search in sources :

Example 1 with DefaultChainCredentialsProvider

use of software.amazon.awssdk.crt.auth.credentials.DefaultChainCredentialsProvider in project aws-crt-java by awslabs.

the class S3ClientTest method createS3Client.

private S3Client createS3Client(S3ClientOptions options, EventLoopGroup elg) {
    try (HostResolver hostResolver = new HostResolver(elg);
        ClientBootstrap clientBootstrap = new ClientBootstrap(elg, hostResolver)) {
        Assert.assertNotNull(clientBootstrap);
        try (DefaultChainCredentialsProvider credentialsProvider = new DefaultChainCredentialsProvider.DefaultChainCredentialsProviderBuilder().withClientBootstrap(clientBootstrap).build()) {
            Assert.assertNotNull(credentialsProvider);
            options.withClientBootstrap(clientBootstrap).withCredentialsProvider(credentialsProvider);
            return new S3Client(options);
        }
    } catch (NullPointerException ex) {
        ex.printStackTrace();
        System.err.println(ex.getMessage());
        return null;
    }
}
Also used : DefaultChainCredentialsProvider(software.amazon.awssdk.crt.auth.credentials.DefaultChainCredentialsProvider)

Aggregations

DefaultChainCredentialsProvider (software.amazon.awssdk.crt.auth.credentials.DefaultChainCredentialsProvider)1