use of com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient in project SimianArmy by Netflix.
the class AWSClient method elbClient.
/**
* Amazon ELB client. Abstracted to aid testing.
*
* @return the Amazon ELB client
*/
protected AmazonElasticLoadBalancingClient elbClient() {
AmazonElasticLoadBalancingClient client;
if (awsClientConfig == null) {
if (awsCredentialsProvider == null) {
client = new AmazonElasticLoadBalancingClient();
} else {
client = new AmazonElasticLoadBalancingClient(awsCredentialsProvider);
}
} else {
if (awsCredentialsProvider == null) {
client = new AmazonElasticLoadBalancingClient(awsClientConfig);
} else {
client = new AmazonElasticLoadBalancingClient(awsCredentialsProvider, awsClientConfig);
}
}
client.setEndpoint("elasticloadbalancing." + region + ".amazonaws.com");
return client;
}
use of com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient in project SimianArmy by Netflix.
the class AWSClient method describeElasticLoadBalancerTags.
/**
* Retreive the tags for a specific ELB.
*
* @param name the ELB names
* @return the ELBs
*/
public List<TagDescription> describeElasticLoadBalancerTags(String name) {
LOGGER.info(String.format("Getting tags for ELB with name '%s' in region %s.", name, region));
AmazonElasticLoadBalancingClient elbClient = elbClient();
DescribeTagsRequest request = new DescribeTagsRequest().withLoadBalancerNames(name);
DescribeTagsResult result = elbClient.describeTags(request);
LOGGER.info(String.format("Got tags for ELB with name '%s' in region %s.", name, region));
return result.getTagDescriptions();
}
use of com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient in project SimianArmy by Netflix.
the class AWSClient method deleteElasticLoadBalancer.
/** {@inheritDoc} */
@Override
public void deleteElasticLoadBalancer(String elbId) {
Validate.notEmpty(elbId);
LOGGER.info(String.format("Deleting ELB %s in region %s.", elbId, region));
AmazonElasticLoadBalancingClient elbClient = elbClient();
DeleteLoadBalancerRequest request = new DeleteLoadBalancerRequest(elbId);
elbClient.deleteLoadBalancer(request);
}
use of com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient in project SimianArmy by Netflix.
the class AWSClient method describeElasticLoadBalancerAttributes.
/**
* Describe a specific ELB.
*
* @param name the ELB names
* @return the ELBs
*/
public LoadBalancerAttributes describeElasticLoadBalancerAttributes(String name) {
LOGGER.info(String.format("Getting attributes for ELB with name '%s' in region %s.", name, region));
AmazonElasticLoadBalancingClient elbClient = elbClient();
DescribeLoadBalancerAttributesRequest request = new DescribeLoadBalancerAttributesRequest().withLoadBalancerName(name);
DescribeLoadBalancerAttributesResult result = elbClient.describeLoadBalancerAttributes(request);
LoadBalancerAttributes attrs = result.getLoadBalancerAttributes();
LOGGER.info(String.format("Got attributes for ELB with name '%s' in region %s.", name, region));
return attrs;
}
use of com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient in project SimianArmy by Netflix.
the class AWSClient method describeElasticLoadBalancers.
/**
* Describe a set of specific ELBs.
*
* @param names the ELB names
* @return the ELBs
*/
public List<LoadBalancerDescription> describeElasticLoadBalancers(String... names) {
if (names == null || names.length == 0) {
LOGGER.info(String.format("Getting all ELBs in region %s.", region));
} else {
LOGGER.info(String.format("Getting ELBs for %d names in region %s.", names.length, region));
}
AmazonElasticLoadBalancingClient elbClient = elbClient();
DescribeLoadBalancersRequest request = new DescribeLoadBalancersRequest().withLoadBalancerNames(names);
DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(request);
List<LoadBalancerDescription> elbs = result.getLoadBalancerDescriptions();
LOGGER.info(String.format("Got %d ELBs in region %s.", elbs.size(), region));
return elbs;
}
Aggregations