/* * Copyright 2018-2023 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.applicationautoscaling.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Represents a step adjustment for a StepScalingPolicyConfiguration. Describes an adjustment based on the difference between the value of the * aggregated CloudWatch metric and the breach threshold that you've defined for the alarm. *

*

* For the following examples, suppose that you have an alarm with a breach threshold of 50: *

* *

* There are a few rules for the step adjustments for your step policy: *

* * * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class StepAdjustment implements Serializable, Cloneable, StructuredPojo { /** *

* The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the * threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than the threshold plus * the lower bound). A null value indicates negative infinity. *

*/ private Double metricIntervalLowerBound; /** *

* The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the * upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the threshold plus the upper * bound). A null value indicates positive infinity. *

*

* The upper bound must be greater than the lower bound. *

*/ private Double metricIntervalUpperBound; /** *

* 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. For exact capacity, you must specify a * non-negative value. *

*/ private Integer scalingAdjustment; /** *

* The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the * threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than the threshold plus * the lower bound). A null value indicates negative infinity. *

* * @param metricIntervalLowerBound * The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or * equal to the threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than * the threshold plus the lower bound). A null value indicates negative infinity. */ public void setMetricIntervalLowerBound(Double metricIntervalLowerBound) { this.metricIntervalLowerBound = metricIntervalLowerBound; } /** *

* The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the * threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than the threshold plus * the lower bound). A null value indicates negative infinity. *

* * @return The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or * equal to the threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than * the threshold plus the lower bound). A null value indicates negative infinity. */ public Double getMetricIntervalLowerBound() { return this.metricIntervalLowerBound; } /** *

* The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the * threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than the threshold plus * the lower bound). A null value indicates negative infinity. *

* * @param metricIntervalLowerBound * The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or * equal to the threshold plus the lower bound). Otherwise, it's exclusive (the metric must be greater than * the threshold plus the lower bound). A null value indicates negative infinity. * @return Returns a reference to this object so that method calls can be chained together. */ public StepAdjustment withMetricIntervalLowerBound(Double metricIntervalLowerBound) { setMetricIntervalLowerBound(metricIntervalLowerBound); return this; } /** *

* The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the * upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the threshold plus the upper * bound). A null value indicates positive infinity. *

*

* The upper bound must be greater than the lower bound. *

* * @param metricIntervalUpperBound * The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the upper bound is exclusive (the metric must be less than the * threshold plus the upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the * threshold plus the upper bound). A null value indicates positive infinity.

*

* The upper bound must be greater than the lower bound. */ public void setMetricIntervalUpperBound(Double metricIntervalUpperBound) { this.metricIntervalUpperBound = metricIntervalUpperBound; } /** *

* The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the * upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the threshold plus the upper * bound). A null value indicates positive infinity. *

*

* The upper bound must be greater than the lower bound. *

* * @return The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the upper bound is exclusive (the metric must be less than the * threshold plus the upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the * threshold plus the upper bound). A null value indicates positive infinity.

*

* The upper bound must be greater than the lower bound. */ public Double getMetricIntervalUpperBound() { return this.metricIntervalUpperBound; } /** *

* The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is * above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the * upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the threshold plus the upper * bound). A null value indicates positive infinity. *

*

* The upper bound must be greater than the lower bound. *

* * @param metricIntervalUpperBound * The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric * value is above the breach threshold, the upper bound is exclusive (the metric must be less than the * threshold plus the upper bound). Otherwise, it's inclusive (the metric must be less than or equal to the * threshold plus the upper bound). A null value indicates positive infinity.

*

* The upper bound must be greater than the lower bound. * @return Returns a reference to this object so that method calls can be chained together. */ public StepAdjustment withMetricIntervalUpperBound(Double metricIntervalUpperBound) { setMetricIntervalUpperBound(metricIntervalUpperBound); return this; } /** *

* 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. For exact capacity, you must specify a * non-negative value. *

* * @param 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. For exact capacity, you must specify a * non-negative value. */ public void setScalingAdjustment(Integer scalingAdjustment) { this.scalingAdjustment = 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. For exact capacity, you must specify a * non-negative value. *

* * @return 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. For exact capacity, you must * specify a non-negative value. */ public Integer getScalingAdjustment() { return this.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. For exact capacity, you must specify a * non-negative value. *

* * @param 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. For exact capacity, you must specify a * non-negative value. * @return Returns a reference to this object so that method calls can be chained together. */ public StepAdjustment withScalingAdjustment(Integer scalingAdjustment) { setScalingAdjustment(scalingAdjustment); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMetricIntervalLowerBound() != null) sb.append("MetricIntervalLowerBound: ").append(getMetricIntervalLowerBound()).append(","); if (getMetricIntervalUpperBound() != null) sb.append("MetricIntervalUpperBound: ").append(getMetricIntervalUpperBound()).append(","); if (getScalingAdjustment() != null) sb.append("ScalingAdjustment: ").append(getScalingAdjustment()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof StepAdjustment == false) return false; StepAdjustment other = (StepAdjustment) obj; if (other.getMetricIntervalLowerBound() == null ^ this.getMetricIntervalLowerBound() == null) return false; if (other.getMetricIntervalLowerBound() != null && other.getMetricIntervalLowerBound().equals(this.getMetricIntervalLowerBound()) == false) return false; if (other.getMetricIntervalUpperBound() == null ^ this.getMetricIntervalUpperBound() == null) return false; if (other.getMetricIntervalUpperBound() != null && other.getMetricIntervalUpperBound().equals(this.getMetricIntervalUpperBound()) == false) return false; if (other.getScalingAdjustment() == null ^ this.getScalingAdjustment() == null) return false; if (other.getScalingAdjustment() != null && other.getScalingAdjustment().equals(this.getScalingAdjustment()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetricIntervalLowerBound() == null) ? 0 : getMetricIntervalLowerBound().hashCode()); hashCode = prime * hashCode + ((getMetricIntervalUpperBound() == null) ? 0 : getMetricIntervalUpperBound().hashCode()); hashCode = prime * hashCode + ((getScalingAdjustment() == null) ? 0 : getScalingAdjustment().hashCode()); return hashCode; } @Override public StepAdjustment clone() { try { return (StepAdjustment) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.applicationautoscaling.model.transform.StepAdjustmentMarshaller.getInstance().marshall(this, protocolMarshaller); } }