Search in sources :

Example 1 with BasicAWSCredentials

use of com.amazonaws.auth.BasicAWSCredentials in project camel by apache.

the class DdbEndpoint method createDdbClient.

AmazonDynamoDB createDdbClient() {
    AmazonDynamoDB client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
        clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost(configuration.getProxyHost());
        clientConfiguration.setProxyPort(configuration.getProxyPort());
        isClientConfigFound = true;
    }
    if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        if (isClientConfigFound) {
            client = new AmazonDynamoDBClient(credentials, clientConfiguration);
        } else {
            client = new AmazonDynamoDBClient(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonDynamoDBClient();
        } else {
            client = new AmazonDynamoDBClient(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonDynamoDBClient(com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient) AmazonDynamoDB(com.amazonaws.services.dynamodbv2.AmazonDynamoDB) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 2 with BasicAWSCredentials

use of com.amazonaws.auth.BasicAWSCredentials in project camel by apache.

the class CwEndpoint method createCloudWatchClient.

AmazonCloudWatch createCloudWatchClient() {
    AmazonCloudWatch client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
        clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost(configuration.getProxyHost());
        clientConfiguration.setProxyPort(configuration.getProxyPort());
        isClientConfigFound = true;
    }
    if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        if (isClientConfigFound) {
            client = new AmazonCloudWatchClient(credentials, clientConfiguration);
        } else {
            client = new AmazonCloudWatchClient(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonCloudWatchClient();
        } else {
            client = new AmazonCloudWatchClient(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonCloudWatchClient(com.amazonaws.services.cloudwatch.AmazonCloudWatchClient) AmazonCloudWatch(com.amazonaws.services.cloudwatch.AmazonCloudWatch) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 3 with BasicAWSCredentials

use of com.amazonaws.auth.BasicAWSCredentials in project camel by apache.

the class EC2Endpoint method createEc2Client.

AmazonEC2Client createEc2Client() {
    AmazonEC2Client client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
        clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost(configuration.getProxyHost());
        clientConfiguration.setProxyPort(configuration.getProxyPort());
        isClientConfigFound = true;
    }
    if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        if (isClientConfigFound) {
            client = new AmazonEC2Client(credentials, clientConfiguration);
        } else {
            client = new AmazonEC2Client(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonEC2Client();
        } else {
            client = new AmazonEC2Client(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonEC2Client(com.amazonaws.services.ec2.AmazonEC2Client) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 4 with BasicAWSCredentials

use of com.amazonaws.auth.BasicAWSCredentials in project camel by apache.

the class SqsEndpoint method createClient.

/**
     * Provide the possibility to override this method for an mock implementation
     * @return AmazonSQSClient
     */
AmazonSQS createClient() {
    AmazonSQS client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
        clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost(configuration.getProxyHost());
        clientConfiguration.setProxyPort(configuration.getProxyPort());
        isClientConfigFound = true;
    }
    if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        if (isClientConfigFound) {
            client = new AmazonSQSClient(credentials, clientConfiguration);
        } else {
            client = new AmazonSQSClient(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonSQSClient();
        } else {
            client = new AmazonSQSClient(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonSQS(com.amazonaws.services.sqs.AmazonSQS) AmazonSQSClient(com.amazonaws.services.sqs.AmazonSQSClient) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 5 with BasicAWSCredentials

use of com.amazonaws.auth.BasicAWSCredentials in project camel by apache.

the class SdbEndpoint method createSdbClient.

AmazonSimpleDB createSdbClient() {
    AmazonSimpleDB client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
        clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost(configuration.getProxyHost());
        clientConfiguration.setProxyPort(configuration.getProxyPort());
        isClientConfigFound = true;
    }
    if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        if (isClientConfigFound) {
            client = new AmazonSimpleDBClient(credentials, clientConfiguration);
        } else {
            client = new AmazonSimpleDBClient(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonSimpleDBClient();
        } else {
            client = new AmazonSimpleDBClient(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonSimpleDBClient(com.amazonaws.services.simpledb.AmazonSimpleDBClient) AmazonSimpleDB(com.amazonaws.services.simpledb.AmazonSimpleDB) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Aggregations

BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)42 AWSCredentials (com.amazonaws.auth.AWSCredentials)25 ClientConfiguration (com.amazonaws.ClientConfiguration)16 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)10 AmazonClientException (com.amazonaws.AmazonClientException)5 InstanceProfileCredentialsProvider (com.amazonaws.auth.InstanceProfileCredentialsProvider)4 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)3 PropertiesCredentials (com.amazonaws.auth.PropertiesCredentials)3 AmazonDynamoDBClient (com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient)3 AmazonEC2Client (com.amazonaws.services.ec2.AmazonEC2Client)3 AmazonS3 (com.amazonaws.services.s3.AmazonS3)3 AmazonSimpleDBClient (com.amazonaws.services.simpledb.AmazonSimpleDBClient)3 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)2 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)2 StaticCredentialsProvider (com.amazonaws.internal.StaticCredentialsProvider)2 Region (com.amazonaws.regions.Region)2 AmazonCloudWatchClient (com.amazonaws.services.cloudwatch.AmazonCloudWatchClient)2 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)2 AmazonGlacierClient (com.amazonaws.services.glacier.AmazonGlacierClient)2 AmazonKinesisClient (com.amazonaws.services.kinesis.AmazonKinesisClient)2