/* * 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 defines the CloudWatch metric to return, along with the statistic, period, and unit. *
** For more information about the CloudWatch terminology below, see Amazon CloudWatch * concepts in the Amazon CloudWatch User Guide. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class MetricStat implements Serializable, Cloneable { /** ** The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric * name, namespace, and dimensions, inspect the Metric object that is * returned by a call to ListMetrics. *
*/ private Metric metric; /** ** The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid * values, see the table in Statistics in the Amazon CloudWatch User Guide. *
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*
* The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the * MetricDatum * data type in the Amazon CloudWatch API Reference. *
*/ private String unit; /** ** The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric * name, namespace, and dimensions, inspect the Metric object that is * returned by a call to ListMetrics. *
* * @param metric * The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact * metric name, namespace, and dimensions, inspect the Metric object * that is returned by a call to ListMetrics. */ public void setMetric(Metric metric) { this.metric = metric; } /** ** The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric * name, namespace, and dimensions, inspect the Metric object that is * returned by a call to ListMetrics. *
* * @return The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact * metric name, namespace, and dimensions, inspect the Metric object * that is returned by a call to ListMetrics. */ public Metric getMetric() { return this.metric; } /** ** The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric * name, namespace, and dimensions, inspect the Metric object that is * returned by a call to ListMetrics. *
* * @param metric * The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact * metric name, namespace, and dimensions, inspect the Metric object * that is returned by a call to ListMetrics. * @return Returns a reference to this object so that method calls can be chained together. */ public MetricStat withMetric(Metric metric) { setMetric(metric); return this; } /** ** The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid * values, see the table in Statistics in the Amazon CloudWatch User Guide. *
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*/
public void setStat(String stat) {
this.stat = stat;
}
/**
*
* The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid * values, see the table in Statistics in the Amazon CloudWatch User Guide. *
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*/
public String getStat() {
return this.stat;
}
/**
*
* The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid * values, see the table in Statistics in the Amazon CloudWatch User Guide. *
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
*
* The most commonly used metrics for predictive scaling are Average
and Sum
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricStat withStat(String stat) {
setStat(stat);
return this;
}
/**
*
* The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the * MetricDatum * data type in the Amazon CloudWatch API Reference. *
* * @param unit * The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, * see the MetricDatum * data type in the Amazon CloudWatch API Reference. */ public void setUnit(String unit) { this.unit = unit; } /** ** The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the * MetricDatum * data type in the Amazon CloudWatch API Reference. *
* * @return The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, * see the * MetricDatum data type in the Amazon CloudWatch API Reference. */ public String getUnit() { return this.unit; } /** ** The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the * MetricDatum * data type in the Amazon CloudWatch API Reference. *
* * @param unit * The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, * see the MetricDatum * data type in the Amazon CloudWatch API Reference. * @return Returns a reference to this object so that method calls can be chained together. */ public MetricStat withUnit(String unit) { setUnit(unit); 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 (getMetric() != null) sb.append("Metric: ").append(getMetric()).append(","); if (getStat() != null) sb.append("Stat: ").append(getStat()).append(","); if (getUnit() != null) sb.append("Unit: ").append(getUnit()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof MetricStat == false) return false; MetricStat other = (MetricStat) obj; if (other.getMetric() == null ^ this.getMetric() == null) return false; if (other.getMetric() != null && other.getMetric().equals(this.getMetric()) == false) return false; if (other.getStat() == null ^ this.getStat() == null) return false; if (other.getStat() != null && other.getStat().equals(this.getStat()) == false) return false; if (other.getUnit() == null ^ this.getUnit() == null) return false; if (other.getUnit() != null && other.getUnit().equals(this.getUnit()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetric() == null) ? 0 : getMetric().hashCode()); hashCode = prime * hashCode + ((getStat() == null) ? 0 : getStat().hashCode()); hashCode = prime * hashCode + ((getUnit() == null) ? 0 : getUnit().hashCode()); return hashCode; } @Override public MetricStat clone() { try { return (MetricStat) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }