com.amazonaws.services.autoscaling.model.PutScalingPolicyRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk Show documentation
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.autoscaling.model;
import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
/**
* Container for the parameters to the {@link com.amazonaws.services.autoscaling.AmazonAutoScaling#putScalingPolicy(PutScalingPolicyRequest) PutScalingPolicy operation}.
*
* Creates or updates a policy for an Auto Scaling group. To update an
* existing policy, use the existing policy name and set the parameter(s)
* you want to change. Any existing parameter not changed in an update to
* an existing policy is not changed in this update request.
*
*
* @see com.amazonaws.services.autoscaling.AmazonAutoScaling#putScalingPolicy(PutScalingPolicyRequest)
*/
public class PutScalingPolicyRequest extends AmazonWebServiceRequest implements Serializable {
/**
* The name or ARN of the Auto Scaling group.
*
* Constraints:
* Length: 1 - 1600
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*/
private String autoScalingGroupName;
/**
* The name of the policy you want to create or update.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*/
private String policyName;
/**
* The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*/
private Integer scalingAdjustment;
/**
* Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*/
private String adjustmentType;
/**
* The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*/
private Integer cooldown;
/**
* Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*/
private Integer minAdjustmentStep;
/**
* The name or ARN of the Auto Scaling group.
*
* Constraints:
* Length: 1 - 1600
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @return The name or ARN of the Auto Scaling group.
*/
public String getAutoScalingGroupName() {
return autoScalingGroupName;
}
/**
* The name or ARN of the Auto Scaling group.
*
* Constraints:
* Length: 1 - 1600
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param autoScalingGroupName The name or ARN of the Auto Scaling group.
*/
public void setAutoScalingGroupName(String autoScalingGroupName) {
this.autoScalingGroupName = autoScalingGroupName;
}
/**
* The name or ARN of the Auto Scaling group.
*
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints:
* Length: 1 - 1600
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param autoScalingGroupName The name or ARN of the Auto Scaling group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withAutoScalingGroupName(String autoScalingGroupName) {
this.autoScalingGroupName = autoScalingGroupName;
return this;
}
/**
* The name of the policy you want to create or update.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @return The name of the policy you want to create or update.
*/
public String getPolicyName() {
return policyName;
}
/**
* The name of the policy you want to create or update.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param policyName The name of the policy you want to create or update.
*/
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
/**
* The name of the policy you want to create or update.
*
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param policyName The name of the policy you want to create or update.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withPolicyName(String policyName) {
this.policyName = policyName;
return this;
}
/**
* The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*
* @return The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*/
public Integer getScalingAdjustment() {
return scalingAdjustment;
}
/**
* The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*
* @param scalingAdjustment The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*/
public void setScalingAdjustment(Integer scalingAdjustment) {
this.scalingAdjustment = scalingAdjustment;
}
/**
* The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param scalingAdjustment The number of instances by which to scale. AdjustmentType
* determines the interpretation of this number (e.g., as an absolute
* number or as a percentage of the existing Auto Scaling group size). A
* positive increment adds to the current capacity and a negative value
* removes from the current capacity.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withScalingAdjustment(Integer scalingAdjustment) {
this.scalingAdjustment = scalingAdjustment;
return this;
}
/**
* Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @return Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*/
public String getAdjustmentType() {
return adjustmentType;
}
/**
* Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param adjustmentType Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*/
public void setAdjustmentType(String adjustmentType) {
this.adjustmentType = adjustmentType;
}
/**
* Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints:
* Length: 1 - 255
* Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
*
* @param adjustmentType Specifies whether the ScalingAdjustment
is an absolute
* number or a percentage of the current capacity. Valid values are
* ChangeInCapacity
, ExactCapacity
, and
* PercentChangeInCapacity
.
For more information about
* the adjustment types supported by Auto Scaling, see Scale
* Based on Demand.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withAdjustmentType(String adjustmentType) {
this.adjustmentType = adjustmentType;
return this;
}
/**
* The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*
* @return The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*/
public Integer getCooldown() {
return cooldown;
}
/**
* The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*
* @param cooldown The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*/
public void setCooldown(Integer cooldown) {
this.cooldown = cooldown;
}
/**
* The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param cooldown The amount of time, in seconds, after a scaling activity completes and
* before the next scaling activity can start.
For more information,
* see Cooldown
* Period
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withCooldown(Integer cooldown) {
this.cooldown = cooldown;
return this;
}
/**
* Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*
* @return Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*/
public Integer getMinAdjustmentStep() {
return minAdjustmentStep;
}
/**
* Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*
* @param minAdjustmentStep Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*/
public void setMinAdjustmentStep(Integer minAdjustmentStep) {
this.minAdjustmentStep = minAdjustmentStep;
}
/**
* Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param minAdjustmentStep Used with AdjustmentType
with the value
* PercentChangeInCapacity
, the scaling policy changes the
* DesiredCapacity
of the Auto Scaling group by at least the
* number of instances specified in the value.
You will get a
* ValidationError
if you use MinAdjustmentStep
* on a policy with an AdjustmentType
other than
* PercentChangeInCapacity
.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public PutScalingPolicyRequest withMinAdjustmentStep(Integer minAdjustmentStep) {
this.minAdjustmentStep = minAdjustmentStep;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAutoScalingGroupName() != null) sb.append("AutoScalingGroupName: " + getAutoScalingGroupName() + ",");
if (getPolicyName() != null) sb.append("PolicyName: " + getPolicyName() + ",");
if (getScalingAdjustment() != null) sb.append("ScalingAdjustment: " + getScalingAdjustment() + ",");
if (getAdjustmentType() != null) sb.append("AdjustmentType: " + getAdjustmentType() + ",");
if (getCooldown() != null) sb.append("Cooldown: " + getCooldown() + ",");
if (getMinAdjustmentStep() != null) sb.append("MinAdjustmentStep: " + getMinAdjustmentStep() );
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAutoScalingGroupName() == null) ? 0 : getAutoScalingGroupName().hashCode());
hashCode = prime * hashCode + ((getPolicyName() == null) ? 0 : getPolicyName().hashCode());
hashCode = prime * hashCode + ((getScalingAdjustment() == null) ? 0 : getScalingAdjustment().hashCode());
hashCode = prime * hashCode + ((getAdjustmentType() == null) ? 0 : getAdjustmentType().hashCode());
hashCode = prime * hashCode + ((getCooldown() == null) ? 0 : getCooldown().hashCode());
hashCode = prime * hashCode + ((getMinAdjustmentStep() == null) ? 0 : getMinAdjustmentStep().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof PutScalingPolicyRequest == false) return false;
PutScalingPolicyRequest other = (PutScalingPolicyRequest)obj;
if (other.getAutoScalingGroupName() == null ^ this.getAutoScalingGroupName() == null) return false;
if (other.getAutoScalingGroupName() != null && other.getAutoScalingGroupName().equals(this.getAutoScalingGroupName()) == false) return false;
if (other.getPolicyName() == null ^ this.getPolicyName() == null) return false;
if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == false) return false;
if (other.getScalingAdjustment() == null ^ this.getScalingAdjustment() == null) return false;
if (other.getScalingAdjustment() != null && other.getScalingAdjustment().equals(this.getScalingAdjustment()) == false) return false;
if (other.getAdjustmentType() == null ^ this.getAdjustmentType() == null) return false;
if (other.getAdjustmentType() != null && other.getAdjustmentType().equals(this.getAdjustmentType()) == false) return false;
if (other.getCooldown() == null ^ this.getCooldown() == null) return false;
if (other.getCooldown() != null && other.getCooldown().equals(this.getCooldown()) == false) return false;
if (other.getMinAdjustmentStep() == null ^ this.getMinAdjustmentStep() == null) return false;
if (other.getMinAdjustmentStep() != null && other.getMinAdjustmentStep().equals(this.getMinAdjustmentStep()) == false) return false;
return true;
}
}