com.amazonaws.services.opsworks.model.AutoScalingThresholds Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
 * Copyright 2010-2016 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;
import java.io.Serializable;
/**
 * 
 * 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 Serializable, Cloneable {
    /**
     * 
     * 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.
     * 
     */
    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.
     * 
     */
    private Integer ignoreMetricsTime;
    /**
     * 
     * The CPU utilization threshold, as a percent of the available CPU. A value
     * of -1 disables the threshold.
     * 
     */
    private Double cpuThreshold;
    /**
     * 
     * The memory utilization threshold, as a percent of the available memory. A
     * value of -1 disables the threshold.
     * 
     */
    private Double memoryThreshold;
    /**
     * 
     * The load threshold. A value of -1 disables the 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.
     * 
     * 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. 
     */
    private com.amazonaws.internal.SdkInternalList alarms;
    /**
     * 
     * The number of instances to add or remove when the load exceeds a
     * threshold.
     * 
     * 
     * @param instanceCount
     *        The number of instances to add or remove when the load exceeds a
     *        threshold.
     */
    public void setInstanceCount(Integer instanceCount) {
        this.instanceCount = instanceCount;
    }
    /**
     * 
     * The number of instances to add or remove when the load exceeds a
     * threshold.
     * 
     * 
     * @return The number of instances to add or remove when the load exceeds a
     *         threshold.
     */
    public Integer getInstanceCount() {
        return this.instanceCount;
    }
    /**
     * 
     * The number of instances to add or remove when the load exceeds a
     * threshold.
     * 
     * 
     * @param instanceCount
     *        The number of instances to add or remove when the load exceeds a
     *        threshold.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withInstanceCount(Integer instanceCount) {
        setInstanceCount(instanceCount);
        return this;
    }
    /**
     * 
     * The amount of time, in minutes, that the load must exceed a threshold
     * before more instances are added or removed.
     * 
     * 
     * @param 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 = thresholdsWaitTime;
    }
    /**
     * 
     * The amount of time, in minutes, that the load must exceed a threshold
     * before more instances are added or removed.
     * 
     * 
     * @return The amount of time, in minutes, that the load must exceed a
     *         threshold before more instances are added or removed.
     */
    public Integer getThresholdsWaitTime() {
        return this.thresholdsWaitTime;
    }
    /**
     * 
     * The amount of time, in minutes, that the load must exceed a threshold
     * before more instances are added or removed.
     * 
     * 
     * @param thresholdsWaitTime
     *        The amount of time, in minutes, that the load must exceed a
     *        threshold before more instances are added or removed.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withThresholdsWaitTime(
            Integer thresholdsWaitTime) {
        setThresholdsWaitTime(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.
     * 
     * 
     * @param 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 = 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.
     * 
     * 
     * @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.
     */
    public Integer getIgnoreMetricsTime() {
        return 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.
     * 
     * 
     * @param 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.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withIgnoreMetricsTime(Integer ignoreMetricsTime) {
        setIgnoreMetricsTime(ignoreMetricsTime);
        return this;
    }
    /**
     * 
     * The CPU utilization threshold, as a percent of the available CPU. A value
     * of -1 disables the threshold.
     * 
     * 
     * @param cpuThreshold
     *        The CPU utilization threshold, as a percent of the available CPU.
     *        A value of -1 disables the threshold.
     */
    public void setCpuThreshold(Double cpuThreshold) {
        this.cpuThreshold = cpuThreshold;
    }
    /**
     * 
     * The CPU utilization threshold, as a percent of the available CPU. A value
     * of -1 disables the threshold.
     * 
     * 
     * @return The CPU utilization threshold, as a percent of the available CPU.
     *         A value of -1 disables the threshold.
     */
    public Double getCpuThreshold() {
        return this.cpuThreshold;
    }
    /**
     * 
     * The CPU utilization threshold, as a percent of the available CPU. A value
     * of -1 disables the threshold.
     * 
     * 
     * @param cpuThreshold
     *        The CPU utilization threshold, as a percent of the available CPU.
     *        A value of -1 disables the threshold.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withCpuThreshold(Double cpuThreshold) {
        setCpuThreshold(cpuThreshold);
        return this;
    }
    /**
     * 
     * The memory utilization threshold, as a percent of the available memory. A
     * value of -1 disables the threshold.
     * 
     * 
     * @param memoryThreshold
     *        The memory utilization threshold, as a percent of the available
     *        memory. A value of -1 disables the threshold.
     */
    public void setMemoryThreshold(Double memoryThreshold) {
        this.memoryThreshold = memoryThreshold;
    }
    /**
     * 
     * The memory utilization threshold, as a percent of the available memory. A
     * value of -1 disables the threshold.
     * 
     * 
     * @return The memory utilization threshold, as a percent of the available
     *         memory. A value of -1 disables the threshold.
     */
    public Double getMemoryThreshold() {
        return this.memoryThreshold;
    }
    /**
     * 
     * The memory utilization threshold, as a percent of the available memory. A
     * value of -1 disables the threshold.
     * 
     * 
     * @param memoryThreshold
     *        The memory utilization threshold, as a percent of the available
     *        memory. A value of -1 disables the threshold.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withMemoryThreshold(Double memoryThreshold) {
        setMemoryThreshold(memoryThreshold);
        return this;
    }
    /**
     * 
     * The load threshold. A value of -1 disables the threshold. For more
     * information about how load is computed, see Load
     * (computing).
     * 
     * 
     * @param loadThreshold
     *        The load threshold. A value of -1 disables the threshold. For more
     *        information about how load is computed, see Load
     *        (computing).
     */
    public void setLoadThreshold(Double loadThreshold) {
        this.loadThreshold = loadThreshold;
    }
    /**
     * 
     * The load threshold. A value of -1 disables the threshold. For more
     * information about how load is computed, see Load
     * (computing).
     * 
     * 
     * @return The load threshold. A value of -1 disables the threshold. For
     *         more information about how load is computed, see Load
     *         (computing).
     */
    public Double getLoadThreshold() {
        return this.loadThreshold;
    }
    /**
     * 
     * The load threshold. A value of -1 disables the threshold. For more
     * information about how load is computed, see Load
     * (computing).
     * 
     * 
     * @param loadThreshold
     *        The load threshold. A value of -1 disables the threshold. For more
     *        information about how load is computed, see Load
     *        (computing).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withLoadThreshold(Double loadThreshold) {
        setLoadThreshold(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.
     * 
     * 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. 
     * 
     * @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.
     *         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.
     */
    public java.util.List getAlarms() {
        if (alarms == null) {
            alarms = new com.amazonaws.internal.SdkInternalList();
        }
        return 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.
     * 
     * 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. 
     * 
     * @param 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.
     *        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.
     */
    public void setAlarms(java.util.Collection alarms) {
        if (alarms == null) {
            this.alarms = null;
            return;
        }
        this.alarms = new com.amazonaws.internal.SdkInternalList(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.
     * 
     * 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: This method appends the values to the existing list (if
     * any). Use {@link #setAlarms(java.util.Collection)} or
     * {@link #withAlarms(java.util.Collection)} if you want to override the
     * existing values.
     * 
     * 
     * @param 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.
     *        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.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withAlarms(String... alarms) {
        if (this.alarms == null) {
            setAlarms(new com.amazonaws.internal.SdkInternalList(
                    alarms.length));
        }
        for (String ele : alarms) {
            this.alarms.add(ele);
        }
        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.
     * 
     * 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. 
     * 
     * @param 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.
     *        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.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public AutoScalingThresholds withAlarms(java.util.Collection alarms) {
        setAlarms(alarms);
        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 (getInstanceCount() != null)
            sb.append("InstanceCount: " + getInstanceCount() + ",");
        if (getThresholdsWaitTime() != null)
            sb.append("ThresholdsWaitTime: " + getThresholdsWaitTime() + ",");
        if (getIgnoreMetricsTime() != null)
            sb.append("IgnoreMetricsTime: " + getIgnoreMetricsTime() + ",");
        if (getCpuThreshold() != null)
            sb.append("CpuThreshold: " + getCpuThreshold() + ",");
        if (getMemoryThreshold() != null)
            sb.append("MemoryThreshold: " + getMemoryThreshold() + ",");
        if (getLoadThreshold() != null)
            sb.append("LoadThreshold: " + getLoadThreshold() + ",");
        if (getAlarms() != null)
            sb.append("Alarms: " + getAlarms());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof AutoScalingThresholds == false)
            return false;
        AutoScalingThresholds other = (AutoScalingThresholds) obj;
        if (other.getInstanceCount() == null ^ this.getInstanceCount() == null)
            return false;
        if (other.getInstanceCount() != null
                && other.getInstanceCount().equals(this.getInstanceCount()) == false)
            return false;
        if (other.getThresholdsWaitTime() == null
                ^ this.getThresholdsWaitTime() == null)
            return false;
        if (other.getThresholdsWaitTime() != null
                && other.getThresholdsWaitTime().equals(
                        this.getThresholdsWaitTime()) == false)
            return false;
        if (other.getIgnoreMetricsTime() == null
                ^ this.getIgnoreMetricsTime() == null)
            return false;
        if (other.getIgnoreMetricsTime() != null
                && other.getIgnoreMetricsTime().equals(
                        this.getIgnoreMetricsTime()) == false)
            return false;
        if (other.getCpuThreshold() == null ^ this.getCpuThreshold() == null)
            return false;
        if (other.getCpuThreshold() != null
                && other.getCpuThreshold().equals(this.getCpuThreshold()) == false)
            return false;
        if (other.getMemoryThreshold() == null
                ^ this.getMemoryThreshold() == null)
            return false;
        if (other.getMemoryThreshold() != null
                && other.getMemoryThreshold().equals(this.getMemoryThreshold()) == false)
            return false;
        if (other.getLoadThreshold() == null ^ this.getLoadThreshold() == null)
            return false;
        if (other.getLoadThreshold() != null
                && other.getLoadThreshold().equals(this.getLoadThreshold()) == false)
            return false;
        if (other.getAlarms() == null ^ this.getAlarms() == null)
            return false;
        if (other.getAlarms() != null
                && other.getAlarms().equals(this.getAlarms()) == false)
            return false;
        return true;
    }
    @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 AutoScalingThresholds clone() {
        try {
            return (AutoScalingThresholds) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}