Search in sources :

Example 1 with AmazonElasticLoadBalancingClient

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;
}
Also used : AmazonElasticLoadBalancingClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient)

Example 2 with AmazonElasticLoadBalancingClient

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();
}
Also used : DescribeTagsRequest(com.amazonaws.services.elasticloadbalancing.model.DescribeTagsRequest) DescribeTagsResult(com.amazonaws.services.elasticloadbalancing.model.DescribeTagsResult) AmazonElasticLoadBalancingClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient)

Example 3 with AmazonElasticLoadBalancingClient

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);
}
Also used : AmazonElasticLoadBalancingClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient)

Example 4 with AmazonElasticLoadBalancingClient

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;
}
Also used : AmazonElasticLoadBalancingClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient)

Example 5 with AmazonElasticLoadBalancingClient

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;
}
Also used : DescribeLoadBalancersResult(com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult) AmazonElasticLoadBalancingClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient) DescribeLoadBalancersRequest(com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest)

Aggregations

AmazonElasticLoadBalancingClient (com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient)5 DescribeLoadBalancersRequest (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest)1 DescribeLoadBalancersResult (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult)1 DescribeTagsRequest (com.amazonaws.services.elasticloadbalancing.model.DescribeTagsRequest)1 DescribeTagsResult (com.amazonaws.services.elasticloadbalancing.model.DescribeTagsResult)1