software.amazon.awssdk.services.sagemaker.model.MonitoringSchedule Maven / Gradle / Ivy
Show all versions of sagemaker 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.sagemaker.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A schedule for a model monitoring job. For information about model monitor, see Amazon SageMaker Model Monitor.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MonitoringSchedule implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MONITORING_SCHEDULE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MonitoringScheduleArn").getter(getter(MonitoringSchedule::monitoringScheduleArn))
.setter(setter(Builder::monitoringScheduleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringScheduleArn").build())
.build();
private static final SdkField MONITORING_SCHEDULE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MonitoringScheduleName").getter(getter(MonitoringSchedule::monitoringScheduleName))
.setter(setter(Builder::monitoringScheduleName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringScheduleName").build())
.build();
private static final SdkField MONITORING_SCHEDULE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MonitoringScheduleStatus").getter(getter(MonitoringSchedule::monitoringScheduleStatusAsString))
.setter(setter(Builder::monitoringScheduleStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringScheduleStatus").build())
.build();
private static final SdkField MONITORING_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MonitoringType").getter(getter(MonitoringSchedule::monitoringTypeAsString))
.setter(setter(Builder::monitoringType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringType").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailureReason").getter(getter(MonitoringSchedule::failureReason)).setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(MonitoringSchedule::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedTime").getter(getter(MonitoringSchedule::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final SdkField MONITORING_SCHEDULE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("MonitoringScheduleConfig")
.getter(getter(MonitoringSchedule::monitoringScheduleConfig)).setter(setter(Builder::monitoringScheduleConfig))
.constructor(MonitoringScheduleConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringScheduleConfig").build())
.build();
private static final SdkField ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointName").getter(getter(MonitoringSchedule::endpointName)).setter(setter(Builder::endpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointName").build()).build();
private static final SdkField LAST_MONITORING_EXECUTION_SUMMARY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("LastMonitoringExecutionSummary")
.getter(getter(MonitoringSchedule::lastMonitoringExecutionSummary))
.setter(setter(Builder::lastMonitoringExecutionSummary))
.constructor(MonitoringExecutionSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastMonitoringExecutionSummary")
.build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(MonitoringSchedule::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MONITORING_SCHEDULE_ARN_FIELD,
MONITORING_SCHEDULE_NAME_FIELD, MONITORING_SCHEDULE_STATUS_FIELD, MONITORING_TYPE_FIELD, FAILURE_REASON_FIELD,
CREATION_TIME_FIELD, LAST_MODIFIED_TIME_FIELD, MONITORING_SCHEDULE_CONFIG_FIELD, ENDPOINT_NAME_FIELD,
LAST_MONITORING_EXECUTION_SUMMARY_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String monitoringScheduleArn;
private final String monitoringScheduleName;
private final String monitoringScheduleStatus;
private final String monitoringType;
private final String failureReason;
private final Instant creationTime;
private final Instant lastModifiedTime;
private final MonitoringScheduleConfig monitoringScheduleConfig;
private final String endpointName;
private final MonitoringExecutionSummary lastMonitoringExecutionSummary;
private final List tags;
private MonitoringSchedule(BuilderImpl builder) {
this.monitoringScheduleArn = builder.monitoringScheduleArn;
this.monitoringScheduleName = builder.monitoringScheduleName;
this.monitoringScheduleStatus = builder.monitoringScheduleStatus;
this.monitoringType = builder.monitoringType;
this.failureReason = builder.failureReason;
this.creationTime = builder.creationTime;
this.lastModifiedTime = builder.lastModifiedTime;
this.monitoringScheduleConfig = builder.monitoringScheduleConfig;
this.endpointName = builder.endpointName;
this.lastMonitoringExecutionSummary = builder.lastMonitoringExecutionSummary;
this.tags = builder.tags;
}
/**
*
* The Amazon Resource Name (ARN) of the monitoring schedule.
*
*
* @return The Amazon Resource Name (ARN) of the monitoring schedule.
*/
public final String monitoringScheduleArn() {
return monitoringScheduleArn;
}
/**
*
* The name of the monitoring schedule.
*
*
* @return The name of the monitoring schedule.
*/
public final String monitoringScheduleName() {
return monitoringScheduleName;
}
/**
*
* The status of the monitoring schedule. This can be one of the following values.
*
*
* -
*
* PENDING
- The schedule is pending being created.
*
*
* -
*
* FAILED
- The schedule failed.
*
*
* -
*
* SCHEDULED
- The schedule was successfully created.
*
*
* -
*
* STOPPED
- The schedule was stopped.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #monitoringScheduleStatus} will return {@link ScheduleStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #monitoringScheduleStatusAsString}.
*
*
* @return The status of the monitoring schedule. This can be one of the following values.
*
* -
*
* PENDING
- The schedule is pending being created.
*
*
* -
*
* FAILED
- The schedule failed.
*
*
* -
*
* SCHEDULED
- The schedule was successfully created.
*
*
* -
*
* STOPPED
- The schedule was stopped.
*
*
* @see ScheduleStatus
*/
public final ScheduleStatus monitoringScheduleStatus() {
return ScheduleStatus.fromValue(monitoringScheduleStatus);
}
/**
*
* The status of the monitoring schedule. This can be one of the following values.
*
*
* -
*
* PENDING
- The schedule is pending being created.
*
*
* -
*
* FAILED
- The schedule failed.
*
*
* -
*
* SCHEDULED
- The schedule was successfully created.
*
*
* -
*
* STOPPED
- The schedule was stopped.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #monitoringScheduleStatus} will return {@link ScheduleStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #monitoringScheduleStatusAsString}.
*
*
* @return The status of the monitoring schedule. This can be one of the following values.
*
* -
*
* PENDING
- The schedule is pending being created.
*
*
* -
*
* FAILED
- The schedule failed.
*
*
* -
*
* SCHEDULED
- The schedule was successfully created.
*
*
* -
*
* STOPPED
- The schedule was stopped.
*
*
* @see ScheduleStatus
*/
public final String monitoringScheduleStatusAsString() {
return monitoringScheduleStatus;
}
/**
*
* The type of the monitoring job definition to schedule.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #monitoringType}
* will return {@link MonitoringType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #monitoringTypeAsString}.
*
*
* @return The type of the monitoring job definition to schedule.
* @see MonitoringType
*/
public final MonitoringType monitoringType() {
return MonitoringType.fromValue(monitoringType);
}
/**
*
* The type of the monitoring job definition to schedule.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #monitoringType}
* will return {@link MonitoringType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #monitoringTypeAsString}.
*
*
* @return The type of the monitoring job definition to schedule.
* @see MonitoringType
*/
public final String monitoringTypeAsString() {
return monitoringType;
}
/**
*
* If the monitoring schedule failed, the reason it failed.
*
*
* @return If the monitoring schedule failed, the reason it failed.
*/
public final String failureReason() {
return failureReason;
}
/**
*
* The time that the monitoring schedule was created.
*
*
* @return The time that the monitoring schedule was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The last time the monitoring schedule was changed.
*
*
* @return The last time the monitoring schedule was changed.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
* Returns the value of the MonitoringScheduleConfig property for this object.
*
* @return The value of the MonitoringScheduleConfig property for this object.
*/
public final MonitoringScheduleConfig monitoringScheduleConfig() {
return monitoringScheduleConfig;
}
/**
*
* The endpoint that hosts the model being monitored.
*
*
* @return The endpoint that hosts the model being monitored.
*/
public final String endpointName() {
return endpointName;
}
/**
* Returns the value of the LastMonitoringExecutionSummary property for this object.
*
* @return The value of the LastMonitoringExecutionSummary property for this object.
*/
public final MonitoringExecutionSummary lastMonitoringExecutionSummary() {
return lastMonitoringExecutionSummary;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* A list of the tags associated with the monitoring schedlue. For more information, see Tagging Amazon Web Services resources
* in the Amazon Web Services General Reference Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return A list of the tags associated with the monitoring schedlue. For more information, see Tagging Amazon Web Services
* resources in the Amazon Web Services General Reference Guide.
*/
public final List tags() {
return tags;
}
@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(monitoringScheduleArn());
hashCode = 31 * hashCode + Objects.hashCode(monitoringScheduleName());
hashCode = 31 * hashCode + Objects.hashCode(monitoringScheduleStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(monitoringTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(monitoringScheduleConfig());
hashCode = 31 * hashCode + Objects.hashCode(endpointName());
hashCode = 31 * hashCode + Objects.hashCode(lastMonitoringExecutionSummary());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
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 MonitoringSchedule)) {
return false;
}
MonitoringSchedule other = (MonitoringSchedule) obj;
return Objects.equals(monitoringScheduleArn(), other.monitoringScheduleArn())
&& Objects.equals(monitoringScheduleName(), other.monitoringScheduleName())
&& Objects.equals(monitoringScheduleStatusAsString(), other.monitoringScheduleStatusAsString())
&& Objects.equals(monitoringTypeAsString(), other.monitoringTypeAsString())
&& Objects.equals(failureReason(), other.failureReason()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(monitoringScheduleConfig(), other.monitoringScheduleConfig())
&& Objects.equals(endpointName(), other.endpointName())
&& Objects.equals(lastMonitoringExecutionSummary(), other.lastMonitoringExecutionSummary())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags());
}
/**
* 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("MonitoringSchedule").add("MonitoringScheduleArn", monitoringScheduleArn())
.add("MonitoringScheduleName", monitoringScheduleName())
.add("MonitoringScheduleStatus", monitoringScheduleStatusAsString())
.add("MonitoringType", monitoringTypeAsString()).add("FailureReason", failureReason())
.add("CreationTime", creationTime()).add("LastModifiedTime", lastModifiedTime())
.add("MonitoringScheduleConfig", monitoringScheduleConfig()).add("EndpointName", endpointName())
.add("LastMonitoringExecutionSummary", lastMonitoringExecutionSummary()).add("Tags", hasTags() ? tags() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MonitoringScheduleArn":
return Optional.ofNullable(clazz.cast(monitoringScheduleArn()));
case "MonitoringScheduleName":
return Optional.ofNullable(clazz.cast(monitoringScheduleName()));
case "MonitoringScheduleStatus":
return Optional.ofNullable(clazz.cast(monitoringScheduleStatusAsString()));
case "MonitoringType":
return Optional.ofNullable(clazz.cast(monitoringTypeAsString()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "MonitoringScheduleConfig":
return Optional.ofNullable(clazz.cast(monitoringScheduleConfig()));
case "EndpointName":
return Optional.ofNullable(clazz.cast(endpointName()));
case "LastMonitoringExecutionSummary":
return Optional.ofNullable(clazz.cast(lastMonitoringExecutionSummary()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function