Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.batch.model.JobDetail 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.batch.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An object representing an AWS Batch job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JobDetail implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField JOB_ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("jobArn")
.getter(getter(JobDetail::jobArn)).setter(setter(Builder::jobArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobArn").build()).build();
private static final SdkField JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobName").getter(getter(JobDetail::jobName)).setter(setter(Builder::jobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobName").build()).build();
private static final SdkField JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("jobId")
.getter(getter(JobDetail::jobId)).setter(setter(Builder::jobId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobId").build()).build();
private static final SdkField JOB_QUEUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobQueue").getter(getter(JobDetail::jobQueue)).setter(setter(Builder::jobQueue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobQueue").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(JobDetail::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField> ATTEMPTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("attempts")
.getter(getter(JobDetail::attempts))
.setter(setter(Builder::attempts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attempts").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AttemptDetail::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusReason").getter(getter(JobDetail::statusReason)).setter(setter(Builder::statusReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusReason").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.LONG).memberName("createdAt")
.getter(getter(JobDetail::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField RETRY_STRATEGY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("retryStrategy")
.getter(getter(JobDetail::retryStrategy)).setter(setter(Builder::retryStrategy)).constructor(RetryStrategy::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retryStrategy").build()).build();
private static final SdkField STARTED_AT_FIELD = SdkField. builder(MarshallingType.LONG).memberName("startedAt")
.getter(getter(JobDetail::startedAt)).setter(setter(Builder::startedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedAt").build()).build();
private static final SdkField STOPPED_AT_FIELD = SdkField. builder(MarshallingType.LONG).memberName("stoppedAt")
.getter(getter(JobDetail::stoppedAt)).setter(setter(Builder::stoppedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stoppedAt").build()).build();
private static final SdkField> DEPENDS_ON_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("dependsOn")
.getter(getter(JobDetail::dependsOn))
.setter(setter(Builder::dependsOn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dependsOn").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(JobDependency::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField JOB_DEFINITION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobDefinition").getter(getter(JobDetail::jobDefinition)).setter(setter(Builder::jobDefinition))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobDefinition").build()).build();
private static final SdkField> PARAMETERS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("parameters")
.getter(getter(JobDetail::parameters))
.setter(setter(Builder::parameters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("parameters").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField CONTAINER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("container").getter(getter(JobDetail::container)).setter(setter(Builder::container))
.constructor(ContainerDetail::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("container").build()).build();
private static final SdkField NODE_DETAILS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("nodeDetails").getter(getter(JobDetail::nodeDetails)).setter(setter(Builder::nodeDetails))
.constructor(NodeDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeDetails").build()).build();
private static final SdkField NODE_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("nodeProperties")
.getter(getter(JobDetail::nodeProperties)).setter(setter(Builder::nodeProperties))
.constructor(NodeProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeProperties").build()).build();
private static final SdkField ARRAY_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("arrayProperties")
.getter(getter(JobDetail::arrayProperties)).setter(setter(Builder::arrayProperties))
.constructor(ArrayPropertiesDetail::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arrayProperties").build()).build();
private static final SdkField TIMEOUT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("timeout").getter(getter(JobDetail::timeout)).setter(setter(Builder::timeout))
.constructor(JobTimeout::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeout").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(JobDetail::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_ARN_FIELD, JOB_NAME_FIELD,
JOB_ID_FIELD, JOB_QUEUE_FIELD, STATUS_FIELD, ATTEMPTS_FIELD, STATUS_REASON_FIELD, CREATED_AT_FIELD,
RETRY_STRATEGY_FIELD, STARTED_AT_FIELD, STOPPED_AT_FIELD, DEPENDS_ON_FIELD, JOB_DEFINITION_FIELD, PARAMETERS_FIELD,
CONTAINER_FIELD, NODE_DETAILS_FIELD, NODE_PROPERTIES_FIELD, ARRAY_PROPERTIES_FIELD, TIMEOUT_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String jobArn;
private final String jobName;
private final String jobId;
private final String jobQueue;
private final String status;
private final List attempts;
private final String statusReason;
private final Long createdAt;
private final RetryStrategy retryStrategy;
private final Long startedAt;
private final Long stoppedAt;
private final List dependsOn;
private final String jobDefinition;
private final Map parameters;
private final ContainerDetail container;
private final NodeDetails nodeDetails;
private final NodeProperties nodeProperties;
private final ArrayPropertiesDetail arrayProperties;
private final JobTimeout timeout;
private final Map tags;
private JobDetail(BuilderImpl builder) {
this.jobArn = builder.jobArn;
this.jobName = builder.jobName;
this.jobId = builder.jobId;
this.jobQueue = builder.jobQueue;
this.status = builder.status;
this.attempts = builder.attempts;
this.statusReason = builder.statusReason;
this.createdAt = builder.createdAt;
this.retryStrategy = builder.retryStrategy;
this.startedAt = builder.startedAt;
this.stoppedAt = builder.stoppedAt;
this.dependsOn = builder.dependsOn;
this.jobDefinition = builder.jobDefinition;
this.parameters = builder.parameters;
this.container = builder.container;
this.nodeDetails = builder.nodeDetails;
this.nodeProperties = builder.nodeProperties;
this.arrayProperties = builder.arrayProperties;
this.timeout = builder.timeout;
this.tags = builder.tags;
}
/**
*
* The Amazon Resource Name (ARN) of the job.
*
*
* @return The Amazon Resource Name (ARN) of the job.
*/
public String jobArn() {
return jobArn;
}
/**
*
* The name of the job.
*
*
* @return The name of the job.
*/
public String jobName() {
return jobName;
}
/**
*
* The ID for the job.
*
*
* @return The ID for the job.
*/
public String jobId() {
return jobId;
}
/**
*
* The Amazon Resource Name (ARN) of the job queue with which the job is associated.
*
*
* @return The Amazon Resource Name (ARN) of the job queue with which the job is associated.
*/
public String jobQueue() {
return jobQueue;
}
/**
*
* The current status for the job.
*
*
*
* If your jobs do not progress to STARTING
, see Jobs Stuck
* in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status for the job.
*
* If your jobs do not progress to STARTING
, see Jobs
* Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
* @see JobStatus
*/
public JobStatus status() {
return JobStatus.fromValue(status);
}
/**
*
* The current status for the job.
*
*
*
* If your jobs do not progress to STARTING
, see Jobs Stuck
* in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status for the job.
*
* If your jobs do not progress to STARTING
, see Jobs
* Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
* @see JobStatus
*/
public String statusAsString() {
return status;
}
/**
* Returns true if the Attempts property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasAttempts() {
return attempts != null && !(attempts instanceof SdkAutoConstructList);
}
/**
*
* A list of job attempts associated with this job.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasAttempts()} to see if a value was sent in this field.
*
*
* @return A list of job attempts associated with this job.
*/
public List attempts() {
return attempts;
}
/**
*
* A short, human-readable string to provide additional details about the current status of the job.
*
*
* @return A short, human-readable string to provide additional details about the current status of the job.
*/
public String statusReason() {
return statusReason;
}
/**
*
* The Unix timestamp (in milliseconds) for when the job was created. For non-array jobs and parent array jobs, this
* is when the job entered the SUBMITTED
state (at the time SubmitJob was called). For array
* child jobs, this is when the child job was spawned by its parent and entered the PENDING
state.
*
*
* @return The Unix timestamp (in milliseconds) for when the job was created. For non-array jobs and parent array
* jobs, this is when the job entered the SUBMITTED
state (at the time SubmitJob was
* called). For array child jobs, this is when the child job was spawned by its parent and entered the
* PENDING
state.
*/
public Long createdAt() {
return createdAt;
}
/**
*
* The retry strategy to use for this job if an attempt fails.
*
*
* @return The retry strategy to use for this job if an attempt fails.
*/
public RetryStrategy retryStrategy() {
return retryStrategy;
}
/**
*
* The Unix timestamp (in milliseconds) for when the job was started (when the job transitioned from the
* STARTING
state to the RUNNING
state). This parameter is not provided for child jobs of
* array jobs or multi-node parallel jobs.
*
*
* @return The Unix timestamp (in milliseconds) for when the job was started (when the job transitioned from the
* STARTING
state to the RUNNING
state). This parameter is not provided for child
* jobs of array jobs or multi-node parallel jobs.
*/
public Long startedAt() {
return startedAt;
}
/**
*
* The Unix timestamp (in milliseconds) for when the job was stopped (when the job transitioned from the
* RUNNING
state to a terminal state, such as SUCCEEDED
or FAILED
).
*
*
* @return The Unix timestamp (in milliseconds) for when the job was stopped (when the job transitioned from the
* RUNNING
state to a terminal state, such as SUCCEEDED
or FAILED
).
*/
public Long stoppedAt() {
return stoppedAt;
}
/**
* Returns true if the DependsOn property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasDependsOn() {
return dependsOn != null && !(dependsOn instanceof SdkAutoConstructList);
}
/**
*
* A list of job IDs on which this job depends.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasDependsOn()} to see if a value was sent in this field.
*
*
* @return A list of job IDs on which this job depends.
*/
public List dependsOn() {
return dependsOn;
}
/**
*
* The job definition that is used by this job.
*
*
* @return The job definition that is used by this job.
*/
public String jobDefinition() {
return jobDefinition;
}
/**
* Returns true if the Parameters property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasParameters() {
return parameters != null && !(parameters instanceof SdkAutoConstructMap);
}
/**
*
* Additional parameters passed to the job that replace parameter substitution placeholders or override any
* corresponding parameter defaults from the job definition.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasParameters()} to see if a value was sent in this field.
*
*
* @return Additional parameters passed to the job that replace parameter substitution placeholders or override any
* corresponding parameter defaults from the job definition.
*/
public Map parameters() {
return parameters;
}
/**
*
* An object representing the details of the container that is associated with the job.
*
*
* @return An object representing the details of the container that is associated with the job.
*/
public ContainerDetail container() {
return container;
}
/**
*
* An object representing the details of a node that is associated with a multi-node parallel job.
*
*
* @return An object representing the details of a node that is associated with a multi-node parallel job.
*/
public NodeDetails nodeDetails() {
return nodeDetails;
}
/**
*
* An object representing the node properties of a multi-node parallel job.
*
*
* @return An object representing the node properties of a multi-node parallel job.
*/
public NodeProperties nodeProperties() {
return nodeProperties;
}
/**
*
* The array properties of the job, if it is an array job.
*
*
* @return The array properties of the job, if it is an array job.
*/
public ArrayPropertiesDetail arrayProperties() {
return arrayProperties;
}
/**
*
* The timeout configuration for the job.
*
*
* @return The timeout configuration for the job.
*/
public JobTimeout timeout() {
return timeout;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* The tags applied to the job.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return The tags applied to the job.
*/
public Map 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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(jobArn());
hashCode = 31 * hashCode + Objects.hashCode(jobName());
hashCode = 31 * hashCode + Objects.hashCode(jobId());
hashCode = 31 * hashCode + Objects.hashCode(jobQueue());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(attempts());
hashCode = 31 * hashCode + Objects.hashCode(statusReason());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(retryStrategy());
hashCode = 31 * hashCode + Objects.hashCode(startedAt());
hashCode = 31 * hashCode + Objects.hashCode(stoppedAt());
hashCode = 31 * hashCode + Objects.hashCode(dependsOn());
hashCode = 31 * hashCode + Objects.hashCode(jobDefinition());
hashCode = 31 * hashCode + Objects.hashCode(parameters());
hashCode = 31 * hashCode + Objects.hashCode(container());
hashCode = 31 * hashCode + Objects.hashCode(nodeDetails());
hashCode = 31 * hashCode + Objects.hashCode(nodeProperties());
hashCode = 31 * hashCode + Objects.hashCode(arrayProperties());
hashCode = 31 * hashCode + Objects.hashCode(timeout());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof JobDetail)) {
return false;
}
JobDetail other = (JobDetail) obj;
return Objects.equals(jobArn(), other.jobArn()) && Objects.equals(jobName(), other.jobName())
&& Objects.equals(jobId(), other.jobId()) && Objects.equals(jobQueue(), other.jobQueue())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(attempts(), other.attempts())
&& Objects.equals(statusReason(), other.statusReason()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(retryStrategy(), other.retryStrategy()) && Objects.equals(startedAt(), other.startedAt())
&& Objects.equals(stoppedAt(), other.stoppedAt()) && Objects.equals(dependsOn(), other.dependsOn())
&& Objects.equals(jobDefinition(), other.jobDefinition()) && Objects.equals(parameters(), other.parameters())
&& Objects.equals(container(), other.container()) && Objects.equals(nodeDetails(), other.nodeDetails())
&& Objects.equals(nodeProperties(), other.nodeProperties())
&& Objects.equals(arrayProperties(), other.arrayProperties()) && Objects.equals(timeout(), other.timeout())
&& 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 String toString() {
return ToString.builder("JobDetail").add("JobArn", jobArn()).add("JobName", jobName()).add("JobId", jobId())
.add("JobQueue", jobQueue()).add("Status", statusAsString()).add("Attempts", attempts())
.add("StatusReason", statusReason()).add("CreatedAt", createdAt()).add("RetryStrategy", retryStrategy())
.add("StartedAt", startedAt()).add("StoppedAt", stoppedAt()).add("DependsOn", dependsOn())
.add("JobDefinition", jobDefinition()).add("Parameters", parameters()).add("Container", container())
.add("NodeDetails", nodeDetails()).add("NodeProperties", nodeProperties())
.add("ArrayProperties", arrayProperties()).add("Timeout", timeout()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "jobArn":
return Optional.ofNullable(clazz.cast(jobArn()));
case "jobName":
return Optional.ofNullable(clazz.cast(jobName()));
case "jobId":
return Optional.ofNullable(clazz.cast(jobId()));
case "jobQueue":
return Optional.ofNullable(clazz.cast(jobQueue()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "attempts":
return Optional.ofNullable(clazz.cast(attempts()));
case "statusReason":
return Optional.ofNullable(clazz.cast(statusReason()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "retryStrategy":
return Optional.ofNullable(clazz.cast(retryStrategy()));
case "startedAt":
return Optional.ofNullable(clazz.cast(startedAt()));
case "stoppedAt":
return Optional.ofNullable(clazz.cast(stoppedAt()));
case "dependsOn":
return Optional.ofNullable(clazz.cast(dependsOn()));
case "jobDefinition":
return Optional.ofNullable(clazz.cast(jobDefinition()));
case "parameters":
return Optional.ofNullable(clazz.cast(parameters()));
case "container":
return Optional.ofNullable(clazz.cast(container()));
case "nodeDetails":
return Optional.ofNullable(clazz.cast(nodeDetails()));
case "nodeProperties":
return Optional.ofNullable(clazz.cast(nodeProperties()));
case "arrayProperties":
return Optional.ofNullable(clazz.cast(arrayProperties()));
case "timeout":
return Optional.ofNullable(clazz.cast(timeout()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((JobDetail) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) of the job.
*
*
* @param jobArn
* The Amazon Resource Name (ARN) of the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobArn(String jobArn);
/**
*
* The name of the job.
*
*
* @param jobName
* The name of the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobName(String jobName);
/**
*
* The ID for the job.
*
*
* @param jobId
* The ID for the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobId(String jobId);
/**
*
* The Amazon Resource Name (ARN) of the job queue with which the job is associated.
*
*
* @param jobQueue
* The Amazon Resource Name (ARN) of the job queue with which the job is associated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobQueue(String jobQueue);
/**
*
* The current status for the job.
*
*
*
* If your jobs do not progress to STARTING
, see Jobs
* Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
*
*
* @param status
* The current status for the job.
*
* If your jobs do not progress to STARTING
, see Jobs Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
* @see JobStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStatus
*/
Builder status(String status);
/**
*
* The current status for the job.
*
*
*
* If your jobs do not progress to STARTING
, see Jobs
* Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
*
*
* @param status
* The current status for the job.
*
* If your jobs do not progress to STARTING
, see Jobs Stuck in RUNNABLE Status in the troubleshooting section of the AWS Batch User Guide .
*
* @see JobStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStatus
*/
Builder status(JobStatus status);
/**
*
* A list of job attempts associated with this job.
*
*
* @param attempts
* A list of job attempts associated with this job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attempts(Collection attempts);
/**
*
* A list of job attempts associated with this job.
*
*
* @param attempts
* A list of job attempts associated with this job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attempts(AttemptDetail... attempts);
/**
*
* A list of job attempts associated with this job.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need
* to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #attempts(List)}.
*
* @param attempts
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #attempts(List)
*/
Builder attempts(Consumer... attempts);
/**
*
* A short, human-readable string to provide additional details about the current status of the job.
*
*
* @param statusReason
* A short, human-readable string to provide additional details about the current status of the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statusReason(String statusReason);
/**
*
* The Unix timestamp (in milliseconds) for when the job was created. For non-array jobs and parent array jobs,
* this is when the job entered the SUBMITTED
state (at the time SubmitJob was called). For
* array child jobs, this is when the child job was spawned by its parent and entered the PENDING
* state.
*
*
* @param createdAt
* The Unix timestamp (in milliseconds) for when the job was created. For non-array jobs and parent array
* jobs, this is when the job entered the SUBMITTED
state (at the time SubmitJob was
* called). For array child jobs, this is when the child job was spawned by its parent and entered the
* PENDING
state.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdAt(Long createdAt);
/**
*
* The retry strategy to use for this job if an attempt fails.
*
*
* @param retryStrategy
* The retry strategy to use for this job if an attempt fails.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder retryStrategy(RetryStrategy retryStrategy);
/**
*
* The retry strategy to use for this job if an attempt fails.
*
* This is a convenience that creates an instance of the {@link RetryStrategy.Builder} avoiding the need to
* create one manually via {@link RetryStrategy#builder()}.
*
* When the {@link Consumer} completes, {@link RetryStrategy.Builder#build()} is called immediately and its
* result is passed to {@link #retryStrategy(RetryStrategy)}.
*
* @param retryStrategy
* a consumer that will call methods on {@link RetryStrategy.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #retryStrategy(RetryStrategy)
*/
default Builder retryStrategy(Consumer retryStrategy) {
return retryStrategy(RetryStrategy.builder().applyMutation(retryStrategy).build());
}
/**
*
* The Unix timestamp (in milliseconds) for when the job was started (when the job transitioned from the
* STARTING
state to the RUNNING
state). This parameter is not provided for child jobs
* of array jobs or multi-node parallel jobs.
*
*
* @param startedAt
* The Unix timestamp (in milliseconds) for when the job was started (when the job transitioned from the
* STARTING
state to the RUNNING
state). This parameter is not provided for
* child jobs of array jobs or multi-node parallel jobs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startedAt(Long startedAt);
/**
*
* The Unix timestamp (in milliseconds) for when the job was stopped (when the job transitioned from the
* RUNNING
state to a terminal state, such as SUCCEEDED
or FAILED
).
*
*
* @param stoppedAt
* The Unix timestamp (in milliseconds) for when the job was stopped (when the job transitioned from the
* RUNNING
state to a terminal state, such as SUCCEEDED
or FAILED
* ).
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stoppedAt(Long stoppedAt);
/**
*
* A list of job IDs on which this job depends.
*
*
* @param dependsOn
* A list of job IDs on which this job depends.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dependsOn(Collection dependsOn);
/**
*
* A list of job IDs on which this job depends.
*
*
* @param dependsOn
* A list of job IDs on which this job depends.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dependsOn(JobDependency... dependsOn);
/**
*
* A list of job IDs on which this job depends.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need
* to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #dependsOn(List)}.
*
* @param dependsOn
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #dependsOn(List)
*/
Builder dependsOn(Consumer... dependsOn);
/**
*
* The job definition that is used by this job.
*
*
* @param jobDefinition
* The job definition that is used by this job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobDefinition(String jobDefinition);
/**
*
* Additional parameters passed to the job that replace parameter substitution placeholders or override any
* corresponding parameter defaults from the job definition.
*
*
* @param parameters
* Additional parameters passed to the job that replace parameter substitution placeholders or override
* any corresponding parameter defaults from the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder parameters(Map parameters);
/**
*
* An object representing the details of the container that is associated with the job.
*
*
* @param container
* An object representing the details of the container that is associated with the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder container(ContainerDetail container);
/**
*
* An object representing the details of the container that is associated with the job.
*
* This is a convenience that creates an instance of the {@link ContainerDetail.Builder} avoiding the need to
* create one manually via {@link ContainerDetail#builder()}.
*
* When the {@link Consumer} completes, {@link ContainerDetail.Builder#build()} is called immediately and its
* result is passed to {@link #container(ContainerDetail)}.
*
* @param container
* a consumer that will call methods on {@link ContainerDetail.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #container(ContainerDetail)
*/
default Builder container(Consumer container) {
return container(ContainerDetail.builder().applyMutation(container).build());
}
/**
*
* An object representing the details of a node that is associated with a multi-node parallel job.
*
*
* @param nodeDetails
* An object representing the details of a node that is associated with a multi-node parallel job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nodeDetails(NodeDetails nodeDetails);
/**
*
* An object representing the details of a node that is associated with a multi-node parallel job.
*
* This is a convenience that creates an instance of the {@link NodeDetails.Builder} avoiding the need to create
* one manually via {@link NodeDetails#builder()}.
*
* When the {@link Consumer} completes, {@link NodeDetails.Builder#build()} is called immediately and its result
* is passed to {@link #nodeDetails(NodeDetails)}.
*
* @param nodeDetails
* a consumer that will call methods on {@link NodeDetails.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #nodeDetails(NodeDetails)
*/
default Builder nodeDetails(Consumer nodeDetails) {
return nodeDetails(NodeDetails.builder().applyMutation(nodeDetails).build());
}
/**
*
* An object representing the node properties of a multi-node parallel job.
*
*
* @param nodeProperties
* An object representing the node properties of a multi-node parallel job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nodeProperties(NodeProperties nodeProperties);
/**
*
* An object representing the node properties of a multi-node parallel job.
*
* This is a convenience that creates an instance of the {@link NodeProperties.Builder} avoiding the need to
* create one manually via {@link NodeProperties#builder()}.
*
* When the {@link Consumer} completes, {@link NodeProperties.Builder#build()} is called immediately and its
* result is passed to {@link #nodeProperties(NodeProperties)}.
*
* @param nodeProperties
* a consumer that will call methods on {@link NodeProperties.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #nodeProperties(NodeProperties)
*/
default Builder nodeProperties(Consumer nodeProperties) {
return nodeProperties(NodeProperties.builder().applyMutation(nodeProperties).build());
}
/**
*
* The array properties of the job, if it is an array job.
*
*
* @param arrayProperties
* The array properties of the job, if it is an array job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder arrayProperties(ArrayPropertiesDetail arrayProperties);
/**
*
* The array properties of the job, if it is an array job.
*
* This is a convenience that creates an instance of the {@link ArrayPropertiesDetail.Builder} avoiding the need
* to create one manually via {@link ArrayPropertiesDetail#builder()}.
*
* When the {@link Consumer} completes, {@link ArrayPropertiesDetail.Builder#build()} is called immediately and
* its result is passed to {@link #arrayProperties(ArrayPropertiesDetail)}.
*
* @param arrayProperties
* a consumer that will call methods on {@link ArrayPropertiesDetail.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #arrayProperties(ArrayPropertiesDetail)
*/
default Builder arrayProperties(Consumer arrayProperties) {
return arrayProperties(ArrayPropertiesDetail.builder().applyMutation(arrayProperties).build());
}
/**
*
* The timeout configuration for the job.
*
*
* @param timeout
* The timeout configuration for the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder timeout(JobTimeout timeout);
/**
*
* The timeout configuration for the job.
*
* This is a convenience that creates an instance of the {@link JobTimeout.Builder} avoiding the need to create
* one manually via {@link JobTimeout#builder()}.
*
* When the {@link Consumer} completes, {@link JobTimeout.Builder#build()} is called immediately and its result
* is passed to {@link #timeout(JobTimeout)}.
*
* @param timeout
* a consumer that will call methods on {@link JobTimeout.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #timeout(JobTimeout)
*/
default Builder timeout(Consumer timeout) {
return timeout(JobTimeout.builder().applyMutation(timeout).build());
}
/**
*
* The tags applied to the job.
*
*
* @param tags
* The tags applied to the job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
}
static final class BuilderImpl implements Builder {
private String jobArn;
private String jobName;
private String jobId;
private String jobQueue;
private String status;
private List attempts = DefaultSdkAutoConstructList.getInstance();
private String statusReason;
private Long createdAt;
private RetryStrategy retryStrategy;
private Long startedAt;
private Long stoppedAt;
private List dependsOn = DefaultSdkAutoConstructList.getInstance();
private String jobDefinition;
private Map parameters = DefaultSdkAutoConstructMap.getInstance();
private ContainerDetail container;
private NodeDetails nodeDetails;
private NodeProperties nodeProperties;
private ArrayPropertiesDetail arrayProperties;
private JobTimeout timeout;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(JobDetail model) {
jobArn(model.jobArn);
jobName(model.jobName);
jobId(model.jobId);
jobQueue(model.jobQueue);
status(model.status);
attempts(model.attempts);
statusReason(model.statusReason);
createdAt(model.createdAt);
retryStrategy(model.retryStrategy);
startedAt(model.startedAt);
stoppedAt(model.stoppedAt);
dependsOn(model.dependsOn);
jobDefinition(model.jobDefinition);
parameters(model.parameters);
container(model.container);
nodeDetails(model.nodeDetails);
nodeProperties(model.nodeProperties);
arrayProperties(model.arrayProperties);
timeout(model.timeout);
tags(model.tags);
}
public final String getJobArn() {
return jobArn;
}
@Override
public final Builder jobArn(String jobArn) {
this.jobArn = jobArn;
return this;
}
public final void setJobArn(String jobArn) {
this.jobArn = jobArn;
}
public final String getJobName() {
return jobName;
}
@Override
public final Builder jobName(String jobName) {
this.jobName = jobName;
return this;
}
public final void setJobName(String jobName) {
this.jobName = jobName;
}
public final String getJobId() {
return jobId;
}
@Override
public final Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
public final void setJobId(String jobId) {
this.jobId = jobId;
}
public final String getJobQueue() {
return jobQueue;
}
@Override
public final Builder jobQueue(String jobQueue) {
this.jobQueue = jobQueue;
return this;
}
public final void setJobQueue(String jobQueue) {
this.jobQueue = jobQueue;
}
public final String getStatus() {
return status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
@Override
public final Builder status(JobStatus status) {
this.status(status == null ? null : status.toString());
return this;
}
public final void setStatus(String status) {
this.status = status;
}
public final Collection getAttempts() {
return attempts != null ? attempts.stream().map(AttemptDetail::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder attempts(Collection attempts) {
this.attempts = AttemptDetailsCopier.copy(attempts);
return this;
}
@Override
@SafeVarargs
public final Builder attempts(AttemptDetail... attempts) {
attempts(Arrays.asList(attempts));
return this;
}
@Override
@SafeVarargs
public final Builder attempts(Consumer... attempts) {
attempts(Stream.of(attempts).map(c -> AttemptDetail.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setAttempts(Collection attempts) {
this.attempts = AttemptDetailsCopier.copyFromBuilder(attempts);
}
public final String getStatusReason() {
return statusReason;
}
@Override
public final Builder statusReason(String statusReason) {
this.statusReason = statusReason;
return this;
}
public final void setStatusReason(String statusReason) {
this.statusReason = statusReason;
}
public final Long getCreatedAt() {
return createdAt;
}
@Override
public final Builder createdAt(Long createdAt) {
this.createdAt = createdAt;
return this;
}
public final void setCreatedAt(Long createdAt) {
this.createdAt = createdAt;
}
public final RetryStrategy.Builder getRetryStrategy() {
return retryStrategy != null ? retryStrategy.toBuilder() : null;
}
@Override
public final Builder retryStrategy(RetryStrategy retryStrategy) {
this.retryStrategy = retryStrategy;
return this;
}
public final void setRetryStrategy(RetryStrategy.BuilderImpl retryStrategy) {
this.retryStrategy = retryStrategy != null ? retryStrategy.build() : null;
}
public final Long getStartedAt() {
return startedAt;
}
@Override
public final Builder startedAt(Long startedAt) {
this.startedAt = startedAt;
return this;
}
public final void setStartedAt(Long startedAt) {
this.startedAt = startedAt;
}
public final Long getStoppedAt() {
return stoppedAt;
}
@Override
public final Builder stoppedAt(Long stoppedAt) {
this.stoppedAt = stoppedAt;
return this;
}
public final void setStoppedAt(Long stoppedAt) {
this.stoppedAt = stoppedAt;
}
public final Collection getDependsOn() {
return dependsOn != null ? dependsOn.stream().map(JobDependency::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder dependsOn(Collection dependsOn) {
this.dependsOn = JobDependencyListCopier.copy(dependsOn);
return this;
}
@Override
@SafeVarargs
public final Builder dependsOn(JobDependency... dependsOn) {
dependsOn(Arrays.asList(dependsOn));
return this;
}
@Override
@SafeVarargs
public final Builder dependsOn(Consumer... dependsOn) {
dependsOn(Stream.of(dependsOn).map(c -> JobDependency.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setDependsOn(Collection dependsOn) {
this.dependsOn = JobDependencyListCopier.copyFromBuilder(dependsOn);
}
public final String getJobDefinition() {
return jobDefinition;
}
@Override
public final Builder jobDefinition(String jobDefinition) {
this.jobDefinition = jobDefinition;
return this;
}
public final void setJobDefinition(String jobDefinition) {
this.jobDefinition = jobDefinition;
}
public final Map getParameters() {
return parameters;
}
@Override
public final Builder parameters(Map parameters) {
this.parameters = ParametersMapCopier.copy(parameters);
return this;
}
public final void setParameters(Map parameters) {
this.parameters = ParametersMapCopier.copy(parameters);
}
public final ContainerDetail.Builder getContainer() {
return container != null ? container.toBuilder() : null;
}
@Override
public final Builder container(ContainerDetail container) {
this.container = container;
return this;
}
public final void setContainer(ContainerDetail.BuilderImpl container) {
this.container = container != null ? container.build() : null;
}
public final NodeDetails.Builder getNodeDetails() {
return nodeDetails != null ? nodeDetails.toBuilder() : null;
}
@Override
public final Builder nodeDetails(NodeDetails nodeDetails) {
this.nodeDetails = nodeDetails;
return this;
}
public final void setNodeDetails(NodeDetails.BuilderImpl nodeDetails) {
this.nodeDetails = nodeDetails != null ? nodeDetails.build() : null;
}
public final NodeProperties.Builder getNodeProperties() {
return nodeProperties != null ? nodeProperties.toBuilder() : null;
}
@Override
public final Builder nodeProperties(NodeProperties nodeProperties) {
this.nodeProperties = nodeProperties;
return this;
}
public final void setNodeProperties(NodeProperties.BuilderImpl nodeProperties) {
this.nodeProperties = nodeProperties != null ? nodeProperties.build() : null;
}
public final ArrayPropertiesDetail.Builder getArrayProperties() {
return arrayProperties != null ? arrayProperties.toBuilder() : null;
}
@Override
public final Builder arrayProperties(ArrayPropertiesDetail arrayProperties) {
this.arrayProperties = arrayProperties;
return this;
}
public final void setArrayProperties(ArrayPropertiesDetail.BuilderImpl arrayProperties) {
this.arrayProperties = arrayProperties != null ? arrayProperties.build() : null;
}
public final JobTimeout.Builder getTimeout() {
return timeout != null ? timeout.toBuilder() : null;
}
@Override
public final Builder timeout(JobTimeout timeout) {
this.timeout = timeout;
return this;
}
public final void setTimeout(JobTimeout.BuilderImpl timeout) {
this.timeout = timeout != null ? timeout.build() : null;
}
public final Map getTags() {
return tags;
}
@Override
public final Builder tags(Map tags) {
this.tags = TagrisTagsMapCopier.copy(tags);
return this;
}
public final void setTags(Map tags) {
this.tags = TagrisTagsMapCopier.copy(tags);
}
@Override
public JobDetail build() {
return new JobDetail(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}