
software.amazon.awssdk.services.sagemaker.model.NotebookInstanceSummary 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.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.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.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;
/**
*
* Provides summary information for an SageMaker notebook instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NotebookInstanceSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NOTEBOOK_INSTANCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NotebookInstanceName").getter(getter(NotebookInstanceSummary::notebookInstanceName))
.setter(setter(Builder::notebookInstanceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookInstanceName").build())
.build();
private static final SdkField NOTEBOOK_INSTANCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NotebookInstanceArn").getter(getter(NotebookInstanceSummary::notebookInstanceArn))
.setter(setter(Builder::notebookInstanceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookInstanceArn").build())
.build();
private static final SdkField NOTEBOOK_INSTANCE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NotebookInstanceStatus").getter(getter(NotebookInstanceSummary::notebookInstanceStatusAsString))
.setter(setter(Builder::notebookInstanceStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookInstanceStatus").build())
.build();
private static final SdkField URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Url")
.getter(getter(NotebookInstanceSummary::url)).setter(setter(Builder::url))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Url").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(NotebookInstanceSummary::instanceTypeAsString))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(NotebookInstanceSummary::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(NotebookInstanceSummary::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final SdkField NOTEBOOK_INSTANCE_LIFECYCLE_CONFIG_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NotebookInstanceLifecycleConfigName")
.getter(getter(NotebookInstanceSummary::notebookInstanceLifecycleConfigName))
.setter(setter(Builder::notebookInstanceLifecycleConfigName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("NotebookInstanceLifecycleConfigName").build()).build();
private static final SdkField DEFAULT_CODE_REPOSITORY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultCodeRepository").getter(getter(NotebookInstanceSummary::defaultCodeRepository))
.setter(setter(Builder::defaultCodeRepository))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultCodeRepository").build())
.build();
private static final SdkField> ADDITIONAL_CODE_REPOSITORIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AdditionalCodeRepositories")
.getter(getter(NotebookInstanceSummary::additionalCodeRepositories))
.setter(setter(Builder::additionalCodeRepositories))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AdditionalCodeRepositories").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NOTEBOOK_INSTANCE_NAME_FIELD,
NOTEBOOK_INSTANCE_ARN_FIELD, NOTEBOOK_INSTANCE_STATUS_FIELD, URL_FIELD, INSTANCE_TYPE_FIELD, CREATION_TIME_FIELD,
LAST_MODIFIED_TIME_FIELD, NOTEBOOK_INSTANCE_LIFECYCLE_CONFIG_NAME_FIELD, DEFAULT_CODE_REPOSITORY_FIELD,
ADDITIONAL_CODE_REPOSITORIES_FIELD));
private static final long serialVersionUID = 1L;
private final String notebookInstanceName;
private final String notebookInstanceArn;
private final String notebookInstanceStatus;
private final String url;
private final String instanceType;
private final Instant creationTime;
private final Instant lastModifiedTime;
private final String notebookInstanceLifecycleConfigName;
private final String defaultCodeRepository;
private final List additionalCodeRepositories;
private NotebookInstanceSummary(BuilderImpl builder) {
this.notebookInstanceName = builder.notebookInstanceName;
this.notebookInstanceArn = builder.notebookInstanceArn;
this.notebookInstanceStatus = builder.notebookInstanceStatus;
this.url = builder.url;
this.instanceType = builder.instanceType;
this.creationTime = builder.creationTime;
this.lastModifiedTime = builder.lastModifiedTime;
this.notebookInstanceLifecycleConfigName = builder.notebookInstanceLifecycleConfigName;
this.defaultCodeRepository = builder.defaultCodeRepository;
this.additionalCodeRepositories = builder.additionalCodeRepositories;
}
/**
*
* The name of the notebook instance that you want a summary for.
*
*
* @return The name of the notebook instance that you want a summary for.
*/
public final String notebookInstanceName() {
return notebookInstanceName;
}
/**
*
* The Amazon Resource Name (ARN) of the notebook instance.
*
*
* @return The Amazon Resource Name (ARN) of the notebook instance.
*/
public final String notebookInstanceArn() {
return notebookInstanceArn;
}
/**
*
* The status of the notebook instance.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #notebookInstanceStatus} will return {@link NotebookInstanceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #notebookInstanceStatusAsString}.
*
*
* @return The status of the notebook instance.
* @see NotebookInstanceStatus
*/
public final NotebookInstanceStatus notebookInstanceStatus() {
return NotebookInstanceStatus.fromValue(notebookInstanceStatus);
}
/**
*
* The status of the notebook instance.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #notebookInstanceStatus} will return {@link NotebookInstanceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #notebookInstanceStatusAsString}.
*
*
* @return The status of the notebook instance.
* @see NotebookInstanceStatus
*/
public final String notebookInstanceStatusAsString() {
return notebookInstanceStatus;
}
/**
*
* The URL that you use to connect to the Jupyter notebook running in your notebook instance.
*
*
* @return The URL that you use to connect to the Jupyter notebook running in your notebook instance.
*/
public final String url() {
return url;
}
/**
*
* The type of ML compute instance that the notebook instance is running on.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link InstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #instanceTypeAsString}.
*
*
* @return The type of ML compute instance that the notebook instance is running on.
* @see InstanceType
*/
public final InstanceType instanceType() {
return InstanceType.fromValue(instanceType);
}
/**
*
* The type of ML compute instance that the notebook instance is running on.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link InstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #instanceTypeAsString}.
*
*
* @return The type of ML compute instance that the notebook instance is running on.
* @see InstanceType
*/
public final String instanceTypeAsString() {
return instanceType;
}
/**
*
* A timestamp that shows when the notebook instance was created.
*
*
* @return A timestamp that shows when the notebook instance was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* A timestamp that shows when the notebook instance was last modified.
*
*
* @return A timestamp that shows when the notebook instance was last modified.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
*
* The name of a notebook instance lifecycle configuration associated with this notebook instance.
*
*
* For information about notebook instance lifestyle configurations, see Step 2.1: (Optional)
* Customize a Notebook Instance.
*
*
* @return The name of a notebook instance lifecycle configuration associated with this notebook instance.
*
* For information about notebook instance lifestyle configurations, see Step 2.1:
* (Optional) Customize a Notebook Instance.
*/
public final String notebookInstanceLifecycleConfigName() {
return notebookInstanceLifecycleConfigName;
}
/**
*
* The Git repository associated with the notebook instance as its default code repository. This can be either the
* name of a Git repository stored as a resource in your account, or the URL of a Git repository in Amazon Web Services CodeCommit or
* in any other Git repository. When you open a notebook instance, it opens in the directory that contains this
* repository. For more information, see Associating Git Repositories with
* SageMaker Notebook Instances.
*
*
* @return The Git repository associated with the notebook instance as its default code repository. This can be
* either the name of a Git repository stored as a resource in your account, or the URL of a Git repository
* in Amazon Web Services
* CodeCommit or in any other Git repository. When you open a notebook instance, it opens in the
* directory that contains this repository. For more information, see Associating Git Repositories
* with SageMaker Notebook Instances.
*/
public final String defaultCodeRepository() {
return defaultCodeRepository;
}
/**
* For responses, this returns true if the service returned a value for the AdditionalCodeRepositories 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 hasAdditionalCodeRepositories() {
return additionalCodeRepositories != null && !(additionalCodeRepositories instanceof SdkAutoConstructList);
}
/**
*
* An array of up to three Git repositories associated with the notebook instance. These can be either the names of
* Git repositories stored as resources in your account, or the URL of Git repositories in Amazon Web Services CodeCommit or
* in any other Git repository. These repositories are cloned at the same level as the default repository of your
* notebook instance. For more information, see Associating Git Repositories with
* SageMaker Notebook Instances.
*
*
* 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 #hasAdditionalCodeRepositories} method.
*
*
* @return An array of up to three Git repositories associated with the notebook instance. These can be either the
* names of Git repositories stored as resources in your account, or the URL of Git repositories in Amazon Web Services
* CodeCommit or in any other Git repository. These repositories are cloned at the same level as the
* default repository of your notebook instance. For more information, see Associating Git Repositories
* with SageMaker Notebook Instances.
*/
public final List additionalCodeRepositories() {
return additionalCodeRepositories;
}
@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(notebookInstanceName());
hashCode = 31 * hashCode + Objects.hashCode(notebookInstanceArn());
hashCode = 31 * hashCode + Objects.hashCode(notebookInstanceStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(url());
hashCode = 31 * hashCode + Objects.hashCode(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(notebookInstanceLifecycleConfigName());
hashCode = 31 * hashCode + Objects.hashCode(defaultCodeRepository());
hashCode = 31 * hashCode + Objects.hashCode(hasAdditionalCodeRepositories() ? additionalCodeRepositories() : 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 NotebookInstanceSummary)) {
return false;
}
NotebookInstanceSummary other = (NotebookInstanceSummary) obj;
return Objects.equals(notebookInstanceName(), other.notebookInstanceName())
&& Objects.equals(notebookInstanceArn(), other.notebookInstanceArn())
&& Objects.equals(notebookInstanceStatusAsString(), other.notebookInstanceStatusAsString())
&& Objects.equals(url(), other.url()) && Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(notebookInstanceLifecycleConfigName(), other.notebookInstanceLifecycleConfigName())
&& Objects.equals(defaultCodeRepository(), other.defaultCodeRepository())
&& hasAdditionalCodeRepositories() == other.hasAdditionalCodeRepositories()
&& Objects.equals(additionalCodeRepositories(), other.additionalCodeRepositories());
}
/**
* 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("NotebookInstanceSummary").add("NotebookInstanceName", notebookInstanceName())
.add("NotebookInstanceArn", notebookInstanceArn())
.add("NotebookInstanceStatus", notebookInstanceStatusAsString()).add("Url", url())
.add("InstanceType", instanceTypeAsString()).add("CreationTime", creationTime())
.add("LastModifiedTime", lastModifiedTime())
.add("NotebookInstanceLifecycleConfigName", notebookInstanceLifecycleConfigName())
.add("DefaultCodeRepository", defaultCodeRepository())
.add("AdditionalCodeRepositories", hasAdditionalCodeRepositories() ? additionalCodeRepositories() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NotebookInstanceName":
return Optional.ofNullable(clazz.cast(notebookInstanceName()));
case "NotebookInstanceArn":
return Optional.ofNullable(clazz.cast(notebookInstanceArn()));
case "NotebookInstanceStatus":
return Optional.ofNullable(clazz.cast(notebookInstanceStatusAsString()));
case "Url":
return Optional.ofNullable(clazz.cast(url()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "NotebookInstanceLifecycleConfigName":
return Optional.ofNullable(clazz.cast(notebookInstanceLifecycleConfigName()));
case "DefaultCodeRepository":
return Optional.ofNullable(clazz.cast(defaultCodeRepository()));
case "AdditionalCodeRepositories":
return Optional.ofNullable(clazz.cast(additionalCodeRepositories()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function