
software.amazon.awssdk.services.sagemaker.model.Image Maven / Gradle / Ivy
/*
* 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.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;
/**
*
* A SageMaker image. A SageMaker image represents a set of container images that are derived from a common base
* container image. Each of these container images is represented by a SageMaker ImageVersion
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Image implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(Image::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(Image::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DisplayName").getter(getter(Image::displayName)).setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailureReason").getter(getter(Image::failureReason)).setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final SdkField IMAGE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ImageArn").getter(getter(Image::imageArn)).setter(setter(Builder::imageArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImageArn").build()).build();
private static final SdkField IMAGE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ImageName").getter(getter(Image::imageName)).setter(setter(Builder::imageName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImageName").build()).build();
private static final SdkField IMAGE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ImageStatus").getter(getter(Image::imageStatusAsString)).setter(setter(Builder::imageStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImageStatus").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedTime").getter(getter(Image::lastModifiedTime)).setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATION_TIME_FIELD,
DESCRIPTION_FIELD, DISPLAY_NAME_FIELD, FAILURE_REASON_FIELD, IMAGE_ARN_FIELD, IMAGE_NAME_FIELD, IMAGE_STATUS_FIELD,
LAST_MODIFIED_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final Instant creationTime;
private final String description;
private final String displayName;
private final String failureReason;
private final String imageArn;
private final String imageName;
private final String imageStatus;
private final Instant lastModifiedTime;
private Image(BuilderImpl builder) {
this.creationTime = builder.creationTime;
this.description = builder.description;
this.displayName = builder.displayName;
this.failureReason = builder.failureReason;
this.imageArn = builder.imageArn;
this.imageName = builder.imageName;
this.imageStatus = builder.imageStatus;
this.lastModifiedTime = builder.lastModifiedTime;
}
/**
*
* When the image was created.
*
*
* @return When the image was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The description of the image.
*
*
* @return The description of the image.
*/
public final String description() {
return description;
}
/**
*
* The name of the image as displayed.
*
*
* @return The name of the image as displayed.
*/
public final String displayName() {
return displayName;
}
/**
*
* When a create, update, or delete operation fails, the reason for the failure.
*
*
* @return When a create, update, or delete operation fails, the reason for the failure.
*/
public final String failureReason() {
return failureReason;
}
/**
*
* The Amazon Resource Name (ARN) of the image.
*
*
* @return The Amazon Resource Name (ARN) of the image.
*/
public final String imageArn() {
return imageArn;
}
/**
*
* The name of the image.
*
*
* @return The name of the image.
*/
public final String imageName() {
return imageName;
}
/**
*
* The status of the image.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #imageStatus} will
* return {@link ImageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #imageStatusAsString}.
*
*
* @return The status of the image.
* @see ImageStatus
*/
public final ImageStatus imageStatus() {
return ImageStatus.fromValue(imageStatus);
}
/**
*
* The status of the image.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #imageStatus} will
* return {@link ImageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #imageStatusAsString}.
*
*
* @return The status of the image.
* @see ImageStatus
*/
public final String imageStatusAsString() {
return imageStatus;
}
/**
*
* When the image was last modified.
*
*
* @return When the image was last modified.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
@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(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(imageArn());
hashCode = 31 * hashCode + Objects.hashCode(imageName());
hashCode = 31 * hashCode + Objects.hashCode(imageStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
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 Image)) {
return false;
}
Image other = (Image) obj;
return Objects.equals(creationTime(), other.creationTime()) && Objects.equals(description(), other.description())
&& Objects.equals(displayName(), other.displayName()) && Objects.equals(failureReason(), other.failureReason())
&& Objects.equals(imageArn(), other.imageArn()) && Objects.equals(imageName(), other.imageName())
&& Objects.equals(imageStatusAsString(), other.imageStatusAsString())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime());
}
/**
* 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("Image").add("CreationTime", creationTime()).add("Description", description())
.add("DisplayName", displayName()).add("FailureReason", failureReason()).add("ImageArn", imageArn())
.add("ImageName", imageName()).add("ImageStatus", imageStatusAsString())
.add("LastModifiedTime", lastModifiedTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "ImageArn":
return Optional.ofNullable(clazz.cast(imageArn()));
case "ImageName":
return Optional.ofNullable(clazz.cast(imageName()));
case "ImageStatus":
return Optional.ofNullable(clazz.cast(imageStatusAsString()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function