Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Describes a scaling policy.

 
 public class ScalingPolicy implements SerializableCloneable {

    
The name of the Auto Scaling group associated with this scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

 
     private String autoScalingGroupName;

    
The name of the scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

 
     private String policyName;

    
The Amazon Resource Name (ARN) of the policy.

Constraints:
Length: 1 - 1600
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

 
     private String policyARN;

    
Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.
 
     private Integer minAdjustmentStep;

    
Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

 
     private String adjustmentType;

    
The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.
 
     private Integer scalingAdjustment;

    
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
 
     private Integer cooldown;

    
The CloudWatch alarms related to the policy.
 
The name of the Auto Scaling group associated with this scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Returns:
The name of the Auto Scaling group associated with this scaling policy.
    public String getAutoScalingGroupName() {
        return ;
    }
    
    
The name of the Auto Scaling group associated with this scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
autoScalingGroupName The name of the Auto Scaling group associated with this scaling policy.
    public void setAutoScalingGroupName(String autoScalingGroupName) {
        this. = autoScalingGroupName;
    }
    
    
The name of the Auto Scaling group associated with this scaling policy.

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]*

Parameters:
autoScalingGroupName The name of the Auto Scaling group associated with this scaling policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withAutoScalingGroupName(String autoScalingGroupName) {
        this. = autoScalingGroupName;
        return this;
    }

    
The name of the scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Returns:
The name of the scaling policy.
    public String getPolicyName() {
        return ;
    }
    
    
The name of the scaling policy.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
policyName The name of the scaling policy.
    public void setPolicyName(String policyName) {
        this. = policyName;
    }
    
    
The name of the scaling policy.

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]*

Parameters:
policyName The name of the scaling policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withPolicyName(String policyName) {
        this. = policyName;
        return this;
    }

    
The Amazon Resource Name (ARN) of the policy.

Constraints:
Length: 1 - 1600
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Returns:
The Amazon Resource Name (ARN) of the policy.
    public String getPolicyARN() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the policy.

Constraints:
Length: 1 - 1600
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
policyARN The Amazon Resource Name (ARN) of the policy.
    public void setPolicyARN(String policyARN) {
        this. = policyARN;
    }
    
    
The Amazon Resource Name (ARN) of the policy.

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]*

Parameters:
policyARN The Amazon Resource Name (ARN) of the policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withPolicyARN(String policyARN) {
        this. = policyARN;
        return this;
    }

    
Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.

Returns:
Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.
    public Integer getMinAdjustmentStep() {
        return ;
    }
    
    
Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.

Parameters:
minAdjustmentStep Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.
    public void setMinAdjustmentStep(Integer minAdjustmentStep) {
        this. = minAdjustmentStep;
    }
    
    
Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.

Returns a reference to this object so that method calls can be chained together.

Parameters:
minAdjustmentStep Changes the DesiredCapacity of the Auto Scaling group by at least the specified number of instances.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withMinAdjustmentStep(Integer minAdjustmentStep) {
        this. = minAdjustmentStep;
        return this;
    }

    
Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Returns:
Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
    public String getAdjustmentType() {
        return ;
    }
    
    
Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

Constraints:
Length: 1 - 255
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
adjustmentType Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
    public void setAdjustmentType(String adjustmentType) {
        this. = adjustmentType;
    }
    
    
Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

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]*

Parameters:
adjustmentType Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withAdjustmentType(String adjustmentType) {
        this. = adjustmentType;
        return this;
    }

    
The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.

Returns:
The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.
    public Integer getScalingAdjustment() {
        return ;
    }
    
    
The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.

Parameters:
scalingAdjustment The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.
    public void setScalingAdjustment(Integer scalingAdjustment) {
        this. = scalingAdjustment;
    }
    
    
The number associated with the specified adjustment type. A positive value 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.

Parameters:
scalingAdjustment The number associated with the specified adjustment type. A positive value adds to the current capacity and a negative value removes from the current capacity.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withScalingAdjustment(Integer scalingAdjustment) {
        this. = scalingAdjustment;
        return this;
    }

    
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.
    public Integer getCooldown() {
        return ;
    }
    
    
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.
    public void setCooldown(Integer cooldown) {
        this. = cooldown;
    }
    
    
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.

Returns a reference to this object so that method calls can be chained together.

Parameters:
cooldown The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withCooldown(Integer cooldown) {
        this. = cooldown;
        return this;
    }

    
The CloudWatch alarms related to the policy.

Returns:
The CloudWatch alarms related to the policy.
    public java.util.List<AlarmgetAlarms() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Alarm>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The CloudWatch alarms related to the policy.

Parameters:
alarms The CloudWatch alarms related to the policy.
    public void setAlarms(java.util.Collection<Alarmalarms) {
        if (alarms == null) {
            this. = null;
            return;
        }
        alarmsCopy.addAll(alarms);
        this. = alarmsCopy;
    }
    
    
The CloudWatch alarms related to the policy.

NOTE: This method appends the values to the existing list (if any). Use setAlarms(java.util.Collection) or withAlarms(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
alarms The CloudWatch alarms related to the policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withAlarms(Alarm... alarms) {
        if (getAlarms() == nullsetAlarms(new java.util.ArrayList<Alarm>(alarms.length));
        for (Alarm value : alarms) {
            getAlarms().add(value);
        }
        return this;
    }
    
    
The CloudWatch alarms related to the policy.

Returns a reference to this object so that method calls can be chained together.

Parameters:
alarms The CloudWatch alarms related to the policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ScalingPolicy withAlarms(java.util.Collection<Alarmalarms) {
        if (alarms == null) {
            this. = null;
        } else {
            alarmsCopy.addAll(alarms);
            this. = alarmsCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAutoScalingGroupName() != nullsb.append("AutoScalingGroupName: " + getAutoScalingGroupName() + ",");
        if (getPolicyName() != nullsb.append("PolicyName: " + getPolicyName() + ",");
        if (getPolicyARN() != nullsb.append("PolicyARN: " + getPolicyARN() + ",");
        if (getMinAdjustmentStep() != nullsb.append("MinAdjustmentStep: " + getMinAdjustmentStep() + ",");
        if (getAdjustmentType() != nullsb.append("AdjustmentType: " + getAdjustmentType() + ",");
        if (getScalingAdjustment() != nullsb.append("ScalingAdjustment: " + getScalingAdjustment() + ",");
        if (getCooldown() != nullsb.append("Cooldown: " + getCooldown() + ",");
        if (getAlarms() != nullsb.append("Alarms: " + getAlarms() );
        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 + ((getPolicyARN() == null) ? 0 : getPolicyARN().hashCode()); 
        hashCode = prime * hashCode + ((getMinAdjustmentStep() == null) ? 0 : getMinAdjustmentStep().hashCode()); 
        hashCode = prime * hashCode + ((getAdjustmentType() == null) ? 0 : getAdjustmentType().hashCode()); 
        hashCode = prime * hashCode + ((getScalingAdjustment() == null) ? 0 : getScalingAdjustment().hashCode()); 
        hashCode = prime * hashCode + ((getCooldown() == null) ? 0 : getCooldown().hashCode()); 
        hashCode = prime * hashCode + ((getAlarms() == null) ? 0 : getAlarms().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ScalingPolicy == falsereturn false;
        ScalingPolicy other = (ScalingPolicy)obj;
        
        if (other.getAutoScalingGroupName() == null ^ this.getAutoScalingGroupName() == nullreturn false;
        if (other.getAutoScalingGroupName() != null && other.getAutoScalingGroupName().equals(this.getAutoScalingGroupName()) == falsereturn false
        if (other.getPolicyName() == null ^ this.getPolicyName() == nullreturn false;
        if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == falsereturn false
        if (other.getPolicyARN() == null ^ this.getPolicyARN() == nullreturn false;
        if (other.getPolicyARN() != null && other.getPolicyARN().equals(this.getPolicyARN()) == falsereturn false
        if (other.getMinAdjustmentStep() == null ^ this.getMinAdjustmentStep() == nullreturn false;
        if (other.getMinAdjustmentStep() != null && other.getMinAdjustmentStep().equals(this.getMinAdjustmentStep()) == falsereturn false
        if (other.getAdjustmentType() == null ^ this.getAdjustmentType() == nullreturn false;
        if (other.getAdjustmentType() != null && other.getAdjustmentType().equals(this.getAdjustmentType()) == falsereturn false
        if (other.getScalingAdjustment() == null ^ this.getScalingAdjustment() == nullreturn false;
        if (other.getScalingAdjustment() != null && other.getScalingAdjustment().equals(this.getScalingAdjustment()) == falsereturn false
        if (other.getCooldown() == null ^ this.getCooldown() == nullreturn false;
        if (other.getCooldown() != null && other.getCooldown().equals(this.getCooldown()) == falsereturn false
        if (other.getAlarms() == null ^ this.getAlarms() == nullreturn false;
        if (other.getAlarms() != null && other.getAlarms().equals(this.getAlarms()) == falsereturn false
        return true;
    }
    
    @Override
    public ScalingPolicy clone() {
        try {
            return (ScalingPolicysuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X