Search in sources :

Example 6 with AWSCredentials

use of com.amazonaws.auth.AWSCredentials 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)

Example 7 with AWSCredentials

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

the class SesEndpoint method createSESClient.

private AmazonSimpleEmailService createSESClient() {
    AmazonSimpleEmailService 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 AmazonSimpleEmailServiceClient(credentials, clientConfiguration);
        } else {
            client = new AmazonSimpleEmailServiceClient(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonSimpleEmailServiceClient();
        } else {
            client = new AmazonSimpleEmailServiceClient(clientConfiguration);
        }
    }
    return client;
}
Also used : AmazonSimpleEmailService(com.amazonaws.services.simpleemail.AmazonSimpleEmailService) AmazonSimpleEmailServiceClient(com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 8 with AWSCredentials

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

the class S3Endpoint method createS3Client.

/**
     * Provide the possibility to override this method for an mock implementation
     */
AmazonS3 createS3Client() {
    AmazonS3Client client = null;
    ClientConfiguration clientConfiguration = null;
    boolean isClientConfigFound = false;
    if (configuration.hasProxyConfiguration()) {
        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 AmazonS3Client(credentials, clientConfiguration);
        } else {
            client = new AmazonS3Client(credentials);
        }
    } else {
        if (isClientConfigFound) {
            client = new AmazonS3Client();
        } else {
            client = new AmazonS3Client(clientConfiguration);
        }
    }
    S3ClientOptions clientOptions = S3ClientOptions.builder().setPathStyleAccess(configuration.isPathStyleAccess()).build();
    client.setS3ClientOptions(clientOptions);
    return client;
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client) S3ClientOptions(com.amazonaws.services.s3.S3ClientOptions) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 9 with AWSCredentials

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

the class SWFEndpoint method createSWClient.

private AmazonSimpleWorkflowClient createSWClient() throws Exception {
    AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    if (!configuration.getClientConfigurationParameters().isEmpty()) {
        setProperties(clientConfiguration, configuration.getClientConfigurationParameters());
    }
    AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(credentials, clientConfiguration);
    if (!configuration.getSWClientParameters().isEmpty()) {
        setProperties(client, configuration.getSWClientParameters());
    }
    return client;
}
Also used : AmazonSimpleWorkflowClient(com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration)

Example 10 with AWSCredentials

use of com.amazonaws.auth.AWSCredentials in project elasticsearch by elastic.

the class AwsS3ServiceImplTests method launchAWSCredentialsWithElasticsearchSettingsTest.

protected void launchAWSCredentialsWithElasticsearchSettingsTest(Settings singleRepositorySettings, Settings settings, String expectedKey, String expectedSecret) {
    String configName = InternalAwsS3Service.CLIENT_NAME.get(singleRepositorySettings);
    AWSCredentials credentials = InternalAwsS3Service.buildCredentials(logger, deprecationLogger, settings, singleRepositorySettings, configName).getCredentials();
    assertThat(credentials.getAWSAccessKeyId(), is(expectedKey));
    assertThat(credentials.getAWSSecretKey(), is(expectedSecret));
}
Also used : AWSCredentials(com.amazonaws.auth.AWSCredentials)

Aggregations

AWSCredentials (com.amazonaws.auth.AWSCredentials)42 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)27 ClientConfiguration (com.amazonaws.ClientConfiguration)12 PropertiesCredentials (com.amazonaws.auth.PropertiesCredentials)10 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)8 AmazonEC2Client (com.amazonaws.services.ec2.AmazonEC2Client)7 File (java.io.File)7 AmazonClientException (com.amazonaws.AmazonClientException)6 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)5 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)5 IOException (java.io.IOException)4 Instance (com.amazonaws.services.ec2.model.Instance)3 AmazonSimpleDBClient (com.amazonaws.services.simpledb.AmazonSimpleDBClient)3 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)2 Region (com.amazonaws.regions.Region)2 AmazonDynamoDB (com.amazonaws.services.dynamodbv2.AmazonDynamoDB)2 AmazonDynamoDBClient (com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient)2 AmazonS3 (com.amazonaws.services.s3.AmazonS3)2 RegionRecord (edu.umass.cs.aws.support.RegionRecord)2 AWSCredentialsConfig (io.druid.common.aws.AWSCredentialsConfig)2