software.amazon.awssdk.services.sagemaker.model.PipelineExecutionStep 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.beans.Transient;
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.Consumer;
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;
/**
*
* An execution of a step in a pipeline.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PipelineExecutionStep implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField STEP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StepName").getter(getter(PipelineExecutionStep::stepName)).setter(setter(Builder::stepName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StepName").build()).build();
private static final SdkField STEP_DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StepDisplayName").getter(getter(PipelineExecutionStep::stepDisplayName))
.setter(setter(Builder::stepDisplayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StepDisplayName").build()).build();
private static final SdkField STEP_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StepDescription").getter(getter(PipelineExecutionStep::stepDescription))
.setter(setter(Builder::stepDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StepDescription").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(PipelineExecutionStep::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EndTime").getter(getter(PipelineExecutionStep::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField STEP_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StepStatus").getter(getter(PipelineExecutionStep::stepStatusAsString))
.setter(setter(Builder::stepStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StepStatus").build()).build();
private static final SdkField CACHE_HIT_RESULT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CacheHitResult")
.getter(getter(PipelineExecutionStep::cacheHitResult)).setter(setter(Builder::cacheHitResult))
.constructor(CacheHitResult::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheHitResult").build()).build();
private static final SdkField ATTEMPT_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("AttemptCount").getter(getter(PipelineExecutionStep::attemptCount)).setter(setter(Builder::attemptCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttemptCount").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailureReason").getter(getter(PipelineExecutionStep::failureReason))
.setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final SdkField METADATA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Metadata")
.getter(getter(PipelineExecutionStep::metadata)).setter(setter(Builder::metadata))
.constructor(PipelineExecutionStepMetadata::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metadata").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STEP_NAME_FIELD,
STEP_DISPLAY_NAME_FIELD, STEP_DESCRIPTION_FIELD, START_TIME_FIELD, END_TIME_FIELD, STEP_STATUS_FIELD,
CACHE_HIT_RESULT_FIELD, ATTEMPT_COUNT_FIELD, FAILURE_REASON_FIELD, METADATA_FIELD));
private static final long serialVersionUID = 1L;
private final String stepName;
private final String stepDisplayName;
private final String stepDescription;
private final Instant startTime;
private final Instant endTime;
private final String stepStatus;
private final CacheHitResult cacheHitResult;
private final Integer attemptCount;
private final String failureReason;
private final PipelineExecutionStepMetadata metadata;
private PipelineExecutionStep(BuilderImpl builder) {
this.stepName = builder.stepName;
this.stepDisplayName = builder.stepDisplayName;
this.stepDescription = builder.stepDescription;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.stepStatus = builder.stepStatus;
this.cacheHitResult = builder.cacheHitResult;
this.attemptCount = builder.attemptCount;
this.failureReason = builder.failureReason;
this.metadata = builder.metadata;
}
/**
*
* The name of the step that is executed.
*
*
* @return The name of the step that is executed.
*/
public final String stepName() {
return stepName;
}
/**
*
* The display name of the step.
*
*
* @return The display name of the step.
*/
public final String stepDisplayName() {
return stepDisplayName;
}
/**
*
* The description of the step.
*
*
* @return The description of the step.
*/
public final String stepDescription() {
return stepDescription;
}
/**
*
* The time that the step started executing.
*
*
* @return The time that the step started executing.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The time that the step stopped executing.
*
*
* @return The time that the step stopped executing.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The status of the step execution.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #stepStatus} will
* return {@link StepStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stepStatusAsString}.
*
*
* @return The status of the step execution.
* @see StepStatus
*/
public final StepStatus stepStatus() {
return StepStatus.fromValue(stepStatus);
}
/**
*
* The status of the step execution.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #stepStatus} will
* return {@link StepStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stepStatusAsString}.
*
*
* @return The status of the step execution.
* @see StepStatus
*/
public final String stepStatusAsString() {
return stepStatus;
}
/**
*
* If this pipeline execution step was cached, details on the cache hit.
*
*
* @return If this pipeline execution step was cached, details on the cache hit.
*/
public final CacheHitResult cacheHitResult() {
return cacheHitResult;
}
/**
*
* The current attempt of the execution step. For more information, see Retry Policy for Amazon SageMaker Pipelines steps.
*
*
* @return The current attempt of the execution step. For more information, see Retry Policy for Amazon SageMaker Pipelines steps.
*/
public final Integer attemptCount() {
return attemptCount;
}
/**
*
* The reason why the step failed execution. This is only returned if the step failed its execution.
*
*
* @return The reason why the step failed execution. This is only returned if the step failed its execution.
*/
public final String failureReason() {
return failureReason;
}
/**
*
* Metadata for the step execution.
*
*
* @return Metadata for the step execution.
*/
public final PipelineExecutionStepMetadata metadata() {
return metadata;
}
@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(stepName());
hashCode = 31 * hashCode + Objects.hashCode(stepDisplayName());
hashCode = 31 * hashCode + Objects.hashCode(stepDescription());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(stepStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(cacheHitResult());
hashCode = 31 * hashCode + Objects.hashCode(attemptCount());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(metadata());
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 PipelineExecutionStep)) {
return false;
}
PipelineExecutionStep other = (PipelineExecutionStep) obj;
return Objects.equals(stepName(), other.stepName()) && Objects.equals(stepDisplayName(), other.stepDisplayName())
&& Objects.equals(stepDescription(), other.stepDescription()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime()) && Objects.equals(stepStatusAsString(), other.stepStatusAsString())
&& Objects.equals(cacheHitResult(), other.cacheHitResult())
&& Objects.equals(attemptCount(), other.attemptCount()) && Objects.equals(failureReason(), other.failureReason())
&& Objects.equals(metadata(), other.metadata());
}
/**
* 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("PipelineExecutionStep").add("StepName", stepName()).add("StepDisplayName", stepDisplayName())
.add("StepDescription", stepDescription()).add("StartTime", startTime()).add("EndTime", endTime())
.add("StepStatus", stepStatusAsString()).add("CacheHitResult", cacheHitResult())
.add("AttemptCount", attemptCount()).add("FailureReason", failureReason()).add("Metadata", metadata()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StepName":
return Optional.ofNullable(clazz.cast(stepName()));
case "StepDisplayName":
return Optional.ofNullable(clazz.cast(stepDisplayName()));
case "StepDescription":
return Optional.ofNullable(clazz.cast(stepDescription()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "StepStatus":
return Optional.ofNullable(clazz.cast(stepStatusAsString()));
case "CacheHitResult":
return Optional.ofNullable(clazz.cast(cacheHitResult()));
case "AttemptCount":
return Optional.ofNullable(clazz.cast(attemptCount()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "Metadata":
return Optional.ofNullable(clazz.cast(metadata()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function