/* * 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.autoscaling.model; import java.io.Serializable; import javax.annotation.Generated; /** *

* This structure specifies the metrics and target utilization settings for a predictive scaling policy. *

*

* You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair * instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric * pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the * scaling metric. *

*

* Example *

* *

* For information about using custom metrics with predictive scaling, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User * Guide. *

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

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify * the target utilization as the optimal average request or message count per instance during any one-minute * interval. *

*
*/ private Double targetValue; /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling * metric and load metric to use. *

*/ private PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification; /** *

* The predefined scaling metric specification. *

*/ private PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification; /** *

* The predefined load metric specification. *

*/ private PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification; /** *

* The customized scaling metric specification. *

*/ private PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification; /** *

* The customized load metric specification. *

*/ private PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification; /** *

* The customized capacity metric specification. *

*/ private PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification; /** *

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify * the target utilization as the optimal average request or message count per instance during any one-minute * interval. *

*
* * @param targetValue * Specifies the target utilization.

*

* Some metrics are based on a count instead of a percentage, such as the request count for an Application * Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these * metrics, specify the target utilization as the optimal average request or message count per instance * during any one-minute interval. *

*/ public void setTargetValue(Double targetValue) { this.targetValue = targetValue; } /** *

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify * the target utilization as the optimal average request or message count per instance during any one-minute * interval. *

*
* * @return Specifies the target utilization.

*

* Some metrics are based on a count instead of a percentage, such as the request count for an Application * Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these * metrics, specify the target utilization as the optimal average request or message count per instance * during any one-minute interval. *

*/ public Double getTargetValue() { return this.targetValue; } /** *

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify * the target utilization as the optimal average request or message count per instance during any one-minute * interval. *

*
* * @param targetValue * Specifies the target utilization.

*

* Some metrics are based on a count instead of a percentage, such as the request count for an Application * Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these * metrics, specify the target utilization as the optimal average request or message count per instance * during any one-minute interval. *

* @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withTargetValue(Double targetValue) { setTargetValue(targetValue); return this; } /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling * metric and load metric to use. *

* * @param predefinedMetricPairSpecification * The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. */ public void setPredefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification) { this.predefinedMetricPairSpecification = predefinedMetricPairSpecification; } /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling * metric and load metric to use. *

* * @return The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. */ public PredictiveScalingPredefinedMetricPair getPredefinedMetricPairSpecification() { return this.predefinedMetricPairSpecification; } /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling * metric and load metric to use. *

* * @param predefinedMetricPairSpecification * The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withPredefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification) { setPredefinedMetricPairSpecification(predefinedMetricPairSpecification); return this; } /** *

* The predefined scaling metric specification. *

* * @param predefinedScalingMetricSpecification * The predefined scaling metric specification. */ public void setPredefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification) { this.predefinedScalingMetricSpecification = predefinedScalingMetricSpecification; } /** *

* The predefined scaling metric specification. *

* * @return The predefined scaling metric specification. */ public PredictiveScalingPredefinedScalingMetric getPredefinedScalingMetricSpecification() { return this.predefinedScalingMetricSpecification; } /** *

* The predefined scaling metric specification. *

* * @param predefinedScalingMetricSpecification * The predefined scaling metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withPredefinedScalingMetricSpecification( PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification) { setPredefinedScalingMetricSpecification(predefinedScalingMetricSpecification); return this; } /** *

* The predefined load metric specification. *

* * @param predefinedLoadMetricSpecification * The predefined load metric specification. */ public void setPredefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification) { this.predefinedLoadMetricSpecification = predefinedLoadMetricSpecification; } /** *

* The predefined load metric specification. *

* * @return The predefined load metric specification. */ public PredictiveScalingPredefinedLoadMetric getPredefinedLoadMetricSpecification() { return this.predefinedLoadMetricSpecification; } /** *

* The predefined load metric specification. *

* * @param predefinedLoadMetricSpecification * The predefined load metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withPredefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification) { setPredefinedLoadMetricSpecification(predefinedLoadMetricSpecification); return this; } /** *

* The customized scaling metric specification. *

* * @param customizedScalingMetricSpecification * The customized scaling metric specification. */ public void setCustomizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification) { this.customizedScalingMetricSpecification = customizedScalingMetricSpecification; } /** *

* The customized scaling metric specification. *

* * @return The customized scaling metric specification. */ public PredictiveScalingCustomizedScalingMetric getCustomizedScalingMetricSpecification() { return this.customizedScalingMetricSpecification; } /** *

* The customized scaling metric specification. *

* * @param customizedScalingMetricSpecification * The customized scaling metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withCustomizedScalingMetricSpecification( PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification) { setCustomizedScalingMetricSpecification(customizedScalingMetricSpecification); return this; } /** *

* The customized load metric specification. *

* * @param customizedLoadMetricSpecification * The customized load metric specification. */ public void setCustomizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification) { this.customizedLoadMetricSpecification = customizedLoadMetricSpecification; } /** *

* The customized load metric specification. *

* * @return The customized load metric specification. */ public PredictiveScalingCustomizedLoadMetric getCustomizedLoadMetricSpecification() { return this.customizedLoadMetricSpecification; } /** *

* The customized load metric specification. *

* * @param customizedLoadMetricSpecification * The customized load metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withCustomizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification) { setCustomizedLoadMetricSpecification(customizedLoadMetricSpecification); return this; } /** *

* The customized capacity metric specification. *

* * @param customizedCapacityMetricSpecification * The customized capacity metric specification. */ public void setCustomizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification) { this.customizedCapacityMetricSpecification = customizedCapacityMetricSpecification; } /** *

* The customized capacity metric specification. *

* * @return The customized capacity metric specification. */ public PredictiveScalingCustomizedCapacityMetric getCustomizedCapacityMetricSpecification() { return this.customizedCapacityMetricSpecification; } /** *

* The customized capacity metric specification. *

* * @param customizedCapacityMetricSpecification * The customized capacity metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ public PredictiveScalingMetricSpecification withCustomizedCapacityMetricSpecification( PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification) { setCustomizedCapacityMetricSpecification(customizedCapacityMetricSpecification); 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 (getTargetValue() != null) sb.append("TargetValue: ").append(getTargetValue()).append(","); if (getPredefinedMetricPairSpecification() != null) sb.append("PredefinedMetricPairSpecification: ").append(getPredefinedMetricPairSpecification()).append(","); if (getPredefinedScalingMetricSpecification() != null) sb.append("PredefinedScalingMetricSpecification: ").append(getPredefinedScalingMetricSpecification()).append(","); if (getPredefinedLoadMetricSpecification() != null) sb.append("PredefinedLoadMetricSpecification: ").append(getPredefinedLoadMetricSpecification()).append(","); if (getCustomizedScalingMetricSpecification() != null) sb.append("CustomizedScalingMetricSpecification: ").append(getCustomizedScalingMetricSpecification()).append(","); if (getCustomizedLoadMetricSpecification() != null) sb.append("CustomizedLoadMetricSpecification: ").append(getCustomizedLoadMetricSpecification()).append(","); if (getCustomizedCapacityMetricSpecification() != null) sb.append("CustomizedCapacityMetricSpecification: ").append(getCustomizedCapacityMetricSpecification()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PredictiveScalingMetricSpecification == false) return false; PredictiveScalingMetricSpecification other = (PredictiveScalingMetricSpecification) obj; if (other.getTargetValue() == null ^ this.getTargetValue() == null) return false; if (other.getTargetValue() != null && other.getTargetValue().equals(this.getTargetValue()) == false) return false; if (other.getPredefinedMetricPairSpecification() == null ^ this.getPredefinedMetricPairSpecification() == null) return false; if (other.getPredefinedMetricPairSpecification() != null && other.getPredefinedMetricPairSpecification().equals(this.getPredefinedMetricPairSpecification()) == false) return false; if (other.getPredefinedScalingMetricSpecification() == null ^ this.getPredefinedScalingMetricSpecification() == null) return false; if (other.getPredefinedScalingMetricSpecification() != null && other.getPredefinedScalingMetricSpecification().equals(this.getPredefinedScalingMetricSpecification()) == false) return false; if (other.getPredefinedLoadMetricSpecification() == null ^ this.getPredefinedLoadMetricSpecification() == null) return false; if (other.getPredefinedLoadMetricSpecification() != null && other.getPredefinedLoadMetricSpecification().equals(this.getPredefinedLoadMetricSpecification()) == false) return false; if (other.getCustomizedScalingMetricSpecification() == null ^ this.getCustomizedScalingMetricSpecification() == null) return false; if (other.getCustomizedScalingMetricSpecification() != null && other.getCustomizedScalingMetricSpecification().equals(this.getCustomizedScalingMetricSpecification()) == false) return false; if (other.getCustomizedLoadMetricSpecification() == null ^ this.getCustomizedLoadMetricSpecification() == null) return false; if (other.getCustomizedLoadMetricSpecification() != null && other.getCustomizedLoadMetricSpecification().equals(this.getCustomizedLoadMetricSpecification()) == false) return false; if (other.getCustomizedCapacityMetricSpecification() == null ^ this.getCustomizedCapacityMetricSpecification() == null) return false; if (other.getCustomizedCapacityMetricSpecification() != null && other.getCustomizedCapacityMetricSpecification().equals(this.getCustomizedCapacityMetricSpecification()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTargetValue() == null) ? 0 : getTargetValue().hashCode()); hashCode = prime * hashCode + ((getPredefinedMetricPairSpecification() == null) ? 0 : getPredefinedMetricPairSpecification().hashCode()); hashCode = prime * hashCode + ((getPredefinedScalingMetricSpecification() == null) ? 0 : getPredefinedScalingMetricSpecification().hashCode()); hashCode = prime * hashCode + ((getPredefinedLoadMetricSpecification() == null) ? 0 : getPredefinedLoadMetricSpecification().hashCode()); hashCode = prime * hashCode + ((getCustomizedScalingMetricSpecification() == null) ? 0 : getCustomizedScalingMetricSpecification().hashCode()); hashCode = prime * hashCode + ((getCustomizedLoadMetricSpecification() == null) ? 0 : getCustomizedLoadMetricSpecification().hashCode()); hashCode = prime * hashCode + ((getCustomizedCapacityMetricSpecification() == null) ? 0 : getCustomizedCapacityMetricSpecification().hashCode()); return hashCode; } @Override public PredictiveScalingMetricSpecification clone() { try { return (PredictiveScalingMetricSpecification) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }