software.amazon.awssdk.services.sagemakermetrics.model.MetricQuery Maven / Gradle / Ivy
Show all versions of sagemakermetrics 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.sagemakermetrics.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.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;
/**
*
* Specifies a query to retrieve training metrics from SageMaker.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MetricQuery implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField METRIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MetricName").getter(getter(MetricQuery::metricName)).setter(setter(Builder::metricName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricName").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceArn").getter(getter(MetricQuery::resourceArn)).setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();
private static final SdkField METRIC_STAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MetricStat").getter(getter(MetricQuery::metricStatAsString)).setter(setter(Builder::metricStat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricStat").build()).build();
private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Period")
.getter(getter(MetricQuery::periodAsString)).setter(setter(Builder::period))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Period").build()).build();
private static final SdkField X_AXIS_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("XAxisType").getter(getter(MetricQuery::xAxisTypeAsString)).setter(setter(Builder::xAxisType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("XAxisType").build()).build();
private static final SdkField START_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Start")
.getter(getter(MetricQuery::start)).setter(setter(Builder::start))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Start").build()).build();
private static final SdkField END_FIELD = SdkField. builder(MarshallingType.LONG).memberName("End")
.getter(getter(MetricQuery::end)).setter(setter(Builder::end))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("End").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRIC_NAME_FIELD,
RESOURCE_ARN_FIELD, METRIC_STAT_FIELD, PERIOD_FIELD, X_AXIS_TYPE_FIELD, START_FIELD, END_FIELD));
private static final long serialVersionUID = 1L;
private final String metricName;
private final String resourceArn;
private final String metricStat;
private final String period;
private final String xAxisType;
private final Long start;
private final Long end;
private MetricQuery(BuilderImpl builder) {
this.metricName = builder.metricName;
this.resourceArn = builder.resourceArn;
this.metricStat = builder.metricStat;
this.period = builder.period;
this.xAxisType = builder.xAxisType;
this.start = builder.start;
this.end = builder.end;
}
/**
*
* The name of the metric to retrieve.
*
*
* @return The name of the metric to retrieve.
*/
public final String metricName() {
return metricName;
}
/**
*
* The ARN of the SageMaker resource to retrieve metrics for.
*
*
* @return The ARN of the SageMaker resource to retrieve metrics for.
*/
public final String resourceArn() {
return resourceArn;
}
/**
*
* The metrics stat type of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricStat} will
* return {@link MetricStatistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #metricStatAsString}.
*
*
* @return The metrics stat type of metrics to retrieve.
* @see MetricStatistic
*/
public final MetricStatistic metricStat() {
return MetricStatistic.fromValue(metricStat);
}
/**
*
* The metrics stat type of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricStat} will
* return {@link MetricStatistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #metricStatAsString}.
*
*
* @return The metrics stat type of metrics to retrieve.
* @see MetricStatistic
*/
public final String metricStatAsString() {
return metricStat;
}
/**
*
* The time period of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link Period#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The time period of metrics to retrieve.
* @see Period
*/
public final Period period() {
return Period.fromValue(period);
}
/**
*
* The time period of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link Period#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The time period of metrics to retrieve.
* @see Period
*/
public final String periodAsString() {
return period;
}
/**
*
* The x-axis type of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #xAxisType} will
* return {@link XAxisType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #xAxisTypeAsString}.
*
*
* @return The x-axis type of metrics to retrieve.
* @see XAxisType
*/
public final XAxisType xAxisType() {
return XAxisType.fromValue(xAxisType);
}
/**
*
* The x-axis type of metrics to retrieve.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #xAxisType} will
* return {@link XAxisType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #xAxisTypeAsString}.
*
*
* @return The x-axis type of metrics to retrieve.
* @see XAxisType
*/
public final String xAxisTypeAsString() {
return xAxisType;
}
/**
*
* The start time of metrics to retrieve.
*
*
* @return The start time of metrics to retrieve.
*/
public final Long start() {
return start;
}
/**
*
* The end time of metrics to retrieve.
*
*
* @return The end time of metrics to retrieve.
*/
public final Long end() {
return end;
}
@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(metricName());
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(metricStatAsString());
hashCode = 31 * hashCode + Objects.hashCode(periodAsString());
hashCode = 31 * hashCode + Objects.hashCode(xAxisTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(start());
hashCode = 31 * hashCode + Objects.hashCode(end());
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 MetricQuery)) {
return false;
}
MetricQuery other = (MetricQuery) obj;
return Objects.equals(metricName(), other.metricName()) && Objects.equals(resourceArn(), other.resourceArn())
&& Objects.equals(metricStatAsString(), other.metricStatAsString())
&& Objects.equals(periodAsString(), other.periodAsString())
&& Objects.equals(xAxisTypeAsString(), other.xAxisTypeAsString()) && Objects.equals(start(), other.start())
&& Objects.equals(end(), other.end());
}
/**
* 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("MetricQuery").add("MetricName", metricName()).add("ResourceArn", resourceArn())
.add("MetricStat", metricStatAsString()).add("Period", periodAsString()).add("XAxisType", xAxisTypeAsString())
.add("Start", start()).add("End", end()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MetricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "ResourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "MetricStat":
return Optional.ofNullable(clazz.cast(metricStatAsString()));
case "Period":
return Optional.ofNullable(clazz.cast(periodAsString()));
case "XAxisType":
return Optional.ofNullable(clazz.cast(xAxisTypeAsString()));
case "Start":
return Optional.ofNullable(clazz.cast(start()));
case "End":
return Optional.ofNullable(clazz.cast(end()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function