Search in sources :

Example 11 with AWSSessionCredentials

use of com.amazonaws.auth.AWSSessionCredentials in project druid by druid-io.

the class FileSessionCredentialsProvider method refresh.

@Override
public void refresh() {
    try {
        Properties props = new Properties();
        try (InputStream is = Files.newInputStream(Paths.get(sessionCredentialsFile))) {
            props.load(is);
        }
        String sessionToken = props.getProperty("sessionToken");
        String accessKey = props.getProperty("accessKey");
        String secretKey = props.getProperty("secretKey");
        awsSessionCredentials = new Credentials(sessionToken, accessKey, secretKey);
    } catch (IOException e) {
        throw new RuntimeException("cannot refresh AWS credentials", e);
    }
}
Also used : InputStream(java.io.InputStream) IOException(java.io.IOException) Properties(java.util.Properties) AWSSessionCredentials(com.amazonaws.auth.AWSSessionCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials)

Aggregations

AWSSessionCredentials (com.amazonaws.auth.AWSSessionCredentials)11 AWSCredentials (com.amazonaws.auth.AWSCredentials)5 File (java.io.File)4 Test (org.junit.Test)4 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)3 IOException (java.io.IOException)3 SessionCredentials (org.jclouds.aws.domain.SessionCredentials)3 AmazonS3ClientBuilder (com.amazonaws.services.s3.AmazonS3ClientBuilder)2 BufferedWriter (java.io.BufferedWriter)2 PrintWriter (java.io.PrintWriter)2 Credentials (org.jclouds.domain.Credentials)2 Supplier (shaded.com.google.common.base.Supplier)2 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)1 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)1 AmazonEC2Client (com.amazonaws.services.ec2.AmazonEC2Client)1 DescribeReservedInstancesResult (com.amazonaws.services.ec2.model.DescribeReservedInstancesResult)1 ReservedInstances (com.amazonaws.services.ec2.model.ReservedInstances)1 Credentials (com.amazonaws.services.securitytoken.model.Credentials)1 Module (com.google.inject.Module)1 Account (com.netflix.ice.tag.Account)1