Search in sources :

Example 91 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 92 with AWSCredentials

use of com.amazonaws.auth.AWSCredentials in project cas by apereo.

the class DynamoDbCloudConfigBootstrapConfiguration method getAmazonDynamoDbClient.

private static AmazonDynamoDB getAmazonDynamoDbClient(final Environment environment) {
    final ClientConfiguration cfg = new ClientConfiguration();
    try {
        final String localAddress = getSetting(environment, "localAddress");
        if (StringUtils.isNotBlank(localAddress)) {
            cfg.setLocalAddress(InetAddress.getByName(localAddress));
        }
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    final String key = getSetting(environment, "credentialAccessKey");
    final String secret = getSetting(environment, "credentialSecretKey");
    final AWSCredentials credentials = new BasicAWSCredentials(key, secret);
    String region = getSetting(environment, "region");
    if (StringUtils.isBlank(region)) {
        region = Regions.getCurrentRegion().getName();
    }
    String regionOverride = getSetting(environment, "regionOverride");
    if (StringUtils.isNotBlank(regionOverride)) {
        regionOverride = Regions.getCurrentRegion().getName();
    }
    final String endpoint = getSetting(environment, "endpoint");
    final AmazonDynamoDB client = AmazonDynamoDBClient.builder().withCredentials(new AWSStaticCredentialsProvider(credentials)).withClientConfiguration(cfg).withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, regionOverride)).withRegion(region).build();
    return client;
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) AwsClientBuilder(com.amazonaws.client.builder.AwsClientBuilder) AmazonDynamoDB(com.amazonaws.services.dynamodbv2.AmazonDynamoDB) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 93 with AWSCredentials

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

the class S3CheckpointSpiSelfTest method afterSpiStopped.

/**
 * @throws Exception If error.
 */
@Override
protected void afterSpiStopped() throws Exception {
    AWSCredentials cred = new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey());
    AmazonS3 s3 = new AmazonS3Client(cred);
    String bucketName = S3CheckpointSpi.BUCKET_NAME_PREFIX + "unit-test-bucket";
    try {
        ObjectListing list = s3.listObjects(bucketName);
        while (true) {
            for (S3ObjectSummary sum : list.getObjectSummaries()) s3.deleteObject(bucketName, sum.getKey());
            if (list.isTruncated())
                list = s3.listNextBatchOfObjects(list);
            else
                break;
        }
    } catch (AmazonClientException e) {
        throw new IgniteSpiException("Failed to read checkpoint bucket: " + bucketName, e);
    }
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client) AmazonClientException(com.amazonaws.AmazonClientException) ObjectListing(com.amazonaws.services.s3.model.ObjectListing) S3ObjectSummary(com.amazonaws.services.s3.model.S3ObjectSummary) IgniteSpiException(org.apache.ignite.spi.IgniteSpiException) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 94 with AWSCredentials

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

the class S3CheckpointSpiSelfTest method spiConfigure.

/**
 * {@inheritDoc}
 */
@Override
protected void spiConfigure(S3CheckpointSpi spi) throws Exception {
    AWSCredentials cred = new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey());
    spi.setAwsCredentials(cred);
    spi.setBucketNameSuffix(getBucketNameSuffix());
    super.spiConfigure(spi);
}
Also used : BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials)

Example 95 with AWSCredentials

use of com.amazonaws.auth.AWSCredentials in project cas by apereo.

the class ChainingAWSCredentialsProvider method getCredentials.

@Override
public AWSCredentials getCredentials() {
    LOGGER.debug("Attempting to locate AWS credentials from the chain...");
    for (final AWSCredentialsProvider p : this.chain) {
        AWSCredentials c;
        try {
            LOGGER.debug("Calling credential provider [{}] to fetch credentials...", p.getClass().getSimpleName());
            c = p.getCredentials();
        } catch (final Throwable e) {
            LOGGER.trace(e.getMessage(), e);
            c = null;
        }
        if (c != null) {
            LOGGER.debug("Fetched credentials from [{}] provider successfully.", p.getClass().getSimpleName());
            return c;
        }
    }
    LOGGER.warn("No AWS credentials could be determined from the chain. Using anonymous credentials...");
    return new AnonymousAWSCredentials();
}
Also used : AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider)

Aggregations

AWSCredentials (com.amazonaws.auth.AWSCredentials)277 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)181 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)80 Test (org.junit.Test)57 ClientConfiguration (com.amazonaws.ClientConfiguration)53 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)49 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)33 AmazonS3 (com.amazonaws.services.s3.AmazonS3)30 AmazonClientException (com.amazonaws.AmazonClientException)29 BasicSessionCredentials (com.amazonaws.auth.BasicSessionCredentials)26 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)15 HashMap (java.util.HashMap)15 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)14 IOException (java.io.IOException)14 AmazonServiceException (com.amazonaws.AmazonServiceException)13 AwsClientBuilder (com.amazonaws.client.builder.AwsClientBuilder)13 Date (java.util.Date)13 SdkClientException (com.amazonaws.SdkClientException)11 AWSSessionCredentials (com.amazonaws.auth.AWSSessionCredentials)11 PropertiesCredentials (com.amazonaws.auth.PropertiesCredentials)11