/* * 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 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 TargetTrackingMetricStat implements Serializable, Cloneable { /** *

* The metric to use. *

*/ 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 metric for scaling is Average. *

*/ private String stat; /** *

* 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 metric to use. *

* * @param metric * The metric to use. */ public void setMetric(Metric metric) { this.metric = metric; } /** *

* The metric to use. *

* * @return The metric to use. */ public Metric getMetric() { return this.metric; } /** *

* The metric to use. *

* * @param metric * The metric to use. * @return Returns a reference to this object so that method calls can be chained together. */ public TargetTrackingMetricStat 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 metric for scaling is Average. *

* * @param 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 metric for scaling is Average. */ 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 metric for scaling is Average. *

* * @return 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 metric for scaling is Average. */ 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 metric for scaling is Average. *

* * @param 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 metric for scaling is Average. * @return Returns a reference to this object so that method calls can be chained together. */ public TargetTrackingMetricStat 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 TargetTrackingMetricStat 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 TargetTrackingMetricStat == false) return false; TargetTrackingMetricStat other = (TargetTrackingMetricStat) 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 TargetTrackingMetricStat clone() { try { return (TargetTrackingMetricStat) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }