use of com.amazonaws.auth.BasicAWSCredentials in project eureka by Netflix.
the class EIPManager method getEC2Service.
/**
* Gets the EC2 service object to call AWS APIs.
*
* @return the EC2 service object to call AWS APIs.
*/
private AmazonEC2 getEC2Service() {
String aWSAccessId = serverConfig.getAWSAccessId();
String aWSSecretKey = serverConfig.getAWSSecretKey();
AmazonEC2 ec2Service;
if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) {
ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey));
} else {
ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider());
}
String region = clientConfig.getRegion();
region = region.trim().toLowerCase();
ec2Service.setEndpoint("ec2." + region + ".amazonaws.com");
return ec2Service;
}
use of com.amazonaws.auth.BasicAWSCredentials in project eureka by Netflix.
the class ElasticNetworkInterfaceBinder method getEC2Service.
private AmazonEC2 getEC2Service() {
String aWSAccessId = serverConfig.getAWSAccessId();
String aWSSecretKey = serverConfig.getAWSSecretKey();
AmazonEC2 ec2Service;
if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) {
ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey));
} else {
ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider());
}
String region = clientConfig.getRegion();
region = region.trim().toLowerCase();
ec2Service.setEndpoint("ec2." + region + ".amazonaws.com");
return ec2Service;
}
use of com.amazonaws.auth.BasicAWSCredentials in project eureka by Netflix.
the class Route53Binder method getAmazonRoute53Client.
private AmazonRoute53Client getAmazonRoute53Client(EurekaServerConfig serverConfig) {
String aWSAccessId = serverConfig.getAWSAccessId();
String aWSSecretKey = serverConfig.getAWSSecretKey();
ClientConfiguration clientConfiguration = new ClientConfiguration().withConnectionTimeout(serverConfig.getASGQueryTimeoutMs());
if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) {
return new AmazonRoute53Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey), clientConfiguration);
} else {
return new AmazonRoute53Client(new InstanceProfileCredentialsProvider(), clientConfiguration);
}
}
use of com.amazonaws.auth.BasicAWSCredentials in project presto by prestodb.
the class PrestoS3FileSystem method getAwsCredentials.
private static Optional<AWSCredentials> getAwsCredentials(URI uri, Configuration conf) {
String accessKey = conf.get(S3_ACCESS_KEY);
String secretKey = conf.get(S3_SECRET_KEY);
String userInfo = uri.getUserInfo();
if (userInfo != null) {
int index = userInfo.indexOf(':');
if (index < 0) {
accessKey = userInfo;
} else {
accessKey = userInfo.substring(0, index);
secretKey = userInfo.substring(index + 1);
}
}
if (isNullOrEmpty(accessKey) || isNullOrEmpty(secretKey)) {
return Optional.empty();
}
return Optional.of(new BasicAWSCredentials(accessKey, secretKey));
}
use of com.amazonaws.auth.BasicAWSCredentials in project exhibitor by soabase.
the class S3ClientImpl method changeCredentials.
@Override
public void changeCredentials(S3Credential credential, S3ClientConfig clientConfig) {
RefCountedClient newRefCountedClient = (credential != null) ? new RefCountedClient(createClient(null, new BasicAWSCredentials(credential.getAccessKeyId(), credential.getSecretAccessKey()), clientConfig)) : new RefCountedClient(createClient(null, null, clientConfig));
RefCountedClient oldRefCountedClient = client.getAndSet(newRefCountedClient);
if (oldRefCountedClient != null) {
oldRefCountedClient.markForDelete();
}
}
Aggregations