Class ScalingPolicy
- java.lang.Object
-
- com.amazonaws.services.autoscaling.model.ScalingPolicy
-
- All Implemented Interfaces:
Serializable,Cloneable
public class ScalingPolicy extends Object implements Serializable, Cloneable
Describes a scaling policy.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ScalingPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScalingPolicyclone()booleanequals(Object obj)StringgetAdjustmentType()The adjustment type, which specifies howScalingAdjustmentis interpreted.List<Alarm>getAlarms()The CloudWatch alarms related to the policy.StringgetAutoScalingGroupName()The name of the Auto Scaling group associated with this scaling policy.IntegergetCooldown()The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.IntegergetEstimatedInstanceWarmup()The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.StringgetMetricAggregationType()The aggregation type for the CloudWatch metrics.IntegergetMinAdjustmentMagnitude()The minimum number of instances to scale.IntegergetMinAdjustmentStep()Available for backward compatibility.StringgetPolicyARN()The Amazon Resource Name (ARN) of the policy.StringgetPolicyName()The name of the scaling policy.StringgetPolicyType()The policy type.IntegergetScalingAdjustment()The amount by which to scale, based on the specified adjustment type.List<StepAdjustment>getStepAdjustments()A set of adjustments that enable you to scale based on the size of the alarm breach.inthashCode()voidsetAdjustmentType(String adjustmentType)The adjustment type, which specifies howScalingAdjustmentis interpreted.voidsetAlarms(Collection<Alarm> alarms)The CloudWatch alarms related to the policy.voidsetAutoScalingGroupName(String autoScalingGroupName)The name of the Auto Scaling group associated with this scaling policy.voidsetCooldown(Integer cooldown)The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.voidsetEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.voidsetMetricAggregationType(String metricAggregationType)The aggregation type for the CloudWatch metrics.voidsetMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)The minimum number of instances to scale.voidsetMinAdjustmentStep(Integer minAdjustmentStep)Available for backward compatibility.voidsetPolicyARN(String policyARN)The Amazon Resource Name (ARN) of the policy.voidsetPolicyName(String policyName)The name of the scaling policy.voidsetPolicyType(String policyType)The policy type.voidsetScalingAdjustment(Integer scalingAdjustment)The amount by which to scale, based on the specified adjustment type.voidsetStepAdjustments(Collection<StepAdjustment> stepAdjustments)A set of adjustments that enable you to scale based on the size of the alarm breach.StringtoString()Returns a string representation of this object; useful for testing and debugging.ScalingPolicywithAdjustmentType(String adjustmentType)The adjustment type, which specifies howScalingAdjustmentis interpreted.ScalingPolicywithAlarms(Alarm... alarms)The CloudWatch alarms related to the policy.ScalingPolicywithAlarms(Collection<Alarm> alarms)The CloudWatch alarms related to the policy.ScalingPolicywithAutoScalingGroupName(String autoScalingGroupName)The name of the Auto Scaling group associated with this scaling policy.ScalingPolicywithCooldown(Integer cooldown)The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.ScalingPolicywithEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.ScalingPolicywithMetricAggregationType(String metricAggregationType)The aggregation type for the CloudWatch metrics.ScalingPolicywithMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)The minimum number of instances to scale.ScalingPolicywithMinAdjustmentStep(Integer minAdjustmentStep)Available for backward compatibility.ScalingPolicywithPolicyARN(String policyARN)The Amazon Resource Name (ARN) of the policy.ScalingPolicywithPolicyName(String policyName)The name of the scaling policy.ScalingPolicywithPolicyType(String policyType)The policy type.ScalingPolicywithScalingAdjustment(Integer scalingAdjustment)The amount by which to scale, based on the specified adjustment type.ScalingPolicywithStepAdjustments(StepAdjustment... stepAdjustments)A set of adjustments that enable you to scale based on the size of the alarm breach.ScalingPolicywithStepAdjustments(Collection<StepAdjustment> stepAdjustments)A set of adjustments that enable you to scale based on the size of the alarm breach.
-
-
-
Method Detail
-
setAutoScalingGroupName
public void setAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group associated with this scaling policy.
- Parameters:
autoScalingGroupName- The name of the Auto Scaling group associated with this scaling policy.
-
getAutoScalingGroupName
public String getAutoScalingGroupName()
The name of the Auto Scaling group associated with this scaling policy.
- Returns:
- The name of the Auto Scaling group associated with this scaling policy.
-
withAutoScalingGroupName
public ScalingPolicy withAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group associated with this scaling policy.
- Parameters:
autoScalingGroupName- The name of the Auto Scaling group associated with this scaling policy.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setPolicyName
public void setPolicyName(String policyName)
The name of the scaling policy.
- Parameters:
policyName- The name of the scaling policy.
-
getPolicyName
public String getPolicyName()
The name of the scaling policy.
- Returns:
- The name of the scaling policy.
-
withPolicyName
public ScalingPolicy withPolicyName(String policyName)
The name of the scaling policy.
- Parameters:
policyName- The name of the scaling policy.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setPolicyARN
public void setPolicyARN(String policyARN)
The Amazon Resource Name (ARN) of the policy.
- Parameters:
policyARN- The Amazon Resource Name (ARN) of the policy.
-
getPolicyARN
public String getPolicyARN()
The Amazon Resource Name (ARN) of the policy.
- Returns:
- The Amazon Resource Name (ARN) of the policy.
-
withPolicyARN
public ScalingPolicy withPolicyARN(String policyARN)
The Amazon Resource Name (ARN) of the policy.
- Parameters:
policyARN- The Amazon Resource Name (ARN) of the policy.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setPolicyType
public void setPolicyType(String policyType)
The policy type. Valid values are
SimpleScalingandStepScaling.- Parameters:
policyType- The policy type. Valid values areSimpleScalingandStepScaling.
-
getPolicyType
public String getPolicyType()
The policy type. Valid values are
SimpleScalingandStepScaling.- Returns:
- The policy type. Valid values are
SimpleScalingandStepScaling.
-
withPolicyType
public ScalingPolicy withPolicyType(String policyType)
The policy type. Valid values are
SimpleScalingandStepScaling.- Parameters:
policyType- The policy type. Valid values areSimpleScalingandStepScaling.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setAdjustmentType
public void setAdjustmentType(String adjustmentType)
The adjustment type, which specifies how
ScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.- Parameters:
adjustmentType- The adjustment type, which specifies howScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.
-
getAdjustmentType
public String getAdjustmentType()
The adjustment type, which specifies how
ScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.- Returns:
- The adjustment type, which specifies how
ScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.
-
withAdjustmentType
public ScalingPolicy withAdjustmentType(String adjustmentType)
The adjustment type, which specifies how
ScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.- Parameters:
adjustmentType- The adjustment type, which specifies howScalingAdjustmentis interpreted. Valid values areChangeInCapacity,ExactCapacity, andPercentChangeInCapacity.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMinAdjustmentStep
public void setMinAdjustmentStep(Integer minAdjustmentStep)
Available for backward compatibility. Use
MinAdjustmentMagnitudeinstead.- Parameters:
minAdjustmentStep- Available for backward compatibility. UseMinAdjustmentMagnitudeinstead.
-
getMinAdjustmentStep
public Integer getMinAdjustmentStep()
Available for backward compatibility. Use
MinAdjustmentMagnitudeinstead.- Returns:
- Available for backward compatibility. Use
MinAdjustmentMagnitudeinstead.
-
withMinAdjustmentStep
public ScalingPolicy withMinAdjustmentStep(Integer minAdjustmentStep)
Available for backward compatibility. Use
MinAdjustmentMagnitudeinstead.- Parameters:
minAdjustmentStep- Available for backward compatibility. UseMinAdjustmentMagnitudeinstead.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMinAdjustmentMagnitude
public void setMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)
The minimum number of instances to scale. If the value of
AdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.- Parameters:
minAdjustmentMagnitude- The minimum number of instances to scale. If the value ofAdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.
-
getMinAdjustmentMagnitude
public Integer getMinAdjustmentMagnitude()
The minimum number of instances to scale. If the value of
AdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.- Returns:
- The minimum number of instances to scale. If the value of
AdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.
-
withMinAdjustmentMagnitude
public ScalingPolicy withMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)
The minimum number of instances to scale. If the value of
AdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.- Parameters:
minAdjustmentMagnitude- The minimum number of instances to scale. If the value ofAdjustmentTypeisPercentChangeInCapacity, the scaling policy changes theDesiredCapacityof the Auto Scaling group by at least this many instances. Otherwise, the error isValidationError.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setScalingAdjustment
public void setScalingAdjustment(Integer scalingAdjustment)
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
- Parameters:
scalingAdjustment- The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
-
getScalingAdjustment
public Integer getScalingAdjustment()
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
- Returns:
- The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
-
withScalingAdjustment
public ScalingPolicy withScalingAdjustment(Integer scalingAdjustment)
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
- Parameters:
scalingAdjustment- The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setCooldown
public void setCooldown(Integer cooldown)
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
- Parameters:
cooldown- The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
-
getCooldown
public Integer getCooldown()
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
- Returns:
- The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
-
withCooldown
public ScalingPolicy withCooldown(Integer cooldown)
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
- Parameters:
cooldown- The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getStepAdjustments
public List<StepAdjustment> getStepAdjustments()
A set of adjustments that enable you to scale based on the size of the alarm breach.
- Returns:
- A set of adjustments that enable you to scale based on the size of the alarm breach.
-
setStepAdjustments
public void setStepAdjustments(Collection<StepAdjustment> stepAdjustments)
A set of adjustments that enable you to scale based on the size of the alarm breach.
- Parameters:
stepAdjustments- A set of adjustments that enable you to scale based on the size of the alarm breach.
-
withStepAdjustments
public ScalingPolicy withStepAdjustments(StepAdjustment... stepAdjustments)
A set of adjustments that enable you to scale based on the size of the alarm breach.
NOTE: This method appends the values to the existing list (if any). Use
setStepAdjustments(java.util.Collection)orwithStepAdjustments(java.util.Collection)if you want to override the existing values.- Parameters:
stepAdjustments- A set of adjustments that enable you to scale based on the size of the alarm breach.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
withStepAdjustments
public ScalingPolicy withStepAdjustments(Collection<StepAdjustment> stepAdjustments)
A set of adjustments that enable you to scale based on the size of the alarm breach.
- Parameters:
stepAdjustments- A set of adjustments that enable you to scale based on the size of the alarm breach.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMetricAggregationType
public void setMetricAggregationType(String metricAggregationType)
The aggregation type for the CloudWatch metrics. Valid values are
Minimum,Maximum, andAverage.- Parameters:
metricAggregationType- The aggregation type for the CloudWatch metrics. Valid values areMinimum,Maximum, andAverage.
-
getMetricAggregationType
public String getMetricAggregationType()
The aggregation type for the CloudWatch metrics. Valid values are
Minimum,Maximum, andAverage.- Returns:
- The aggregation type for the CloudWatch metrics. Valid values are
Minimum,Maximum, andAverage.
-
withMetricAggregationType
public ScalingPolicy withMetricAggregationType(String metricAggregationType)
The aggregation type for the CloudWatch metrics. Valid values are
Minimum,Maximum, andAverage.- Parameters:
metricAggregationType- The aggregation type for the CloudWatch metrics. Valid values areMinimum,Maximum, andAverage.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setEstimatedInstanceWarmup
public void setEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
- Parameters:
estimatedInstanceWarmup- The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
-
getEstimatedInstanceWarmup
public Integer getEstimatedInstanceWarmup()
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
- Returns:
- The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
-
withEstimatedInstanceWarmup
public ScalingPolicy withEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
- Parameters:
estimatedInstanceWarmup- The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getAlarms
public List<Alarm> getAlarms()
The CloudWatch alarms related to the policy.
- Returns:
- The CloudWatch alarms related to the policy.
-
setAlarms
public void setAlarms(Collection<Alarm> alarms)
The CloudWatch alarms related to the policy.
- Parameters:
alarms- The CloudWatch alarms related to the policy.
-
withAlarms
public ScalingPolicy withAlarms(Alarm... alarms)
The CloudWatch alarms related to the policy.
NOTE: This method appends the values to the existing list (if any). Use
setAlarms(java.util.Collection)orwithAlarms(java.util.Collection)if you want to override the existing values.- Parameters:
alarms- The CloudWatch alarms related to the policy.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
withAlarms
public ScalingPolicy withAlarms(Collection<Alarm> alarms)
The CloudWatch alarms related to the policy.
- Parameters:
alarms- The CloudWatch alarms related to the policy.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
toString
public String toString()
Returns a string representation of this object; useful for testing and debugging.- Overrides:
toStringin classObject- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
clone
public ScalingPolicy clone()
-
-