
software.amazon.awssdk.services.codepipeline.model.JobData 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 other information about a job required for a job worker to complete the job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JobData implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ACTION_TYPE_ID_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("actionTypeId").getter(getter(JobData::actionTypeId)).setter(setter(Builder::actionTypeId))
.constructor(ActionTypeId::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionTypeId").build()).build();
private static final SdkField ACTION_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("actionConfiguration")
.getter(getter(JobData::actionConfiguration)).setter(setter(Builder::actionConfiguration))
.constructor(ActionConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionConfiguration").build())
.build();
private static final SdkField PIPELINE_CONTEXT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("pipelineContext")
.getter(getter(JobData::pipelineContext)).setter(setter(Builder::pipelineContext))
.constructor(PipelineContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipelineContext").build()).build();
private static final SdkField> INPUT_ARTIFACTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("inputArtifacts")
.getter(getter(JobData::inputArtifacts))
.setter(setter(Builder::inputArtifacts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("inputArtifacts").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Artifact::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> OUTPUT_ARTIFACTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("outputArtifacts")
.getter(getter(JobData::outputArtifacts))
.setter(setter(Builder::outputArtifacts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("outputArtifacts").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Artifact::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ARTIFACT_CREDENTIALS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("artifactCredentials")
.getter(getter(JobData::artifactCredentials)).setter(setter(Builder::artifactCredentials))
.constructor(AWSSessionCredentials::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("artifactCredentials").build())
.build();
private static final SdkField CONTINUATION_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("continuationToken").getter(getter(JobData::continuationToken))
.setter(setter(Builder::continuationToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("continuationToken").build()).build();
private static final SdkField ENCRYPTION_KEY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("encryptionKey").getter(getter(JobData::encryptionKey))
.setter(setter(Builder::encryptionKey)).constructor(EncryptionKey::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("encryptionKey").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_TYPE_ID_FIELD,
ACTION_CONFIGURATION_FIELD, PIPELINE_CONTEXT_FIELD, INPUT_ARTIFACTS_FIELD, OUTPUT_ARTIFACTS_FIELD,
ARTIFACT_CREDENTIALS_FIELD, CONTINUATION_TOKEN_FIELD, ENCRYPTION_KEY_FIELD));
private static final long serialVersionUID = 1L;
private final ActionTypeId actionTypeId;
private final ActionConfiguration actionConfiguration;
private final PipelineContext pipelineContext;
private final List inputArtifacts;
private final List outputArtifacts;
private final AWSSessionCredentials artifactCredentials;
private final String continuationToken;
private final EncryptionKey encryptionKey;
private JobData(BuilderImpl builder) {
this.actionTypeId = builder.actionTypeId;
this.actionConfiguration = builder.actionConfiguration;
this.pipelineContext = builder.pipelineContext;
this.inputArtifacts = builder.inputArtifacts;
this.outputArtifacts = builder.outputArtifacts;
this.artifactCredentials = builder.artifactCredentials;
this.continuationToken = builder.continuationToken;
this.encryptionKey = builder.encryptionKey;
}
/**
*
* Represents information about an action type.
*
*
* @return Represents information about an action type.
*/
public final ActionTypeId actionTypeId() {
return actionTypeId;
}
/**
*
* Represents information about an action configuration.
*
*
* @return Represents information about an action configuration.
*/
public final ActionConfiguration actionConfiguration() {
return actionConfiguration;
}
/**
*
* Represents information about a pipeline to a job worker.
*
*
*
* Includes pipelineArn
and pipelineExecutionId
for custom jobs.
*
*
*
* @return Represents information about a pipeline to a job worker.
*
* Includes pipelineArn
and pipelineExecutionId
for custom jobs.
*
*/
public final PipelineContext pipelineContext() {
return pipelineContext;
}
/**
* For responses, this returns true if the service returned a value for the InputArtifacts 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 hasInputArtifacts() {
return inputArtifacts != null && !(inputArtifacts instanceof SdkAutoConstructList);
}
/**
*
* The artifact supplied to the job.
*
*
* 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 #hasInputArtifacts} method.
*
*
* @return The artifact supplied to the job.
*/
public final List inputArtifacts() {
return inputArtifacts;
}
/**
* For responses, this returns true if the service returned a value for the OutputArtifacts 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 hasOutputArtifacts() {
return outputArtifacts != null && !(outputArtifacts instanceof SdkAutoConstructList);
}
/**
*
* The output of the job.
*
*
* 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 #hasOutputArtifacts} method.
*
*
* @return The output of the job.
*/
public final List outputArtifacts() {
return outputArtifacts;
}
/**
*
* Represents an AWS session credentials object. These credentials are temporary credentials that are issued by AWS
* Secure Token Service (STS). They can be used to access input and output artifacts in the S3 bucket used to store
* artifacts for the pipeline in AWS CodePipeline.
*
*
* @return Represents an AWS session credentials object. These credentials are temporary credentials that are issued
* by AWS Secure Token Service (STS). They can be used to access input and output artifacts in the S3 bucket
* used to store artifacts for the pipeline in AWS CodePipeline.
*/
public final AWSSessionCredentials artifactCredentials() {
return artifactCredentials;
}
/**
*
* A system-generated token, such as a AWS CodeDeploy deployment ID, required by a job to continue the job
* asynchronously.
*
*
* @return A system-generated token, such as a AWS CodeDeploy deployment ID, required by a job to continue the job
* asynchronously.
*/
public final String continuationToken() {
return continuationToken;
}
/**
*
* Represents information about the key used to encrypt data in the artifact store, such as an AWS Key Management
* Service (AWS KMS) key.
*
*
* @return Represents information about the key used to encrypt data in the artifact store, such as an AWS Key
* Management Service (AWS KMS) key.
*/
public final EncryptionKey encryptionKey() {
return encryptionKey;
}
@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(actionTypeId());
hashCode = 31 * hashCode + Objects.hashCode(actionConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(pipelineContext());
hashCode = 31 * hashCode + Objects.hashCode(hasInputArtifacts() ? inputArtifacts() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasOutputArtifacts() ? outputArtifacts() : null);
hashCode = 31 * hashCode + Objects.hashCode(artifactCredentials());
hashCode = 31 * hashCode + Objects.hashCode(continuationToken());
hashCode = 31 * hashCode + Objects.hashCode(encryptionKey());
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 JobData)) {
return false;
}
JobData other = (JobData) obj;
return Objects.equals(actionTypeId(), other.actionTypeId())
&& Objects.equals(actionConfiguration(), other.actionConfiguration())
&& Objects.equals(pipelineContext(), other.pipelineContext()) && hasInputArtifacts() == other.hasInputArtifacts()
&& Objects.equals(inputArtifacts(), other.inputArtifacts()) && hasOutputArtifacts() == other.hasOutputArtifacts()
&& Objects.equals(outputArtifacts(), other.outputArtifacts())
&& Objects.equals(artifactCredentials(), other.artifactCredentials())
&& Objects.equals(continuationToken(), other.continuationToken())
&& Objects.equals(encryptionKey(), other.encryptionKey());
}
/**
* 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("JobData").add("ActionTypeId", actionTypeId()).add("ActionConfiguration", actionConfiguration())
.add("PipelineContext", pipelineContext()).add("InputArtifacts", hasInputArtifacts() ? inputArtifacts() : null)
.add("OutputArtifacts", hasOutputArtifacts() ? outputArtifacts() : null)
.add("ArtifactCredentials", artifactCredentials() == null ? null : "*** Sensitive Data Redacted ***")
.add("ContinuationToken", continuationToken()).add("EncryptionKey", encryptionKey()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "actionTypeId":
return Optional.ofNullable(clazz.cast(actionTypeId()));
case "actionConfiguration":
return Optional.ofNullable(clazz.cast(actionConfiguration()));
case "pipelineContext":
return Optional.ofNullable(clazz.cast(pipelineContext()));
case "inputArtifacts":
return Optional.ofNullable(clazz.cast(inputArtifacts()));
case "outputArtifacts":
return Optional.ofNullable(clazz.cast(outputArtifacts()));
case "artifactCredentials":
return Optional.ofNullable(clazz.cast(artifactCredentials()));
case "continuationToken":
return Optional.ofNullable(clazz.cast(continuationToken()));
case "encryptionKey":
return Optional.ofNullable(clazz.cast(encryptionKey()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function