software.amazon.awssdk.services.applicationautoscaling.model.TargetTrackingMetricStat Maven / Gradle / Ivy
Show all versions of applicationautoscaling Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.applicationautoscaling.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* 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.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TargetTrackingMetricStat implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField METRIC_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Metric")
.getter(getter(TargetTrackingMetricStat::metric)).setter(setter(Builder::metric))
.constructor(TargetTrackingMetric::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metric").build()).build();
private static final SdkField STAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Stat")
.getter(getter(TargetTrackingMetricStat::stat)).setter(setter(Builder::stat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Stat").build()).build();
private static final SdkField UNIT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Unit")
.getter(getter(TargetTrackingMetricStat::unit)).setter(setter(Builder::unit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Unit").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRIC_FIELD, STAT_FIELD,
UNIT_FIELD));
private static final long serialVersionUID = 1L;
private final TargetTrackingMetric metric;
private final String stat;
private final String unit;
private TargetTrackingMetricStat(BuilderImpl builder) {
this.metric = builder.metric;
this.stat = builder.stat;
this.unit = builder.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.
*
*
* @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 final TargetTrackingMetric metric() {
return 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
.
*
*
* @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 final String stat() {
return 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.
*
*
* @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 final String unit() {
return unit;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(metric());
hashCode = 31 * hashCode + Objects.hashCode(stat());
hashCode = 31 * hashCode + Objects.hashCode(unit());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TargetTrackingMetricStat)) {
return false;
}
TargetTrackingMetricStat other = (TargetTrackingMetricStat) obj;
return Objects.equals(metric(), other.metric()) && Objects.equals(stat(), other.stat())
&& Objects.equals(unit(), other.unit());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("TargetTrackingMetricStat").add("Metric", metric()).add("Stat", stat()).add("Unit", unit())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Metric":
return Optional.ofNullable(clazz.cast(metric()));
case "Stat":
return Optional.ofNullable(clazz.cast(stat()));
case "Unit":
return Optional.ofNullable(clazz.cast(unit()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function