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 ScalingPolicy
clone()
boolean
equals(Object obj)
String
getAdjustmentType()
The adjustment type, which specifies howScalingAdjustment
is interpreted.List<Alarm>
getAlarms()
The CloudWatch alarms related to the policy.String
getAutoScalingGroupName()
The name of the Auto Scaling group associated with this scaling policy.Integer
getCooldown()
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.Integer
getEstimatedInstanceWarmup()
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.String
getMetricAggregationType()
The aggregation type for the CloudWatch metrics.Integer
getMinAdjustmentMagnitude()
The minimum number of instances to scale.Integer
getMinAdjustmentStep()
Available for backward compatibility.String
getPolicyARN()
The Amazon Resource Name (ARN) of the policy.String
getPolicyName()
The name of the scaling policy.String
getPolicyType()
The policy type.Integer
getScalingAdjustment()
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.int
hashCode()
void
setAdjustmentType(String adjustmentType)
The adjustment type, which specifies howScalingAdjustment
is interpreted.void
setAlarms(Collection<Alarm> alarms)
The CloudWatch alarms related to the policy.void
setAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group associated with this scaling policy.void
setCooldown(Integer cooldown)
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.void
setEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.void
setMetricAggregationType(String metricAggregationType)
The aggregation type for the CloudWatch metrics.void
setMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)
The minimum number of instances to scale.void
setMinAdjustmentStep(Integer minAdjustmentStep)
Available for backward compatibility.void
setPolicyARN(String policyARN)
The Amazon Resource Name (ARN) of the policy.void
setPolicyName(String policyName)
The name of the scaling policy.void
setPolicyType(String policyType)
The policy type.void
setScalingAdjustment(Integer scalingAdjustment)
The amount by which to scale, based on the specified adjustment type.void
setStepAdjustments(Collection<StepAdjustment> stepAdjustments)
A set of adjustments that enable you to scale based on the size of the alarm breach.String
toString()
Returns a string representation of this object; useful for testing and debugging.ScalingPolicy
withAdjustmentType(String adjustmentType)
The adjustment type, which specifies howScalingAdjustment
is interpreted.ScalingPolicy
withAlarms(Alarm... alarms)
The CloudWatch alarms related to the policy.ScalingPolicy
withAlarms(Collection<Alarm> alarms)
The CloudWatch alarms related to the policy.ScalingPolicy
withAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group associated with this scaling policy.ScalingPolicy
withCooldown(Integer cooldown)
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.ScalingPolicy
withEstimatedInstanceWarmup(Integer estimatedInstanceWarmup)
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.ScalingPolicy
withMetricAggregationType(String metricAggregationType)
The aggregation type for the CloudWatch metrics.ScalingPolicy
withMinAdjustmentMagnitude(Integer minAdjustmentMagnitude)
The minimum number of instances to scale.ScalingPolicy
withMinAdjustmentStep(Integer minAdjustmentStep)
Available for backward compatibility.ScalingPolicy
withPolicyARN(String policyARN)
The Amazon Resource Name (ARN) of the policy.ScalingPolicy
withPolicyName(String policyName)
The name of the scaling policy.ScalingPolicy
withPolicyType(String policyType)
The policy type.ScalingPolicy
withScalingAdjustment(Integer scalingAdjustment)
The amount by which to scale, based on the specified adjustment type.ScalingPolicy
withStepAdjustments(StepAdjustment... stepAdjustments)
A set of adjustments that enable you to scale based on the size of the alarm breach.ScalingPolicy
withStepAdjustments(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
SimpleScaling
andStepScaling
.- Parameters:
policyType
- The policy type. Valid values areSimpleScaling
andStepScaling
.
-
getPolicyType
public String getPolicyType()
The policy type. Valid values are
SimpleScaling
andStepScaling
.- Returns:
- The policy type. Valid values are
SimpleScaling
andStepScaling
.
-
withPolicyType
public ScalingPolicy withPolicyType(String policyType)
The policy type. Valid values are
SimpleScaling
andStepScaling
.- Parameters:
policyType
- The policy type. Valid values areSimpleScaling
andStepScaling
.- 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
ScalingAdjustment
is interpreted. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.- Parameters:
adjustmentType
- The adjustment type, which specifies howScalingAdjustment
is interpreted. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.
-
getAdjustmentType
public String getAdjustmentType()
The adjustment type, which specifies how
ScalingAdjustment
is interpreted. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.- Returns:
- The adjustment type, which specifies how
ScalingAdjustment
is interpreted. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.
-
withAdjustmentType
public ScalingPolicy withAdjustmentType(String adjustmentType)
The adjustment type, which specifies how
ScalingAdjustment
is interpreted. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.- Parameters:
adjustmentType
- The adjustment type, which specifies howScalingAdjustment
is 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
MinAdjustmentMagnitude
instead.- Parameters:
minAdjustmentStep
- Available for backward compatibility. UseMinAdjustmentMagnitude
instead.
-
getMinAdjustmentStep
public Integer getMinAdjustmentStep()
Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.- Returns:
- Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.
-
withMinAdjustmentStep
public ScalingPolicy withMinAdjustmentStep(Integer minAdjustmentStep)
Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.- Parameters:
minAdjustmentStep
- Available for backward compatibility. UseMinAdjustmentMagnitude
instead.- 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
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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 ofAdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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
AdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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 ofAdjustmentType
isPercentChangeInCapacity
, the scaling policy changes theDesiredCapacity
of 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:
toString
in classObject
- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
clone
public ScalingPolicy clone()
-
-