com.xerox.amazonws.ec2
Class AutoScaling

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

public class AutoScaling
extends AWSQueryConnection

A Java wrapper for the AutoScaling web services API


Field Summary
 
Fields inherited from class com.xerox.amazonws.common.AWSConnection
headers
 
Constructor Summary
AutoScaling(String awsAccessId, String awsSecretKey)
          Initializes the AutoScaling service with your AWS login information.
AutoScaling(String awsAccessId, String awsSecretKey, boolean isSecure)
          Initializes the AutoScaling service with your AWS login information.
AutoScaling(String awsAccessId, String awsSecretKey, boolean isSecure, String server)
          Initializes the AutoScaling service with your AWS login information.
AutoScaling(String awsAccessId, String awsSecretKey, boolean isSecure, String server, int port)
          Initializes the AutoScaling service with your AWS login information.
 
Method Summary
 void createAutoScalingGroup(String autoScalingGroupName, String launchConfigurationName, int minSize, int maxSize, int cooldown, List<String> availabilityZones)
          Creates a new auto scaling group
 void createLaunchConfiguration(LaunchConfiguration config)
          Create a launch configuration
 void createOrUpdateScalingTrigger(ScalingTrigger trigger)
          Creates a scaling trigger, or updates an existing one
 void deleteAutoScalingGroup(String autoScalingGroupName)
          Deletes a auto scaling group
 void deleteLaunchConfiguration(String configName)
          Delete a launch configuration
 void deleteTrigger(String triggerName, String autoScalingGroupName)
          Deletes a trigger
 List<AutoScalingGroup> describeAutoScalingGroups(List<String> autoScalingGroupNames)
          Describes one or more auto scaling groups
 List<LaunchConfiguration> describeLaunchConfigurations(List<String> configNames)
          Describe the launch configurations that have been created
 List<Activity> describeScalingActivities(List<String> activityIds, String autoScalingGroupName)
          Describes the autoScaling activities for a given group.
 List<ScalingTrigger> describeTriggers(String autoScalingGroupName)
          Describes the scaling triggers for a given group.
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 void setDesiredCapacity(String autoScalingGroupName, int desiredCapacity)
          Adjusts a auto scaling groups' capacity
 Activity terminateInstancesInAutoScalingGroup(String instanceId, boolean shouldDecrement)
          Terminates a running instance.
 void updateAutoScalingGroup(String autoScalingGroupName, String launchConfigurationName, int minSize, int maxSize, int defaultCooldown)
          Update a auto scaling group
 
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

AutoScaling

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

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

AutoScaling

public AutoScaling(String awsAccessId,
                   String awsSecretKey,
                   boolean isSecure)
Initializes the AutoScaling 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.

AutoScaling

public AutoScaling(String awsAccessId,
                   String awsSecretKey,
                   boolean isSecure,
                   String server)
Initializes the AutoScaling 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 autoscaling.amazonaws.com

AutoScaling

public AutoScaling(String awsAccessId,
                   String awsSecretKey,
                   boolean isSecure,
                   String server,
                   int port)
Initializes the AutoScaling 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 autoscaling.amazonaws.com
port - Which port to use.
Method Detail

createLaunchConfiguration

public void createLaunchConfiguration(LaunchConfiguration config)
                               throws AutoScalingException
Create a launch configuration

Parameters:
config - the launch configuration
Throws:
AutoScalingException - wraps checked exceptions

deleteLaunchConfiguration

public void deleteLaunchConfiguration(String configName)
                               throws AutoScalingException
Delete a launch configuration

Parameters:
configName - the name of the configuration to delete
Throws:
AutoScalingException - wraps checked exceptions

describeLaunchConfigurations

public List<LaunchConfiguration> describeLaunchConfigurations(List<String> configNames)
                                                       throws AutoScalingException
Describe the launch configurations that have been created

Parameters:
configNames - the names of the configurations to show, null for all
Returns:
A list of LaunchConfiguration configs
Throws:
AutoScalingException - wraps checked exceptions

terminateInstancesInAutoScalingGroup

public Activity terminateInstancesInAutoScalingGroup(String instanceId,
                                                     boolean shouldDecrement)
                                              throws AutoScalingException
Terminates a running instance.

Parameters:
instanceId - An instance id
shouldDecrement - true of desired capacity should be decremented at the same time
Returns:
activity description
Throws:
AutoScalingException - wraps checked exceptions

describeScalingActivities

public List<Activity> describeScalingActivities(List<String> activityIds,
                                                String autoScalingGroupName)
                                         throws AutoScalingException
Describes the autoScaling activities for a given group.

Parameters:
activityIds - activity ids used to filter the list, null for all
autoScalingGroupName - an auto scaling group name
Returns:
activity descriptions
Throws:
AutoScalingException - wraps checked exceptions

createOrUpdateScalingTrigger

public void createOrUpdateScalingTrigger(ScalingTrigger trigger)
                                  throws AutoScalingException
Creates a scaling trigger, or updates an existing one

Parameters:
trigger - the information about the trigger
Throws:
AutoScalingException - wraps checked exceptions

deleteTrigger

public void deleteTrigger(String triggerName,
                          String autoScalingGroupName)
                   throws AutoScalingException
Deletes a trigger

Parameters:
triggerName - An trigger name
autoScalingGroupName - a autoScaling group name
Throws:
AutoScalingException - wraps checked exceptions

describeTriggers

public List<ScalingTrigger> describeTriggers(String autoScalingGroupName)
                                      throws AutoScalingException
Describes the scaling triggers for a given group.

Parameters:
autoScalingGroupName - a autoScaling group name
Returns:
activity descriptions
Throws:
AutoScalingException - wraps checked exceptions

createAutoScalingGroup

public void createAutoScalingGroup(String autoScalingGroupName,
                                   String launchConfigurationName,
                                   int minSize,
                                   int maxSize,
                                   int cooldown,
                                   List<String> availabilityZones)
                            throws AutoScalingException
Creates a new auto scaling group

Parameters:
autoScalingGroupName - a autoScaling group name
launchConfigurationName - name of launch configuration for this group
minSize - min number of servers in this group
maxSize - max number of servers in this group (must be < 1000)
cooldown - number of seconds to wait before adjusting capacity
availabilityZones - zones for this group
Throws:
AutoScalingException - wraps checked exceptions

deleteAutoScalingGroup

public void deleteAutoScalingGroup(String autoScalingGroupName)
                            throws AutoScalingException
Deletes a auto scaling group

Parameters:
autoScalingGroupName - a autoScaling group name
Throws:
AutoScalingException - wraps checked exceptions

describeAutoScalingGroups

public List<AutoScalingGroup> describeAutoScalingGroups(List<String> autoScalingGroupNames)
                                                 throws AutoScalingException
Describes one or more auto scaling groups

Parameters:
autoScalingGroupNames - a auto scaling group name
Returns:
autoScaling group descriptions
Throws:
AutoScalingException - wraps checked exceptions

setDesiredCapacity

public void setDesiredCapacity(String autoScalingGroupName,
                               int desiredCapacity)
                        throws AutoScalingException
Adjusts a auto scaling groups' capacity

Parameters:
autoScalingGroupName - a autoScaling group name
desiredCapacity - the new capacity setting
Throws:
AutoScalingException - wraps checked exceptions

updateAutoScalingGroup

public void updateAutoScalingGroup(String autoScalingGroupName,
                                   String launchConfigurationName,
                                   int minSize,
                                   int maxSize,
                                   int defaultCooldown)
                            throws AutoScalingException
Update a auto scaling group

Parameters:
autoScalingGroupName - a autoScaling group name
launchConfigurationName - name of launch configuration for this group
minSize - min number of servers in this group
maxSize - max number of servers in this group (must be < 1000)
defaultCooldown - number of seconds to wait before adjusting capacity
Throws:
AutoScalingException - 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 AutoScalingException
Throws:
AutoScalingException