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;
}
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;
}
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);
}
}
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);
}
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();
}
Aggregations