com.xerox.amazonws.ec2
Class LoadBalancing

java.lang.Object
  extended by com.xerox.amazonws.common.AWSConnection
      extended by com.xerox.amazonws.common.AWSQueryConnection
          extended by com.xerox.amazonws.ec2.LoadBalancing

public class LoadBalancing
extends AWSQueryConnection

A Java wrapper for the EC2 web services API


Field Summary
 
Fields inherited from class com.xerox.amazonws.common.AWSConnection
headers
 
Constructor Summary
LoadBalancing(String awsAccessId, String awsSecretKey)
          Initializes the ec2 service with your AWS login information.
LoadBalancing(String awsAccessId, String awsSecretKey, boolean isSecure)
          Initializes the ec2 service with your AWS login information.
LoadBalancing(String awsAccessId, String awsSecretKey, boolean isSecure, String server)
          Initializes the ec2 service with your AWS login information.
LoadBalancing(String awsAccessId, String awsSecretKey, boolean isSecure, String server, int port)
          Initializes the ec2 service with your AWS login information.
 
Method Summary
 HealthCheck configureHealthCheck(String loadBalancerName, HealthCheck healthCheck)
          Configure health check.
 String createLoadBalancer(String loadBalancerName, List<Listener> listeners, List<String> availabilityZones)
          Create load balancer.
 void deleteLoadBalancer(String loadBalancerName)
          Delete load balancer.
 List<String> deregisterInstancesFromLoadBalancer(String loadBalancerName, List<String> instances)
          Deregister instances from load balancer.
 List<InstanceState> describeInstanceHealth(String loadBalancerName)
          Describe the current state of the instances registered with the load balancer.
 List<InstanceState> describeInstanceHealth(String loadBalancerName, List<String> instances)
          Describe the current state of the instances specified
 List<LoadBalancer> describeLoadBalancers()
          Describe all load balancers.
 List<LoadBalancer> describeLoadBalancers(List<String> loadBalancerNames)
          Describe load balancers.
 List<String> disableAvailabilityZonesForLoadBalancer(String loadBalancerName, List<String> availabilityZones)
          Disable availability zones.
 List<String> enableAvailabilityZonesForLoadBalancer(String loadBalancerName, List<String> availabilityZones)
          Add availability zones.
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 List<String> registerInstancesWithLoadBalancer(String loadBalancerName, List<String> instances)
          Register instance(s) with a load balancer.
 
Methods inherited from class com.xerox.amazonws.common.AWSQueryConnection
close, close, getConnectionManagerTimeout, getConnectionTimeout, getHeaders, getHttpClient, getMaxConnections, getMaxRetries, getServerTimeZone, getSoTimeout, getString, httpDate, makeRequest, setConnectionManagerTimeout, setConnectionTimeout, setHttpClient, setMaxConnections, setMaxRetries, setProxyValues, setProxyValues, setProxyValues, setServerTimeZone, setSoTimeout, useSystemProxy
 
Methods inherited from class com.xerox.amazonws.common.AWSConnection
encode, encode, getAlgorithm, getAwsAccessKeyId, getPort, getResourcePrefix, getSecretAccessKey, getServer, getSignatureVersion, getUrl, isSecure, makeURL, setResourcePrefix, setServer, setSignatureVersion, urlencode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadBalancing

public LoadBalancing(String awsAccessId,
                     String awsSecretKey)
Initializes the ec2 service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.

LoadBalancing

public LoadBalancing(String awsAccessId,
                     String awsSecretKey,
                     boolean isSecure)
Initializes the ec2 service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from EC2.

LoadBalancing

public LoadBalancing(String awsAccessId,
                     String awsSecretKey,
                     boolean isSecure,
                     String server)
Initializes the ec2 service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from EC2.
server - Which host to connect to. Usually, this will be elasticloadbalancing.amazonaws.com

LoadBalancing

public LoadBalancing(String awsAccessId,
                     String awsSecretKey,
                     boolean isSecure,
                     String server,
                     int port)
Initializes the ec2 service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from EC2.
server - Which host to connect to. Usually, this will be elasticloadbalancing.amazonaws.com
port - Which port to use.
Method Detail

enableAvailabilityZonesForLoadBalancer

public List<String> enableAvailabilityZonesForLoadBalancer(String loadBalancerName,
                                                           List<String> availabilityZones)
                                                    throws LoadBalancingException
Add availability zones.

Parameters:
loadBalancerName - the name of the load balancer
availabilityZones - a list of availability zones to add
Throws:
LoadBalancingException - wraps checked exceptions

createLoadBalancer

public String createLoadBalancer(String loadBalancerName,
                                 List<Listener> listeners,
                                 List<String> availabilityZones)
                          throws LoadBalancingException
Create load balancer.

Parameters:
loadBalancerName - the name of the load balancer
listeners - the definition of protocol and ports
availabilityZones - a list of availability zones
Returns:
dns the DNS name for the load balancer
Throws:
LoadBalancingException - wraps checked exceptions

configureHealthCheck

public HealthCheck configureHealthCheck(String loadBalancerName,
                                        HealthCheck healthCheck)
                                 throws LoadBalancingException
Configure health check.

Parameters:
loadBalancerName - the name of the load balancer
healthCheck - the details of the healthcheck
Throws:
LoadBalancingException - wraps checked exceptions

deleteLoadBalancer

public void deleteLoadBalancer(String loadBalancerName)
                        throws LoadBalancingException
Delete load balancer.

Parameters:
loadBalancerName - the name of the load balancer
Throws:
LoadBalancingException - wraps checked exceptions

deregisterInstancesFromLoadBalancer

public List<String> deregisterInstancesFromLoadBalancer(String loadBalancerName,
                                                        List<String> instances)
                                                 throws LoadBalancingException
Deregister instances from load balancer.

Parameters:
loadBalancerName - the name of the load balancer
instances - a list of instances to deregister from the load balancer
Returns:
the updated list of instances registered with the load balancer
Throws:
LoadBalancingException - wraps checked exceptions

describeLoadBalancers

public List<LoadBalancer> describeLoadBalancers()
                                         throws LoadBalancingException
Describe all load balancers.

Throws:
LoadBalancingException - wraps checked exceptions

describeLoadBalancers

public List<LoadBalancer> describeLoadBalancers(List<String> loadBalancerNames)
                                         throws LoadBalancingException
Describe load balancers.

Parameters:
loadBalancerNames - a list of load balancers to describe
Throws:
LoadBalancingException - wraps checked exceptions

describeInstanceHealth

public List<InstanceState> describeInstanceHealth(String loadBalancerName)
                                           throws LoadBalancingException
Describe the current state of the instances registered with the load balancer.

Parameters:
loadBalancerName - the name of the load balancer
Throws:
LoadBalancingException - wraps checked exceptions

describeInstanceHealth

public List<InstanceState> describeInstanceHealth(String loadBalancerName,
                                                  List<String> instances)
                                           throws LoadBalancingException
Describe the current state of the instances specified

Parameters:
loadBalancerName - the name of the load balancer
instances - a list of instances to describe (null for all)
Throws:
LoadBalancingException - wraps checked exceptions

registerInstancesWithLoadBalancer

public List<String> registerInstancesWithLoadBalancer(String loadBalancerName,
                                                      List<String> instances)
                                               throws LoadBalancingException
Register instance(s) with a load balancer.

Parameters:
loadBalancerName - the name of the load balancer
instances - a list of instance IDs registered with the load balancer
Throws:
LoadBalancingException - wraps checked exceptions

disableAvailabilityZonesForLoadBalancer

public List<String> disableAvailabilityZonesForLoadBalancer(String loadBalancerName,
                                                            List<String> availabilityZones)
                                                     throws LoadBalancingException
Disable availability zones.

Parameters:
loadBalancerName - the name of the load balancer
availabilityZones - a list of availability zones to disable
Throws:
LoadBalancingException - wraps checked exceptions

makeRequestInt

protected <T> T makeRequestInt(org.apache.http.client.methods.HttpRequestBase method,
                               String action,
                               Map<String,String> params,
                               Class<T> respType)
                    throws LoadBalancingException
Throws:
LoadBalancingException