Example usage for com.amazonaws.auth SystemPropertiesCredentialsProvider SystemPropertiesCredentialsProvider

List of usage examples for com.amazonaws.auth SystemPropertiesCredentialsProvider SystemPropertiesCredentialsProvider

Introduction

In this page you can find the example usage for com.amazonaws.auth SystemPropertiesCredentialsProvider SystemPropertiesCredentialsProvider.

Prototype

SystemPropertiesCredentialsProvider

Source Link

Usage

From source file:CustomCredentialsProviderChain.java

License:Open Source License

public CustomCredentialsProviderChain() {
    super(new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(),
            new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider());
}

From source file:com.amazon.kinesis.streaming.agent.AgentAWSCredentialsProviderChain.java

License:Open Source License

public AgentAWSCredentialsProviderChain(AgentConfiguration config) {
    super(new AgentAWSCredentialsProvider(config), new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(), new ContainerCredentialsProvider(),
            new ProfileCredentialsProvider(), new InstanceProfileCredentialsProvider());
}

From source file:com.amediamanager.config.S3ConfigurationProvider.java

License:Apache License

@Override
public void loadProperties() {
    this.properties = null;

    // Load properties if there is a bucket and key
    if (bucket != null && key != null) {
        AWSCredentialsProvider creds = new AWSCredentialsProviderChain(new InstanceProfileCredentialsProvider(),
                new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider());
        AmazonS3 s3Client = new AmazonS3Client(creds);
        try {/* www .  j a  v  a 2 s .  c  o m*/
            S3Object object = s3Client.getObject(this.bucket, this.key);
            if (object != null) {
                this.properties = new Properties();
                try {
                    this.properties.load(object.getObjectContent());
                } catch (IOException e) {
                    this.properties = null;
                    LOG.warn("Found configuration file in S3 but failed to load properties (s3://{}/{})",
                            new Object[] { this.bucket, this.key, e });
                } finally {
                    try {
                        object.close();
                    } catch (IOException e) {
                        // Don't care
                    }
                }
            }
        } catch (AmazonS3Exception ase) {
            LOG.error("Error loading config from s3://{}/{}", new Object[] { this.bucket, this.key, ase });
        }
    }
}

From source file:com.amediamanager.springconfig.ServerConfig.java

License:Apache License

@Bean
@Scope(WebApplicationContext.SCOPE_APPLICATION)
public AWSCredentialsProvider credentials() {
    return new AWSCredentialsProviderChain(new InstanceProfileCredentialsProvider(),
            new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider());
}

From source file:com.aws.credentials.AWSCredentialsProvider.java

License:Open Source License

public AWSCredentialsProvider() {

    super(new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider());
}

From source file:com.dssmp.agent.AgentAWSCredentialsProviderChain.java

License:Apache License

public AgentAWSCredentialsProviderChain(AgentConfiguration config) {
    super(new AgentAWSCredentialsProvider(config), new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(), new ProfileCredentialsProvider(),
            new InstanceProfileCredentialsProvider());
}

From source file:com.github.scizeron.logback.appender.SqsAppender.java

License:Apache License

/**
 * //w ww . jav a2  s .c om
 * @return
 */
private AWSCredentialsProvider getCredentials() {
    return new AWSCredentialsProviderChain(new StaticCredentialsProvider(new AppenderCredentials()),
            new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider(),
            new ProfileCredentialsProvider(), new InstanceProfileCredentialsProvider());
}

From source file:com.gu.logback.appender.kinesis.helpers.CustomCredentialsProviderChain.java

License:Open Source License

public CustomCredentialsProviderChain() {
    super(new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider());
}

From source file:com.nike.cerberus.module.CerberusModule.java

License:Apache License

private static <M extends AmazonWebServiceClient> M createAmazonClientInstance(Class<M> clientClass,
        Region region) {/* www. ja  va  2s.  c  o m*/
    String cerberusRoleToAssume = System.getenv(CERBERUS_ASSUME_ROLE_ARN) != null
            ? System.getenv(CERBERUS_ASSUME_ROLE_ARN)
            : "";
    String cerberusRoleToAssumeExternalId = System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID) != null
            ? System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID)
            : "";

    STSAssumeRoleSessionCredentialsProvider sTSAssumeRoleSessionCredentialsProvider = new STSAssumeRoleSessionCredentialsProvider.Builder(
            cerberusRoleToAssume, UUID.randomUUID().toString()).withExternalId(cerberusRoleToAssumeExternalId)
                    .build();

    AWSCredentialsProviderChain chain = new AWSCredentialsProviderChain(
            new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(),
            new ProfileCredentialsProvider(), sTSAssumeRoleSessionCredentialsProvider,
            new InstanceProfileCredentialsProvider());
    return region.createClient(clientClass, chain, new ClientConfiguration());
}

From source file:com.noctarius.hazelcast.aws.HazelcastAwsDiscoveryStrategy.java

License:Open Source License

private AWSCredentialsProvider buildCredentialsProvider() {
    String accessKey = getOrNull(AwsProperties.ACCESS_KEY);
    String secretKey = getOrNull(AwsProperties.SECRET_KEY);

    if (accessKey == null && secretKey == null) {
        return new AWSCredentialsProviderChain(new EnvironmentVariableCredentialsProvider(),
                new SystemPropertiesCredentialsProvider(), new InstanceProfileCredentialsProvider());
    }/*ww w.ja  v  a2s  .  co m*/

    return new AWSCredentialsProviderChain(
            new StaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)));
}