Example usage for com.amazonaws.auth AWSStaticCredentialsProvider AWSStaticCredentialsProvider

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

Introduction

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

Prototype

public AWSStaticCredentialsProvider(AWSCredentials credentials) 

Source Link

Usage

From source file:org.thingsboard.rule.engine.aws.sqs.TbSqsNode.java

License:Apache License

@Override
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
    this.config = TbNodeUtils.convert(configuration, TbSqsNodeConfiguration.class);
    AWSCredentials awsCredentials = new BasicAWSCredentials(this.config.getAccessKeyId(),
            this.config.getSecretAccessKey());
    AWSStaticCredentialsProvider credProvider = new AWSStaticCredentialsProvider(awsCredentials);
    try {//from  w w w .j a  v  a2  s.  c o m
        this.sqsClient = AmazonSQSClientBuilder.standard().withCredentials(credProvider)
                .withRegion(this.config.getRegion()).build();
    } catch (Exception e) {
        throw new TbNodeException(e);
    }
}

From source file:org.thingsboard.server.extensions.sns.plugin.SnsPlugin.java

License:Apache License

private void init() {
    AWSCredentials awsCredentials = new BasicAWSCredentials(configuration.getAccessKeyId(),
            configuration.getSecretAccessKey());
    AWSStaticCredentialsProvider credProvider = new AWSStaticCredentialsProvider(awsCredentials);
    AmazonSNS sns = AmazonSNSClient.builder().withCredentials(credProvider)
            .withRegion(configuration.getRegion()).build();
    this.snsMessageHandler = new SnsMessageHandler(sns);

}

From source file:org.thingsboard.server.extensions.sqs.plugin.SqsPlugin.java

License:Apache License

private void init() {
    AWSCredentials awsCredentials = new BasicAWSCredentials(configuration.getAccessKeyId(),
            configuration.getSecretAccessKey());
    AmazonSQS sqs = AmazonSQSClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
            .withRegion(Regions.fromName(configuration.getRegion())).build();
    this.sqsMessageHandler = new SqsMessageHandler(sqs);

}

From source file:org.thingsboard.server.extensions.sqs.SqsDemoClient.java

License:Apache License

public static void main(String[] args) {
    log.info("Starting SQS Demo Clinent...");
    AWSCredentials awsCredentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
    AmazonSQS sqs = AmazonSQSClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
            .withRegion(Regions.fromName(REGION)).build();
    SqsDemoClient client = new SqsDemoClient();
    client.pollMessages(sqs);/*  w w w  . j a  v  a2 s. c  om*/
}

From source file:zipkin.autoconfigure.collector.kinesis.ZipkinKinesisCredentialsAutoConfiguration.java

License:Apache License

private static AWSCredentialsProvider getDefaultCredentialsProvider(
        ZipkinKinesisCollectorProperties properties) {
    AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain();

    // Create credentials provider from ID and secret if given.
    if (!isNullOrEmpty(properties.awsAccessKeyId) && !isNullOrEmpty(properties.awsSecretAccessKey)) {
        provider = new AWSStaticCredentialsProvider(
                new BasicAWSCredentials(properties.awsAccessKeyId, properties.awsSecretAccessKey));
    }//from w  ww .j  a va 2  s.  com

    return provider;
}

From source file:zipkin.autoconfigure.collector.sqs.ZipkinSQSCredentialsAutoConfiguration.java

License:Apache License

private static AWSCredentialsProvider getDefaultCredentialsProvider(ZipkinSQSCollectorProperties properties) {
    AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain();

    // Create credentials provider from ID and secret if given.
    if (!isNullOrEmpty(properties.awsAccessKeyId) && !isNullOrEmpty(properties.awsSecretAccessKey)) {
        provider = new AWSStaticCredentialsProvider(
                new BasicAWSCredentials(properties.awsAccessKeyId, properties.awsSecretAccessKey));
    }/* ww  w .  j  a  v  a  2s. c  o m*/

    return provider;
}