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

software.amazon.awssdk.services.cloudwatch.model.MetricDataQuery 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.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* This structure indicates the metric data to return, and whether this call is just retrieving a batch set of data for * one metric, or is performing a math expression on metric data. A single GetMetricData call can include * up to 100 MetricDataQuery structures. *

*/ @Generated("software.amazon.awssdk:codegen") public final class MetricDataQuery implements ToCopyableBuilder { private final String id; private final MetricStat metricStat; private final String expression; private final String label; private final Boolean returnData; private MetricDataQuery(BuilderImpl builder) { this.id = builder.id; this.metricStat = builder.metricStat; this.expression = builder.expression; this.label = builder.label; this.returnData = builder.returnData; } /** *

* A short name used to tie this structure to the results in the response. This name must be unique within a single * call to GetMetricData. If you are performing math expressions on this set of data, this name * represents that data and can serve as a variable in the mathematical expression. The valid characters are * letters, numbers, and underscore. The first character must be a lowercase letter. *

* * @return A short name used to tie this structure to the results in the response. This name must be unique within a * single call to GetMetricData. If you are performing math expressions on this set of data, * this name represents that data and can serve as a variable in the mathematical expression. The valid * characters are letters, numbers, and underscore. The first character must be a lowercase letter. */ public String id() { return id; } /** *

* The metric to be returned, along with statistics, period, and units. Use this parameter only if this structure is * performing a data retrieval and not performing a math expression on the returned data. *

*

* Within one MetricDataQuery structure, you must specify either Expression or MetricStat * but not both. *

* * @return The metric to be returned, along with statistics, period, and units. Use this parameter only if this * structure is performing a data retrieval and not performing a math expression on the returned data.

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. */ public MetricStat metricStat() { return metricStat; } /** *

* The math expression to be performed on the returned data, if this structure is performing a math expression. For * more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide. *

*

* Within one MetricDataQuery structure, you must specify either Expression or MetricStat * but not both. *

* * @return The math expression to be performed on the returned data, if this structure is performing a math * expression. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide.

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. */ public String expression() { return expression; } /** *

* A human-readable label for this metric or expression. This is especially useful if this is an expression, so that * you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the * label is shown. If Label is omitted, CloudWatch generates a default. *

* * @return A human-readable label for this metric or expression. This is especially useful if this is an expression, * so that you know what the value represents. If the metric or expression is shown in a CloudWatch * dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default. */ public String label() { return label; } /** *

* Indicates whether to return the time stamps and raw data values of this metric. If you are performing this call * just to do math expressions and do not also need the raw data returned, you can specify False. If * you omit this, the default of True is used. *

* * @return Indicates whether to return the time stamps and raw data values of this metric. If you are performing * this call just to do math expressions and do not also need the raw data returned, you can specify * False. If you omit this, the default of True is used. */ public Boolean returnData() { return returnData; } @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(id()); hashCode = 31 * hashCode + Objects.hashCode(metricStat()); hashCode = 31 * hashCode + Objects.hashCode(expression()); hashCode = 31 * hashCode + Objects.hashCode(label()); hashCode = 31 * hashCode + Objects.hashCode(returnData()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof MetricDataQuery)) { return false; } MetricDataQuery other = (MetricDataQuery) obj; return Objects.equals(id(), other.id()) && Objects.equals(metricStat(), other.metricStat()) && Objects.equals(expression(), other.expression()) && Objects.equals(label(), other.label()) && Objects.equals(returnData(), other.returnData()); } @Override public String toString() { return ToString.builder("MetricDataQuery").add("Id", id()).add("MetricStat", metricStat()) .add("Expression", expression()).add("Label", label()).add("ReturnData", returnData()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "MetricStat": return Optional.ofNullable(clazz.cast(metricStat())); case "Expression": return Optional.ofNullable(clazz.cast(expression())); case "Label": return Optional.ofNullable(clazz.cast(label())); case "ReturnData": return Optional.ofNullable(clazz.cast(returnData())); default: return Optional.empty(); } } public interface Builder extends CopyableBuilder { /** *

* A short name used to tie this structure to the results in the response. This name must be unique within a * single call to GetMetricData. If you are performing math expressions on this set of data, this * name represents that data and can serve as a variable in the mathematical expression. The valid characters * are letters, numbers, and underscore. The first character must be a lowercase letter. *

* * @param id * A short name used to tie this structure to the results in the response. This name must be unique * within a single call to GetMetricData. If you are performing math expressions on this set * of data, this name represents that data and can serve as a variable in the mathematical expression. * The valid characters are letters, numbers, and underscore. The first character must be a lowercase * letter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* The metric to be returned, along with statistics, period, and units. Use this parameter only if this * structure is performing a data retrieval and not performing a math expression on the returned data. *

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. *

* * @param metricStat * The metric to be returned, along with statistics, period, and units. Use this parameter only if this * structure is performing a data retrieval and not performing a math expression on the returned * data.

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricStat(MetricStat metricStat); /** *

* The metric to be returned, along with statistics, period, and units. Use this parameter only if this * structure is performing a data retrieval and not performing a math expression on the returned data. *

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. *

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

* The math expression to be performed on the returned data, if this structure is performing a math expression. * For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide. *

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. *

* * @param expression * The math expression to be performed on the returned data, if this structure is performing a math * expression. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide.

*

* Within one MetricDataQuery structure, you must specify either Expression or * MetricStat but not both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expression(String expression); /** *

* A human-readable label for this metric or expression. This is especially useful if this is an expression, so * that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard * widget, the label is shown. If Label is omitted, CloudWatch generates a default. *

* * @param label * A human-readable label for this metric or expression. This is especially useful if this is an * expression, so that you know what the value represents. If the metric or expression is shown in a * CloudWatch dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default. * @return Returns a reference to this object so that method calls can be chained together. */ Builder label(String label); /** *

* Indicates whether to return the time stamps and raw data values of this metric. If you are performing this * call just to do math expressions and do not also need the raw data returned, you can specify * False. If you omit this, the default of True is used. *

* * @param returnData * Indicates whether to return the time stamps and raw data values of this metric. If you are performing * this call just to do math expressions and do not also need the raw data returned, you can specify * False. If you omit this, the default of True is used. * @return Returns a reference to this object so that method calls can be chained together. */ Builder returnData(Boolean returnData); } static final class BuilderImpl implements Builder { private String id; private MetricStat metricStat; private String expression; private String label; private Boolean returnData; private BuilderImpl() { } private BuilderImpl(MetricDataQuery model) { id(model.id); metricStat(model.metricStat); expression(model.expression); label(model.label); returnData(model.returnData); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } public final MetricStat.Builder getMetricStat() { return metricStat != null ? metricStat.toBuilder() : null; } @Override public final Builder metricStat(MetricStat metricStat) { this.metricStat = metricStat; return this; } public final void setMetricStat(MetricStat.BuilderImpl metricStat) { this.metricStat = metricStat != null ? metricStat.build() : null; } public final String getExpression() { return expression; } @Override public final Builder expression(String expression) { this.expression = expression; return this; } public final void setExpression(String expression) { this.expression = expression; } public final String getLabel() { return label; } @Override public final Builder label(String label) { this.label = label; return this; } public final void setLabel(String label) { this.label = label; } public final Boolean getReturnData() { return returnData; } @Override public final Builder returnData(Boolean returnData) { this.returnData = returnData; return this; } public final void setReturnData(Boolean returnData) { this.returnData = returnData; } @Override public MetricDataQuery build() { return new MetricDataQuery(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy