All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmsForMetricRequest Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.5.20
Show newest version
/*
 * Copyright 2013-2018 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.cloudwatch.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class DescribeAlarmsForMetricRequest extends CloudWatchRequest implements
        ToCopyableBuilder {
    private final String metricName;

    private final String namespace;

    private final String statistic;

    private final String extendedStatistic;

    private final List dimensions;

    private final Integer period;

    private final String unit;

    private DescribeAlarmsForMetricRequest(BuilderImpl builder) {
        super(builder);
        this.metricName = builder.metricName;
        this.namespace = builder.namespace;
        this.statistic = builder.statistic;
        this.extendedStatistic = builder.extendedStatistic;
        this.dimensions = builder.dimensions;
        this.period = builder.period;
        this.unit = builder.unit;
    }

    /**
     * 

* The name of the metric. *

* * @return The name of the metric. */ public String metricName() { return metricName; } /** *

* The namespace of the metric. *

* * @return The namespace of the metric. */ public String namespace() { return namespace; } /** *

* The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #statistic} will * return {@link Statistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statisticAsString}. *

* * @return The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. * @see Statistic */ public Statistic statistic() { return Statistic.fromValue(statistic); } /** *

* The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #statistic} will * return {@link Statistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statisticAsString}. *

* * @return The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. * @see Statistic */ public String statisticAsString() { return statistic; } /** *

* The percentile statistic for the metric. Specify a value between p0.0 and p100. *

* * @return The percentile statistic for the metric. Specify a value between p0.0 and p100. */ public String extendedStatistic() { return extendedStatistic; } /** *

* The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in * order for the call to succeed. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The dimensions associated with the metric. If the metric has any associated dimensions, you must specify * them in order for the call to succeed. */ public List dimensions() { return dimensions; } /** *

* The period, in seconds, over which the statistic is applied. *

* * @return The period, in seconds, over which the statistic is applied. */ public Integer period() { return period; } /** *

* The unit for the metric. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return * {@link StandardUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #unitAsString}. *

* * @return The unit for the metric. * @see StandardUnit */ public StandardUnit unit() { return StandardUnit.fromValue(unit); } /** *

* The unit for the metric. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return * {@link StandardUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #unitAsString}. *

* * @return The unit for the metric. * @see StandardUnit */ public String unitAsString() { return unit; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(metricName()); hashCode = 31 * hashCode + Objects.hashCode(namespace()); hashCode = 31 * hashCode + Objects.hashCode(statisticAsString()); hashCode = 31 * hashCode + Objects.hashCode(extendedStatistic()); hashCode = 31 * hashCode + Objects.hashCode(dimensions()); hashCode = 31 * hashCode + Objects.hashCode(period()); hashCode = 31 * hashCode + Objects.hashCode(unitAsString()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DescribeAlarmsForMetricRequest)) { return false; } DescribeAlarmsForMetricRequest other = (DescribeAlarmsForMetricRequest) obj; return Objects.equals(metricName(), other.metricName()) && Objects.equals(namespace(), other.namespace()) && Objects.equals(statisticAsString(), other.statisticAsString()) && Objects.equals(extendedStatistic(), other.extendedStatistic()) && Objects.equals(dimensions(), other.dimensions()) && Objects.equals(period(), other.period()) && Objects.equals(unitAsString(), other.unitAsString()); } @Override public String toString() { return ToString.builder("DescribeAlarmsForMetricRequest").add("MetricName", metricName()).add("Namespace", namespace()) .add("Statistic", statisticAsString()).add("ExtendedStatistic", extendedStatistic()) .add("Dimensions", dimensions()).add("Period", period()).add("Unit", unitAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "MetricName": return Optional.ofNullable(clazz.cast(metricName())); case "Namespace": return Optional.ofNullable(clazz.cast(namespace())); case "Statistic": return Optional.ofNullable(clazz.cast(statisticAsString())); case "ExtendedStatistic": return Optional.ofNullable(clazz.cast(extendedStatistic())); case "Dimensions": return Optional.ofNullable(clazz.cast(dimensions())); case "Period": return Optional.ofNullable(clazz.cast(period())); case "Unit": return Optional.ofNullable(clazz.cast(unitAsString())); default: return Optional.empty(); } } public interface Builder extends CloudWatchRequest.Builder, CopyableBuilder { /** *

* The name of the metric. *

* * @param metricName * The name of the metric. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricName(String metricName); /** *

* The namespace of the metric. *

* * @param namespace * The namespace of the metric. * @return Returns a reference to this object so that method calls can be chained together. */ Builder namespace(String namespace); /** *

* The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. *

* * @param statistic * The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. * @see Statistic * @return Returns a reference to this object so that method calls can be chained together. * @see Statistic */ Builder statistic(String statistic); /** *

* The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. *

* * @param statistic * The statistic for the metric, other than percentiles. For percentile statistics, use * ExtendedStatistics. * @see Statistic * @return Returns a reference to this object so that method calls can be chained together. * @see Statistic */ Builder statistic(Statistic statistic); /** *

* The percentile statistic for the metric. Specify a value between p0.0 and p100. *

* * @param extendedStatistic * The percentile statistic for the metric. Specify a value between p0.0 and p100. * @return Returns a reference to this object so that method calls can be chained together. */ Builder extendedStatistic(String extendedStatistic); /** *

* The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them * in order for the call to succeed. *

* * @param dimensions * The dimensions associated with the metric. If the metric has any associated dimensions, you must * specify them in order for the call to succeed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dimensions(Collection dimensions); /** *

* The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them * in order for the call to succeed. *

* * @param dimensions * The dimensions associated with the metric. If the metric has any associated dimensions, you must * specify them in order for the call to succeed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dimensions(Dimension... dimensions); /** *

* The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them * in order for the call to succeed. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #dimensions(List)}. * * @param dimensions * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #dimensions(List) */ Builder dimensions(Consumer... dimensions); /** *

* The period, in seconds, over which the statistic is applied. *

* * @param period * The period, in seconds, over which the statistic is applied. * @return Returns a reference to this object so that method calls can be chained together. */ Builder period(Integer period); /** *

* The unit for the metric. *

* * @param unit * The unit for the metric. * @see StandardUnit * @return Returns a reference to this object so that method calls can be chained together. * @see StandardUnit */ Builder unit(String unit); /** *

* The unit for the metric. *

* * @param unit * The unit for the metric. * @see StandardUnit * @return Returns a reference to this object so that method calls can be chained together. * @see StandardUnit */ Builder unit(StandardUnit unit); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CloudWatchRequest.BuilderImpl implements Builder { private String metricName; private String namespace; private String statistic; private String extendedStatistic; private List dimensions = DefaultSdkAutoConstructList.getInstance(); private Integer period; private String unit; private BuilderImpl() { } private BuilderImpl(DescribeAlarmsForMetricRequest model) { super(model); metricName(model.metricName); namespace(model.namespace); statistic(model.statistic); extendedStatistic(model.extendedStatistic); dimensions(model.dimensions); period(model.period); unit(model.unit); } public final String getMetricName() { return metricName; } @Override public final Builder metricName(String metricName) { this.metricName = metricName; return this; } public final void setMetricName(String metricName) { this.metricName = metricName; } public final String getNamespace() { return namespace; } @Override public final Builder namespace(String namespace) { this.namespace = namespace; return this; } public final void setNamespace(String namespace) { this.namespace = namespace; } public final String getStatistic() { return statistic; } @Override public final Builder statistic(String statistic) { this.statistic = statistic; return this; } @Override public final Builder statistic(Statistic statistic) { this.statistic(statistic.toString()); return this; } public final void setStatistic(String statistic) { this.statistic = statistic; } public final String getExtendedStatistic() { return extendedStatistic; } @Override public final Builder extendedStatistic(String extendedStatistic) { this.extendedStatistic = extendedStatistic; return this; } public final void setExtendedStatistic(String extendedStatistic) { this.extendedStatistic = extendedStatistic; } public final Collection getDimensions() { return dimensions != null ? dimensions.stream().map(Dimension::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder dimensions(Collection dimensions) { this.dimensions = DimensionsCopier.copy(dimensions); return this; } @Override @SafeVarargs public final Builder dimensions(Dimension... dimensions) { dimensions(Arrays.asList(dimensions)); return this; } @Override @SafeVarargs public final Builder dimensions(Consumer... dimensions) { dimensions(Stream.of(dimensions).map(c -> Dimension.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setDimensions(Collection dimensions) { this.dimensions = DimensionsCopier.copyFromBuilder(dimensions); } public final Integer getPeriod() { return period; } @Override public final Builder period(Integer period) { this.period = period; return this; } public final void setPeriod(Integer period) { this.period = period; } public final String getUnit() { return unit; } @Override public final Builder unit(String unit) { this.unit = unit; return this; } @Override public final Builder unit(StandardUnit unit) { this.unit(unit.toString()); return this; } public final void setUnit(String unit) { this.unit = unit; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public DescribeAlarmsForMetricRequest build() { return new DescribeAlarmsForMetricRequest(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy