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.opsworks.model;
 

Describes a load-based auto scaling upscaling or downscaling threshold configuration, which specifies when AWS OpsWorks starts or stops load-based instances.

 
 public class AutoScalingThresholds implements SerializableCloneable {

    
The number of instances to add or remove when the load exceeds a threshold.
 
     private Integer instanceCount;

    
The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.

Constraints:
Range: 1 - 100

 
     private Integer thresholdsWaitTime;

    
The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.

Constraints:
Range: 1 - 100

 
     private Integer ignoreMetricsTime;

    
The CPU utilization threshold, as a percent of the available CPU.
 
     private Double cpuThreshold;

    
The memory utilization threshold, as a percent of the available memory.
 
     private Double memoryThreshold;

    
The load threshold. For more information about how load is computed, see Load (computing).
 
     private Double loadThreshold;

    
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>
 
The number of instances to add or remove when the load exceeds a threshold.

Returns:
The number of instances to add or remove when the load exceeds a threshold.
 
     public Integer getInstanceCount() {
         return ;
     }
    
    
The number of instances to add or remove when the load exceeds a threshold.

Parameters:
instanceCount The number of instances to add or remove when the load exceeds a threshold.
    public void setInstanceCount(Integer instanceCount) {
        this. = instanceCount;
    }
    
    
The number of instances to add or remove when the load exceeds a threshold.

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

Parameters:
instanceCount The number of instances to add or remove when the load exceeds a threshold.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withInstanceCount(Integer instanceCount) {
        this. = instanceCount;
        return this;
    }

    
The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.

Constraints:
Range: 1 - 100

Returns:
The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.
    public Integer getThresholdsWaitTime() {
        return ;
    }
    
    
The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.

Constraints:
Range: 1 - 100

Parameters:
thresholdsWaitTime The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.
    public void setThresholdsWaitTime(Integer thresholdsWaitTime) {
        this. = thresholdsWaitTime;
    }
    
    
The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.

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

Constraints:
Range: 1 - 100

Parameters:
thresholdsWaitTime The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withThresholdsWaitTime(Integer thresholdsWaitTime) {
        this. = thresholdsWaitTime;
        return this;
    }

    
The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.

Constraints:
Range: 1 - 100

Returns:
The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.
    public Integer getIgnoreMetricsTime() {
        return ;
    }
    
    
The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.

Constraints:
Range: 1 - 100

Parameters:
ignoreMetricsTime The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.
    public void setIgnoreMetricsTime(Integer ignoreMetricsTime) {
        this. = ignoreMetricsTime;
    }
    
    
The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.

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

Constraints:
Range: 1 - 100

Parameters:
ignoreMetricsTime The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. IgnoreMetricsTime allows you to direct AWS OpsWorks to suppress scaling events long enough to get the new instances online.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withIgnoreMetricsTime(Integer ignoreMetricsTime) {
        this. = ignoreMetricsTime;
        return this;
    }

    
The CPU utilization threshold, as a percent of the available CPU.

Returns:
The CPU utilization threshold, as a percent of the available CPU.
    public Double getCpuThreshold() {
        return ;
    }
    
    
The CPU utilization threshold, as a percent of the available CPU.

Parameters:
cpuThreshold The CPU utilization threshold, as a percent of the available CPU.
    public void setCpuThreshold(Double cpuThreshold) {
        this. = cpuThreshold;
    }
    
    
The CPU utilization threshold, as a percent of the available CPU.

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

Parameters:
cpuThreshold The CPU utilization threshold, as a percent of the available CPU.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withCpuThreshold(Double cpuThreshold) {
        this. = cpuThreshold;
        return this;
    }

    
The memory utilization threshold, as a percent of the available memory.

Returns:
The memory utilization threshold, as a percent of the available memory.
    public Double getMemoryThreshold() {
        return ;
    }
    
    
The memory utilization threshold, as a percent of the available memory.

Parameters:
memoryThreshold The memory utilization threshold, as a percent of the available memory.
    public void setMemoryThreshold(Double memoryThreshold) {
        this. = memoryThreshold;
    }
    
    
The memory utilization threshold, as a percent of the available memory.

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

Parameters:
memoryThreshold The memory utilization threshold, as a percent of the available memory.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withMemoryThreshold(Double memoryThreshold) {
        this. = memoryThreshold;
        return this;
    }

    
The load threshold. For more information about how load is computed, see Load (computing).

Returns:
The load threshold. For more information about how load is computed, see Load (computing).
    public Double getLoadThreshold() {
        return ;
    }
    
    
The load threshold. For more information about how load is computed, see Load (computing).

Parameters:
loadThreshold The load threshold. For more information about how load is computed, see Load (computing).
    public void setLoadThreshold(Double loadThreshold) {
        this. = loadThreshold;
    }
    
    
The load threshold. For more information about how load is computed, see Load (computing).

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

Parameters:
loadThreshold The load threshold. For more information about how load is computed, see Load (computing).
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withLoadThreshold(Double loadThreshold) {
        this. = loadThreshold;
        return this;
    }

    
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>

Returns:
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>
    public java.util.List<StringgetAlarms() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>

Parameters:
alarms Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>
    public void setAlarms(java.util.Collection<Stringalarms) {
        if (alarms == null) {
            this. = null;
            return;
        }
        alarmsCopy.addAll(alarms);
        this. = alarmsCopy;
    }
    
    
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>

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 Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>
Returns:
A reference to this updated object so that method calls can be chained together.
    public AutoScalingThresholds withAlarms(String... alarms) {
        if (getAlarms() == nullsetAlarms(new java.util.ArrayList<String>(alarms.length));
        for (String value : alarms) {
            getAlarms().add(value);
        }
        return this;
    }
    
    
Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>

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

Parameters:
alarms Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack. <note>To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. You can either have AWS OpsWorks update the role for you when you first use this feature or you can edit the role manually. For more information, see Allowing AWS OpsWorks to Act on Your Behalf.</note>
Returns:
A reference to this updated object so that method calls can be chained together.
        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 (getInstanceCount() != nullsb.append("InstanceCount: " + getInstanceCount() + ",");
        if (getThresholdsWaitTime() != nullsb.append("ThresholdsWaitTime: " + getThresholdsWaitTime() + ",");
        if (getIgnoreMetricsTime() != nullsb.append("IgnoreMetricsTime: " + getIgnoreMetricsTime() + ",");
        if (getCpuThreshold() != nullsb.append("CpuThreshold: " + getCpuThreshold() + ",");
        if (getMemoryThreshold() != nullsb.append("MemoryThreshold: " + getMemoryThreshold() + ",");
        if (getLoadThreshold() != nullsb.append("LoadThreshold: " + getLoadThreshold() + ",");
        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 + ((getInstanceCount() == null) ? 0 : getInstanceCount().hashCode()); 
        hashCode = prime * hashCode + ((getThresholdsWaitTime() == null) ? 0 : getThresholdsWaitTime().hashCode()); 
        hashCode = prime * hashCode + ((getIgnoreMetricsTime() == null) ? 0 : getIgnoreMetricsTime().hashCode()); 
        hashCode = prime * hashCode + ((getCpuThreshold() == null) ? 0 : getCpuThreshold().hashCode()); 
        hashCode = prime * hashCode + ((getMemoryThreshold() == null) ? 0 : getMemoryThreshold().hashCode()); 
        hashCode = prime * hashCode + ((getLoadThreshold() == null) ? 0 : getLoadThreshold().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 AutoScalingThresholds == falsereturn false;
        AutoScalingThresholds other = (AutoScalingThresholds)obj;
        
        if (other.getInstanceCount() == null ^ this.getInstanceCount() == nullreturn false;
        if (other.getInstanceCount() != null && other.getInstanceCount().equals(this.getInstanceCount()) == falsereturn false
        if (other.getThresholdsWaitTime() == null ^ this.getThresholdsWaitTime() == nullreturn false;
        if (other.getThresholdsWaitTime() != null && other.getThresholdsWaitTime().equals(this.getThresholdsWaitTime()) == falsereturn false
        if (other.getIgnoreMetricsTime() == null ^ this.getIgnoreMetricsTime() == nullreturn false;
        if (other.getIgnoreMetricsTime() != null && other.getIgnoreMetricsTime().equals(this.getIgnoreMetricsTime()) == falsereturn false
        if (other.getCpuThreshold() == null ^ this.getCpuThreshold() == nullreturn false;
        if (other.getCpuThreshold() != null && other.getCpuThreshold().equals(this.getCpuThreshold()) == falsereturn false
        if (other.getMemoryThreshold() == null ^ this.getMemoryThreshold() == nullreturn false;
        if (other.getMemoryThreshold() != null && other.getMemoryThreshold().equals(this.getMemoryThreshold()) == falsereturn false
        if (other.getLoadThreshold() == null ^ this.getLoadThreshold() == nullreturn false;
        if (other.getLoadThreshold() != null && other.getLoadThreshold().equals(this.getLoadThreshold()) == 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 AutoScalingThresholds clone() {
        try {
            return (AutoScalingThresholdssuper.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