
software.amazon.awssdk.services.codepipeline.model.PipelineExecution 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.codepipeline.model;
import java.io.Serializable;
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;
/**
*
* Represents information about an execution of a pipeline.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PipelineExecution implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PIPELINE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("pipelineName").getter(getter(PipelineExecution::pipelineName)).setter(setter(Builder::pipelineName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipelineName").build()).build();
private static final SdkField PIPELINE_VERSION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("pipelineVersion").getter(getter(PipelineExecution::pipelineVersion))
.setter(setter(Builder::pipelineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipelineVersion").build()).build();
private static final SdkField PIPELINE_EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("pipelineExecutionId").getter(getter(PipelineExecution::pipelineExecutionId))
.setter(setter(Builder::pipelineExecutionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipelineExecutionId").build())
.build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(PipelineExecution::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_SUMMARY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusSummary").getter(getter(PipelineExecution::statusSummary)).setter(setter(Builder::statusSummary))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusSummary").build()).build();
private static final SdkField> ARTIFACT_REVISIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("artifactRevisions")
.getter(getter(PipelineExecution::artifactRevisions))
.setter(setter(Builder::artifactRevisions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("artifactRevisions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ArtifactRevision::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PIPELINE_NAME_FIELD,
PIPELINE_VERSION_FIELD, PIPELINE_EXECUTION_ID_FIELD, STATUS_FIELD, STATUS_SUMMARY_FIELD, ARTIFACT_REVISIONS_FIELD));
private static final long serialVersionUID = 1L;
private final String pipelineName;
private final Integer pipelineVersion;
private final String pipelineExecutionId;
private final String status;
private final String statusSummary;
private final List artifactRevisions;
private PipelineExecution(BuilderImpl builder) {
this.pipelineName = builder.pipelineName;
this.pipelineVersion = builder.pipelineVersion;
this.pipelineExecutionId = builder.pipelineExecutionId;
this.status = builder.status;
this.statusSummary = builder.statusSummary;
this.artifactRevisions = builder.artifactRevisions;
}
/**
*
* The name of the pipeline with the specified pipeline execution.
*
*
* @return The name of the pipeline with the specified pipeline execution.
*/
public final String pipelineName() {
return pipelineName;
}
/**
*
* The version number of the pipeline with the specified pipeline execution.
*
*
* @return The version number of the pipeline with the specified pipeline execution.
*/
public final Integer pipelineVersion() {
return pipelineVersion;
}
/**
*
* The ID of the pipeline execution.
*
*
* @return The ID of the pipeline execution.
*/
public final String pipelineExecutionId() {
return pipelineExecutionId;
}
/**
*
* The status of the pipeline execution.
*
*
* -
*
* Cancelled: The pipeline’s definition was updated before the pipeline execution could be completed.
*
*
* -
*
* InProgress: The pipeline execution is currently running.
*
*
* -
*
* Stopped: The pipeline execution was manually stopped. For more information, see Stopped Executions.
*
*
* -
*
* Stopping: The pipeline execution received a request to be manually stopped. Depending on the selected stop mode,
* the execution is either completing or abandoning in-progress actions. For more information, see Stopped Executions.
*
*
* -
*
* Succeeded: The pipeline execution was completed successfully.
*
*
* -
*
* Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer pipeline
* execution advanced and continued through the pipeline instead. For more information, see Superseded
* Executions.
*
*
* -
*
* Failed: The pipeline execution was not completed successfully.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link PipelineExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the pipeline execution.
*
* -
*
* Cancelled: The pipeline’s definition was updated before the pipeline execution could be completed.
*
*
* -
*
* InProgress: The pipeline execution is currently running.
*
*
* -
*
* Stopped: The pipeline execution was manually stopped. For more information, see Stopped Executions.
*
*
* -
*
* Stopping: The pipeline execution received a request to be manually stopped. Depending on the selected
* stop mode, the execution is either completing or abandoning in-progress actions. For more information,
* see Stopped Executions.
*
*
* -
*
* Succeeded: The pipeline execution was completed successfully.
*
*
* -
*
* Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer
* pipeline execution advanced and continued through the pipeline instead. For more information, see Superseded
* Executions.
*
*
* -
*
* Failed: The pipeline execution was not completed successfully.
*
*
* @see PipelineExecutionStatus
*/
public final PipelineExecutionStatus status() {
return PipelineExecutionStatus.fromValue(status);
}
/**
*
* The status of the pipeline execution.
*
*
* -
*
* Cancelled: The pipeline’s definition was updated before the pipeline execution could be completed.
*
*
* -
*
* InProgress: The pipeline execution is currently running.
*
*
* -
*
* Stopped: The pipeline execution was manually stopped. For more information, see Stopped Executions.
*
*
* -
*
* Stopping: The pipeline execution received a request to be manually stopped. Depending on the selected stop mode,
* the execution is either completing or abandoning in-progress actions. For more information, see Stopped Executions.
*
*
* -
*
* Succeeded: The pipeline execution was completed successfully.
*
*
* -
*
* Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer pipeline
* execution advanced and continued through the pipeline instead. For more information, see Superseded
* Executions.
*
*
* -
*
* Failed: The pipeline execution was not completed successfully.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link PipelineExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the pipeline execution.
*
* -
*
* Cancelled: The pipeline’s definition was updated before the pipeline execution could be completed.
*
*
* -
*
* InProgress: The pipeline execution is currently running.
*
*
* -
*
* Stopped: The pipeline execution was manually stopped. For more information, see Stopped Executions.
*
*
* -
*
* Stopping: The pipeline execution received a request to be manually stopped. Depending on the selected
* stop mode, the execution is either completing or abandoning in-progress actions. For more information,
* see Stopped Executions.
*
*
* -
*
* Succeeded: The pipeline execution was completed successfully.
*
*
* -
*
* Superseded: While this pipeline execution was waiting for the next stage to be completed, a newer
* pipeline execution advanced and continued through the pipeline instead. For more information, see Superseded
* Executions.
*
*
* -
*
* Failed: The pipeline execution was not completed successfully.
*
*
* @see PipelineExecutionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A summary that contains a description of the pipeline execution status.
*
*
* @return A summary that contains a description of the pipeline execution status.
*/
public final String statusSummary() {
return statusSummary;
}
/**
* For responses, this returns true if the service returned a value for the ArtifactRevisions 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 hasArtifactRevisions() {
return artifactRevisions != null && !(artifactRevisions instanceof SdkAutoConstructList);
}
/**
*
* A list of ArtifactRevision
objects included in a pipeline execution.
*
*
* 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 #hasArtifactRevisions} method.
*
*
* @return A list of ArtifactRevision
objects included in a pipeline execution.
*/
public final List artifactRevisions() {
return artifactRevisions;
}
@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(pipelineName());
hashCode = 31 * hashCode + Objects.hashCode(pipelineVersion());
hashCode = 31 * hashCode + Objects.hashCode(pipelineExecutionId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusSummary());
hashCode = 31 * hashCode + Objects.hashCode(hasArtifactRevisions() ? artifactRevisions() : 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 PipelineExecution)) {
return false;
}
PipelineExecution other = (PipelineExecution) obj;
return Objects.equals(pipelineName(), other.pipelineName()) && Objects.equals(pipelineVersion(), other.pipelineVersion())
&& Objects.equals(pipelineExecutionId(), other.pipelineExecutionId())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusSummary(), other.statusSummary())
&& hasArtifactRevisions() == other.hasArtifactRevisions()
&& Objects.equals(artifactRevisions(), other.artifactRevisions());
}
/**
* 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("PipelineExecution").add("PipelineName", pipelineName())
.add("PipelineVersion", pipelineVersion()).add("PipelineExecutionId", pipelineExecutionId())
.add("Status", statusAsString()).add("StatusSummary", statusSummary())
.add("ArtifactRevisions", hasArtifactRevisions() ? artifactRevisions() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "pipelineName":
return Optional.ofNullable(clazz.cast(pipelineName()));
case "pipelineVersion":
return Optional.ofNullable(clazz.cast(pipelineVersion()));
case "pipelineExecutionId":
return Optional.ofNullable(clazz.cast(pipelineExecutionId()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusSummary":
return Optional.ofNullable(clazz.cast(statusSummary()));
case "artifactRevisions":
return Optional.ofNullable(clazz.cast(artifactRevisions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function