software.amazon.awssdk.services.sagemaker.model.Pipeline 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.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 SageMaker Model Building Pipeline instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Pipeline implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField PIPELINE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PipelineArn").getter(getter(Pipeline::pipelineArn)).setter(setter(Builder::pipelineArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PipelineArn").build()).build();
private static final SdkField PIPELINE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PipelineName").getter(getter(Pipeline::pipelineName)).setter(setter(Builder::pipelineName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PipelineName").build()).build();
private static final SdkField PIPELINE_DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PipelineDisplayName").getter(getter(Pipeline::pipelineDisplayName))
.setter(setter(Builder::pipelineDisplayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PipelineDisplayName").build())
.build();
private static final SdkField PIPELINE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PipelineDescription").getter(getter(Pipeline::pipelineDescription))
.setter(setter(Builder::pipelineDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PipelineDescription").build())
.build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(Pipeline::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField PIPELINE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PipelineStatus").getter(getter(Pipeline::pipelineStatusAsString))
.setter(setter(Builder::pipelineStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PipelineStatus").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(Pipeline::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(Pipeline::lastModifiedTime)).setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final SdkField LAST_RUN_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastRunTime").getter(getter(Pipeline::lastRunTime)).setter(setter(Builder::lastRunTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastRunTime").build()).build();
private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("CreatedBy").getter(getter(Pipeline::createdBy)).setter(setter(Builder::createdBy))
.constructor(UserContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();
private static final SdkField LAST_MODIFIED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LastModifiedBy").getter(getter(Pipeline::lastModifiedBy)).setter(setter(Builder::lastModifiedBy))
.constructor(UserContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedBy").build()).build();
private static final SdkField PARALLELISM_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ParallelismConfiguration")
.getter(getter(Pipeline::parallelismConfiguration)).setter(setter(Builder::parallelismConfiguration))
.constructor(ParallelismConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParallelismConfiguration").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(Pipeline::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(PIPELINE_ARN_FIELD,
PIPELINE_NAME_FIELD, PIPELINE_DISPLAY_NAME_FIELD, PIPELINE_DESCRIPTION_FIELD, ROLE_ARN_FIELD, PIPELINE_STATUS_FIELD,
CREATION_TIME_FIELD, LAST_MODIFIED_TIME_FIELD, LAST_RUN_TIME_FIELD, CREATED_BY_FIELD, LAST_MODIFIED_BY_FIELD,
PARALLELISM_CONFIGURATION_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String pipelineArn;
private final String pipelineName;
private final String pipelineDisplayName;
private final String pipelineDescription;
private final String roleArn;
private final String pipelineStatus;
private final Instant creationTime;
private final Instant lastModifiedTime;
private final Instant lastRunTime;
private final UserContext createdBy;
private final UserContext lastModifiedBy;
private final ParallelismConfiguration parallelismConfiguration;
private final List tags;
private Pipeline(BuilderImpl builder) {
this.pipelineArn = builder.pipelineArn;
this.pipelineName = builder.pipelineName;
this.pipelineDisplayName = builder.pipelineDisplayName;
this.pipelineDescription = builder.pipelineDescription;
this.roleArn = builder.roleArn;
this.pipelineStatus = builder.pipelineStatus;
this.creationTime = builder.creationTime;
this.lastModifiedTime = builder.lastModifiedTime;
this.lastRunTime = builder.lastRunTime;
this.createdBy = builder.createdBy;
this.lastModifiedBy = builder.lastModifiedBy;
this.parallelismConfiguration = builder.parallelismConfiguration;
this.tags = builder.tags;
}
/**
*
* The Amazon Resource Name (ARN) of the pipeline.
*
*
* @return The Amazon Resource Name (ARN) of the pipeline.
*/
public final String pipelineArn() {
return pipelineArn;
}
/**
*
* The name of the pipeline.
*
*
* @return The name of the pipeline.
*/
public final String pipelineName() {
return pipelineName;
}
/**
*
* The display name of the pipeline.
*
*
* @return The display name of the pipeline.
*/
public final String pipelineDisplayName() {
return pipelineDisplayName;
}
/**
*
* The description of the pipeline.
*
*
* @return The description of the pipeline.
*/
public final String pipelineDescription() {
return pipelineDescription;
}
/**
*
* The Amazon Resource Name (ARN) of the role that created the pipeline.
*
*
* @return The Amazon Resource Name (ARN) of the role that created the pipeline.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The status of the pipeline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #pipelineStatus}
* will return {@link PipelineStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #pipelineStatusAsString}.
*
*
* @return The status of the pipeline.
* @see PipelineStatus
*/
public final PipelineStatus pipelineStatus() {
return PipelineStatus.fromValue(pipelineStatus);
}
/**
*
* The status of the pipeline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #pipelineStatus}
* will return {@link PipelineStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #pipelineStatusAsString}.
*
*
* @return The status of the pipeline.
* @see PipelineStatus
*/
public final String pipelineStatusAsString() {
return pipelineStatus;
}
/**
*
* The creation time of the pipeline.
*
*
* @return The creation time of the pipeline.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The time that the pipeline was last modified.
*
*
* @return The time that the pipeline was last modified.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
*
* The time when the pipeline was last run.
*
*
* @return The time when the pipeline was last run.
*/
public final Instant lastRunTime() {
return lastRunTime;
}
/**
* Returns the value of the CreatedBy property for this object.
*
* @return The value of the CreatedBy property for this object.
*/
public final UserContext createdBy() {
return createdBy;
}
/**
* Returns the value of the LastModifiedBy property for this object.
*
* @return The value of the LastModifiedBy property for this object.
*/
public final UserContext lastModifiedBy() {
return lastModifiedBy;
}
/**
*
* The parallelism configuration applied to the pipeline.
*
*
* @return The parallelism configuration applied to the pipeline.
*/
public final ParallelismConfiguration parallelismConfiguration() {
return parallelismConfiguration;
}
/**
* 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 tags that apply to the pipeline.
*
*
* 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 tags that apply to the pipeline.
*/
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(pipelineArn());
hashCode = 31 * hashCode + Objects.hashCode(pipelineName());
hashCode = 31 * hashCode + Objects.hashCode(pipelineDisplayName());
hashCode = 31 * hashCode + Objects.hashCode(pipelineDescription());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(pipelineStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(lastRunTime());
hashCode = 31 * hashCode + Objects.hashCode(createdBy());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedBy());
hashCode = 31 * hashCode + Objects.hashCode(parallelismConfiguration());
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 Pipeline)) {
return false;
}
Pipeline other = (Pipeline) obj;
return Objects.equals(pipelineArn(), other.pipelineArn()) && Objects.equals(pipelineName(), other.pipelineName())
&& Objects.equals(pipelineDisplayName(), other.pipelineDisplayName())
&& Objects.equals(pipelineDescription(), other.pipelineDescription())
&& Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(pipelineStatusAsString(), other.pipelineStatusAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(lastRunTime(), other.lastRunTime()) && Objects.equals(createdBy(), other.createdBy())
&& Objects.equals(lastModifiedBy(), other.lastModifiedBy())
&& Objects.equals(parallelismConfiguration(), other.parallelismConfiguration()) && 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("Pipeline").add("PipelineArn", pipelineArn()).add("PipelineName", pipelineName())
.add("PipelineDisplayName", pipelineDisplayName()).add("PipelineDescription", pipelineDescription())
.add("RoleArn", roleArn()).add("PipelineStatus", pipelineStatusAsString()).add("CreationTime", creationTime())
.add("LastModifiedTime", lastModifiedTime()).add("LastRunTime", lastRunTime()).add("CreatedBy", createdBy())
.add("LastModifiedBy", lastModifiedBy()).add("ParallelismConfiguration", parallelismConfiguration())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PipelineArn":
return Optional.ofNullable(clazz.cast(pipelineArn()));
case "PipelineName":
return Optional.ofNullable(clazz.cast(pipelineName()));
case "PipelineDisplayName":
return Optional.ofNullable(clazz.cast(pipelineDisplayName()));
case "PipelineDescription":
return Optional.ofNullable(clazz.cast(pipelineDescription()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "PipelineStatus":
return Optional.ofNullable(clazz.cast(pipelineStatusAsString()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "LastRunTime":
return Optional.ofNullable(clazz.cast(lastRunTime()));
case "CreatedBy":
return Optional.ofNullable(clazz.cast(createdBy()));
case "LastModifiedBy":
return Optional.ofNullable(clazz.cast(lastModifiedBy()));
case "ParallelismConfiguration":
return Optional.ofNullable(clazz.cast(parallelismConfiguration()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function