
software.amazon.awssdk.services.cloudwatch.model.GetMetricStatisticsRequest Maven / Gradle / Ivy
/*
* 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.time.Instant;
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.runtime.TypeConverter;
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 GetMetricStatisticsRequest extends CloudWatchRequest implements
ToCopyableBuilder {
private final String namespace;
private final String metricName;
private final List dimensions;
private final Instant startTime;
private final Instant endTime;
private final Integer period;
private final List statistics;
private final List extendedStatistics;
private final String unit;
private GetMetricStatisticsRequest(BuilderImpl builder) {
super(builder);
this.namespace = builder.namespace;
this.metricName = builder.metricName;
this.dimensions = builder.dimensions;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.period = builder.period;
this.statistics = builder.statistics;
this.extendedStatistics = builder.extendedStatistics;
this.unit = builder.unit;
}
/**
*
* The namespace of the metric, with or without spaces.
*
*
* @return The namespace of the metric, with or without spaces.
*/
public String namespace() {
return namespace;
}
/**
*
* The name of the metric, with or without spaces.
*
*
* @return The name of the metric, with or without spaces.
*/
public String metricName() {
return metricName;
}
/**
*
* The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension.
* CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of
* dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that
* were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about specifying
* dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension.
* CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination
* of dimensions was not published, you can't retrieve statistics for it. You must specify the same
* dimensions that were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about
* specifying dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
*/
public List dimensions() {
return dimensions;
}
/**
*
* The time stamp that determines the first data point to return. Start times are evaluated relative to the time
* that CloudWatch receives the request.
*
*
* The value specified is inclusive; results include data points with the specified time stamp. The time stamp must
* be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
*
*
* CloudWatch rounds the specified time stamp as follows:
*
*
* -
*
* Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down
* to 12:32:00.
*
*
* -
*
* Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34
* is rounded down to 12:30:00.
*
*
* -
*
* Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is
* rounded down to 12:00:00.
*
*
*
*
* If you set Period
to 5, 10, or 30, the start time of your request is rounded down to the nearest
* time that corresponds to even 5-, 10-, or 30-second divisions of a minute. For example, if you make a query at
* (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is rounded down and you
* receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of data, using
* a period of 5 seconds, you receive data timestamped between 15:02:15 and 15:07:15.
*
*
* @return The time stamp that determines the first data point to return. Start times are evaluated relative to the
* time that CloudWatch receives the request.
*
* The value specified is inclusive; results include data points with the specified time stamp. The time
* stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
*
*
* CloudWatch rounds the specified time stamp as follows:
*
*
* -
*
* Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is
* rounded down to 12:32:00.
*
*
* -
*
* Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example,
* 12:32:34 is rounded down to 12:30:00.
*
*
* -
*
* Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example,
* 12:32:34 is rounded down to 12:00:00.
*
*
*
*
* If you set Period
to 5, 10, or 30, the start time of your request is rounded down to the
* nearest time that corresponds to even 5-, 10-, or 30-second divisions of a minute. For example, if you
* make a query at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is
* rounded down and you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the
* previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped between 15:02:15
* and 15:07:15.
*/
public Instant startTime() {
return startTime;
}
/**
*
* The time stamp that determines the last data point to return.
*
*
* The value specified is exclusive; results include data points up to the specified time stamp. The time stamp must
* be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
*
*
* @return The time stamp that determines the last data point to return.
*
* The value specified is exclusive; results include data points up to the specified time stamp. The time
* stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
*/
public Instant endTime() {
return endTime;
}
/**
*
* The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as
* short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at
* intervals of less than one minute, the period can be 1, 5, 10, 30, 60, or any multiple of 60. High-resolution
* metrics are those metrics stored by a PutMetricData
call that includes a
* StorageResolution
of 1 second.
*
*
* If the StartTime
parameter specifies a time stamp that is greater than 3 hours ago, you must specify
* the period as follows or no data points in that time range is returned:
*
*
* -
*
* Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
*
*
* -
*
* Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
*
*
* -
*
* Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
*
*
*
*
* @return The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period
* can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that
* are collected at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, or any multiple
* of 60. High-resolution metrics are those metrics stored by a PutMetricData
call that
* includes a StorageResolution
of 1 second.
*
* If the StartTime
parameter specifies a time stamp that is greater than 3 hours ago, you must
* specify the period as follows or no data points in that time range is returned:
*
*
* -
*
* Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
*
*
* -
*
* Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
*
*
* -
*
* Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
*
*
*/
public Integer period() {
return period;
}
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify either
* Statistics
or ExtendedStatistics
, but not both.
*/
public List statistics() {
return TypeConverter.convert(statistics, Statistic::fromValue);
}
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify either
* Statistics
or ExtendedStatistics
, but not both.
*/
public List statisticsAsStrings() {
return statistics;
}
/**
*
* The percentile statistics. Specify values between p0.0 and p100. When calling GetMetricStatistics
,
* you must specify either Statistics
or ExtendedStatistics
, but not both.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The percentile statistics. Specify values between p0.0 and p100. When calling
* GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*/
public List extendedStatistics() {
return extendedStatistics;
}
/**
*
* The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all units
* being returned. If you specify only a unit that the metric does not report, the results of the call are null.
*
*
* 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 a given metric. Metrics may be reported in multiple units. Not supplying a unit results in
* all units being returned. If you specify only a unit that the metric does not report, the results of the
* call are null.
* @see StandardUnit
*/
public StandardUnit unit() {
return StandardUnit.fromValue(unit);
}
/**
*
* The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all units
* being returned. If you specify only a unit that the metric does not report, the results of the call are null.
*
*
* 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 a given metric. Metrics may be reported in multiple units. Not supplying a unit results in
* all units being returned. If you specify only a unit that the metric does not report, the results of the
* call are null.
* @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 extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(namespace());
hashCode = 31 * hashCode + Objects.hashCode(metricName());
hashCode = 31 * hashCode + Objects.hashCode(dimensions());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(period());
hashCode = 31 * hashCode + Objects.hashCode(statisticsAsStrings());
hashCode = 31 * hashCode + Objects.hashCode(extendedStatistics());
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 GetMetricStatisticsRequest)) {
return false;
}
GetMetricStatisticsRequest other = (GetMetricStatisticsRequest) obj;
return Objects.equals(namespace(), other.namespace()) && Objects.equals(metricName(), other.metricName())
&& Objects.equals(dimensions(), other.dimensions()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime()) && Objects.equals(period(), other.period())
&& Objects.equals(statisticsAsStrings(), other.statisticsAsStrings())
&& Objects.equals(extendedStatistics(), other.extendedStatistics())
&& Objects.equals(unitAsString(), other.unitAsString());
}
@Override
public String toString() {
return ToString.builder("GetMetricStatisticsRequest").add("Namespace", namespace()).add("MetricName", metricName())
.add("Dimensions", dimensions()).add("StartTime", startTime()).add("EndTime", endTime()).add("Period", period())
.add("Statistics", statisticsAsStrings()).add("ExtendedStatistics", extendedStatistics())
.add("Unit", unitAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "MetricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "Dimensions":
return Optional.ofNullable(clazz.cast(dimensions()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "Period":
return Optional.ofNullable(clazz.cast(period()));
case "Statistics":
return Optional.ofNullable(clazz.cast(statisticsAsStrings()));
case "ExtendedStatistics":
return Optional.ofNullable(clazz.cast(extendedStatistics()));
case "Unit":
return Optional.ofNullable(clazz.cast(unitAsString()));
default:
return Optional.empty();
}
}
public interface Builder extends CloudWatchRequest.Builder, CopyableBuilder {
/**
*
* The namespace of the metric, with or without spaces.
*
*
* @param namespace
* The namespace of the metric, with or without spaces.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder namespace(String namespace);
/**
*
* The name of the metric, with or without spaces.
*
*
* @param metricName
* The name of the metric, with or without spaces.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder metricName(String metricName);
/**
*
* The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension.
* CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of
* dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that
* were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about specifying
* dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
*
*
* @param dimensions
* The dimensions. If the metric contains multiple dimensions, you must include a value for each
* dimension. CloudWatch treats each unique combination of dimensions as a separate metric. If a specific
* combination of dimensions was not published, you can't retrieve statistics for it. You must specify
* the same dimensions that were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about
* specifying dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dimensions(Collection dimensions);
/**
*
* The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension.
* CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of
* dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that
* were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about specifying
* dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
*
*
* @param dimensions
* The dimensions. If the metric contains multiple dimensions, you must include a value for each
* dimension. CloudWatch treats each unique combination of dimensions as a separate metric. If a specific
* combination of dimensions was not published, you can't retrieve statistics for it. You must specify
* the same dimensions that were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about
* specifying dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dimensions(Dimension... dimensions);
/**
*
* The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension.
* CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of
* dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that
* were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide. For more information about specifying
* dimensions, see Publishing
* Metrics in the Amazon CloudWatch User Guide.
*
* 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 time stamp that determines the first data point to return. Start times are evaluated relative to the time
* that CloudWatch receives the request.
*
*
* The value specified is inclusive; results include data points with the specified time stamp. The time stamp
* must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
*
*
* CloudWatch rounds the specified time stamp as follows:
*
*
* -
*
* Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded
* down to 12:32:00.
*
*
* -
*
* Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example,
* 12:32:34 is rounded down to 12:30:00.
*
*
* -
*
* Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34
* is rounded down to 12:00:00.
*
*
*
*
* If you set Period
to 5, 10, or 30, the start time of your request is rounded down to the nearest
* time that corresponds to even 5-, 10-, or 30-second divisions of a minute. For example, if you make a query
* at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is rounded down and
* you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of
* data, using a period of 5 seconds, you receive data timestamped between 15:02:15 and 15:07:15.
*
*
* @param startTime
* The time stamp that determines the first data point to return. Start times are evaluated relative to
* the time that CloudWatch receives the request.
*
* The value specified is inclusive; results include data points with the specified time stamp. The time
* stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
*
*
* CloudWatch rounds the specified time stamp as follows:
*
*
* -
*
* Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is
* rounded down to 12:32:00.
*
*
* -
*
* Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For
* example, 12:32:34 is rounded down to 12:30:00.
*
*
* -
*
* Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example,
* 12:32:34 is rounded down to 12:00:00.
*
*
*
*
* If you set Period
to 5, 10, or 30, the start time of your request is rounded down to the
* nearest time that corresponds to even 5-, 10-, or 30-second divisions of a minute. For example, if you
* make a query at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request
* is rounded down and you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for
* the previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped between
* 15:02:15 and 15:07:15.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startTime(Instant startTime);
/**
*
* The time stamp that determines the last data point to return.
*
*
* The value specified is exclusive; results include data points up to the specified time stamp. The time stamp
* must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
*
*
* @param endTime
* The time stamp that determines the last data point to return.
*
* The value specified is exclusive; results include data points up to the specified time stamp. The time
* stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endTime(Instant endTime);
/**
*
* The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can
* be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are
* collected at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, or any multiple of 60.
* High-resolution metrics are those metrics stored by a PutMetricData
call that includes a
* StorageResolution
of 1 second.
*
*
* If the StartTime
parameter specifies a time stamp that is greater than 3 hours ago, you must
* specify the period as follows or no data points in that time range is returned:
*
*
* -
*
* Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
*
*
* -
*
* Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
*
*
* -
*
* Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
*
*
*
*
* @param period
* The granularity, in seconds, of the returned data points. For metrics with regular resolution, a
* period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution
* metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 30, 60,
* or any multiple of 60. High-resolution metrics are those metrics stored by a
* PutMetricData
call that includes a StorageResolution
of 1 second.
*
* If the StartTime
parameter specifies a time stamp that is greater than 3 hours ago, you
* must specify the period as follows or no data points in that time range is returned:
*
*
* -
*
* Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
*
*
* -
*
* Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
*
*
* -
*
* Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder period(Integer period);
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param statistics
* The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify
* either Statistics
or ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statisticsWithStrings(Collection statistics);
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param statistics
* The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify
* either Statistics
or ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statisticsWithStrings(String... statistics);
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param statistics
* The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify
* either Statistics
or ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statistics(Collection statistics);
/**
*
* The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics
.
* When calling GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param statistics
* The metric statistics, other than percentile. For percentile statistics, use
* ExtendedStatistics
. When calling GetMetricStatistics
, you must specify
* either Statistics
or ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statistics(Statistic... statistics);
/**
*
* The percentile statistics. Specify values between p0.0 and p100. When calling
* GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param extendedStatistics
* The percentile statistics. Specify values between p0.0 and p100. When calling
* GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder extendedStatistics(Collection extendedStatistics);
/**
*
* The percentile statistics. Specify values between p0.0 and p100. When calling
* GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
*
*
* @param extendedStatistics
* The percentile statistics. Specify values between p0.0 and p100. When calling
* GetMetricStatistics
, you must specify either Statistics
or
* ExtendedStatistics
, but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder extendedStatistics(String... extendedStatistics);
/**
*
* The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all
* units being returned. If you specify only a unit that the metric does not report, the results of the call are
* null.
*
*
* @param unit
* The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results
* in all units being returned. If you specify only a unit that the metric does not report, the results
* of the call are null.
* @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 a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all
* units being returned. If you specify only a unit that the metric does not report, the results of the call are
* null.
*
*
* @param unit
* The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results
* in all units being returned. If you specify only a unit that the metric does not report, the results
* of the call are null.
* @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 namespace;
private String metricName;
private List dimensions = DefaultSdkAutoConstructList.getInstance();
private Instant startTime;
private Instant endTime;
private Integer period;
private List statistics = DefaultSdkAutoConstructList.getInstance();
private List extendedStatistics = DefaultSdkAutoConstructList.getInstance();
private String unit;
private BuilderImpl() {
}
private BuilderImpl(GetMetricStatisticsRequest model) {
super(model);
namespace(model.namespace);
metricName(model.metricName);
dimensions(model.dimensions);
startTime(model.startTime);
endTime(model.endTime);
period(model.period);
statisticsWithStrings(model.statistics);
extendedStatistics(model.extendedStatistics);
unit(model.unit);
}
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 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 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 Instant getStartTime() {
return startTime;
}
@Override
public final Builder startTime(Instant startTime) {
this.startTime = startTime;
return this;
}
public final void setStartTime(Instant startTime) {
this.startTime = startTime;
}
public final Instant getEndTime() {
return endTime;
}
@Override
public final Builder endTime(Instant endTime) {
this.endTime = endTime;
return this;
}
public final void setEndTime(Instant endTime) {
this.endTime = endTime;
}
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 Collection getStatistics() {
return statistics;
}
@Override
public final Builder statisticsWithStrings(Collection statistics) {
this.statistics = StatisticsCopier.copy(statistics);
return this;
}
@Override
@SafeVarargs
public final Builder statisticsWithStrings(String... statistics) {
statisticsWithStrings(Arrays.asList(statistics));
return this;
}
@Override
public final Builder statistics(Collection statistics) {
this.statistics = StatisticsCopier.copyEnumToString(statistics);
return this;
}
@Override
@SafeVarargs
public final Builder statistics(Statistic... statistics) {
statistics(Arrays.asList(statistics));
return this;
}
public final void setStatistics(Collection statistics) {
this.statistics = StatisticsCopier.copy(statistics);
}
public final Collection getExtendedStatistics() {
return extendedStatistics;
}
@Override
public final Builder extendedStatistics(Collection extendedStatistics) {
this.extendedStatistics = ExtendedStatisticsCopier.copy(extendedStatistics);
return this;
}
@Override
@SafeVarargs
public final Builder extendedStatistics(String... extendedStatistics) {
extendedStatistics(Arrays.asList(extendedStatistics));
return this;
}
public final void setExtendedStatistics(Collection extendedStatistics) {
this.extendedStatistics = ExtendedStatisticsCopier.copy(extendedStatistics);
}
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 GetMetricStatisticsRequest build() {
return new GetMetricStatisticsRequest(this);
}
}
}