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.JobDefinition Maven / Gradle / Ivy
Go to download
The AWS Java SDK for AWS Batch module holds the client classes that are used for communicating with AWS
Batch.
/*
* 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 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 definition.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JobDefinition implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField JOB_DEFINITION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobDefinitionName").getter(getter(JobDefinition::jobDefinitionName))
.setter(setter(Builder::jobDefinitionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobDefinitionName").build()).build();
private static final SdkField JOB_DEFINITION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobDefinitionArn").getter(getter(JobDefinition::jobDefinitionArn))
.setter(setter(Builder::jobDefinitionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobDefinitionArn").build()).build();
private static final SdkField REVISION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("revision").getter(getter(JobDefinition::revision)).setter(setter(Builder::revision))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("revision").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(JobDefinition::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
.getter(getter(JobDefinition::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField> PARAMETERS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("parameters")
.getter(getter(JobDefinition::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 RETRY_STRATEGY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("retryStrategy")
.getter(getter(JobDefinition::retryStrategy)).setter(setter(Builder::retryStrategy))
.constructor(RetryStrategy::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retryStrategy").build()).build();
private static final SdkField CONTAINER_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("containerProperties")
.getter(getter(JobDefinition::containerProperties)).setter(setter(Builder::containerProperties))
.constructor(ContainerProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerProperties").build())
.build();
private static final SdkField TIMEOUT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("timeout").getter(getter(JobDefinition::timeout)).setter(setter(Builder::timeout))
.constructor(JobTimeout::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeout").build()).build();
private static final SdkField NODE_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("nodeProperties")
.getter(getter(JobDefinition::nodeProperties)).setter(setter(Builder::nodeProperties))
.constructor(NodeProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeProperties").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(JobDefinition::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 SdkField PROPAGATE_TAGS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("propagateTags").getter(getter(JobDefinition::propagateTags)).setter(setter(Builder::propagateTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("propagateTags").build()).build();
private static final SdkField> PLATFORM_CAPABILITIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("platformCapabilities")
.getter(getter(JobDefinition::platformCapabilitiesAsStrings))
.setter(setter(Builder::platformCapabilitiesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platformCapabilities").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_DEFINITION_NAME_FIELD,
JOB_DEFINITION_ARN_FIELD, REVISION_FIELD, STATUS_FIELD, TYPE_FIELD, PARAMETERS_FIELD, RETRY_STRATEGY_FIELD,
CONTAINER_PROPERTIES_FIELD, TIMEOUT_FIELD, NODE_PROPERTIES_FIELD, TAGS_FIELD, PROPAGATE_TAGS_FIELD,
PLATFORM_CAPABILITIES_FIELD));
private static final long serialVersionUID = 1L;
private final String jobDefinitionName;
private final String jobDefinitionArn;
private final Integer revision;
private final String status;
private final String type;
private final Map parameters;
private final RetryStrategy retryStrategy;
private final ContainerProperties containerProperties;
private final JobTimeout timeout;
private final NodeProperties nodeProperties;
private final Map tags;
private final Boolean propagateTags;
private final List platformCapabilities;
private JobDefinition(BuilderImpl builder) {
this.jobDefinitionName = builder.jobDefinitionName;
this.jobDefinitionArn = builder.jobDefinitionArn;
this.revision = builder.revision;
this.status = builder.status;
this.type = builder.type;
this.parameters = builder.parameters;
this.retryStrategy = builder.retryStrategy;
this.containerProperties = builder.containerProperties;
this.timeout = builder.timeout;
this.nodeProperties = builder.nodeProperties;
this.tags = builder.tags;
this.propagateTags = builder.propagateTags;
this.platformCapabilities = builder.platformCapabilities;
}
/**
*
* The name of the job definition.
*
*
* @return The name of the job definition.
*/
public final String jobDefinitionName() {
return jobDefinitionName;
}
/**
*
* The Amazon Resource Name (ARN) for the job definition.
*
*
* @return The Amazon Resource Name (ARN) for the job definition.
*/
public final String jobDefinitionArn() {
return jobDefinitionArn;
}
/**
*
* The revision of the job definition.
*
*
* @return The revision of the job definition.
*/
public final Integer revision() {
return revision;
}
/**
*
* The status of the job definition.
*
*
* @return The status of the job definition.
*/
public final String status() {
return status;
}
/**
*
* The type of job definition. If the job is run on Fargate resources, then multinode
isn't supported.
* For more information about multi-node parallel jobs, see Creating a multi-node parallel
* job definition in the AWS Batch User Guide .
*
*
* @return The type of job definition. If the job is run on Fargate resources, then multinode
isn't
* supported. For more information about multi-node parallel jobs, see Creating a multi-node
* parallel job definition in the AWS Batch User Guide .
*/
public final String type() {
return type;
}
/**
* 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 final boolean hasParameters() {
return parameters != null && !(parameters instanceof SdkAutoConstructMap);
}
/**
*
* Default parameters or parameter substitution placeholders that are set in the job definition. Parameters are
* specified as a key-value pair mapping. Parameters in a SubmitJob
request override any corresponding
* parameter defaults from the job definition. For more information about specifying parameters, see Job Definition
* Parameters in the AWS Batch User Guide .
*
*
* 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 Default parameters or parameter substitution placeholders that are set in the job definition. Parameters
* are specified as a key-value pair mapping. Parameters in a SubmitJob
request override any
* corresponding parameter defaults from the job definition. For more information about specifying
* parameters, see Job Definition
* Parameters in the AWS Batch User Guide .
*/
public final Map parameters() {
return parameters;
}
/**
*
* The retry strategy to use for failed jobs that are submitted with this job definition.
*
*
* @return The retry strategy to use for failed jobs that are submitted with this job definition.
*/
public final RetryStrategy retryStrategy() {
return retryStrategy;
}
/**
*
* An object with various properties specific to container-based jobs.
*
*
* @return An object with various properties specific to container-based jobs.
*/
public final ContainerProperties containerProperties() {
return containerProperties;
}
/**
*
* The timeout configuration for jobs that are submitted with this job definition. You can specify a timeout
* duration after which AWS Batch terminates your jobs if they haven't finished.
*
*
* @return The timeout configuration for jobs that are submitted with this job definition. You can specify a timeout
* duration after which AWS Batch terminates your jobs if they haven't finished.
*/
public final JobTimeout timeout() {
return timeout;
}
/**
*
* An object with various properties specific to multi-node parallel jobs.
*
*
*
* If the job runs on Fargate resources, then you must not specify nodeProperties
; use
* containerProperties
instead.
*
*
*
* @return An object with various properties specific to multi-node parallel jobs.
*
* If the job runs on Fargate resources, then you must not specify nodeProperties
; use
* containerProperties
instead.
*
*/
public final NodeProperties nodeProperties() {
return nodeProperties;
}
/**
* 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 final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* The tags applied to the job definition.
*
*
* 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 definition.
*/
public final Map tags() {
return tags;
}
/**
*
* Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS task. If
* no value is specified, the tags aren't propagated. Tags can only be propagated to the tasks during task creation.
* For tags with the same name, job tags are given priority over job definitions tags. If the total number of
* combined tags from the job and job definition is over 50, the job is moved to the FAILED
state.
*
*
* @return Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS
* task. If no value is specified, the tags aren't propagated. Tags can only be propagated to the tasks
* during task creation. For tags with the same name, job tags are given priority over job definitions tags.
* If the total number of combined tags from the job and job definition is over 50, the job is moved to the
* FAILED
state.
*/
public final Boolean propagateTags() {
return propagateTags;
}
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasPlatformCapabilities()} to see if a value was sent in this field.
*
*
* @return The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*/
public final List platformCapabilities() {
return PlatformCapabilityListCopier.copyStringToEnum(platformCapabilities);
}
/**
* Returns true if the PlatformCapabilities 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 final boolean hasPlatformCapabilities() {
return platformCapabilities != null && !(platformCapabilities instanceof SdkAutoConstructList);
}
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasPlatformCapabilities()} to see if a value was sent in this field.
*
*
* @return The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*/
public final List platformCapabilitiesAsStrings() {
return platformCapabilities;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(jobDefinitionName());
hashCode = 31 * hashCode + Objects.hashCode(jobDefinitionArn());
hashCode = 31 * hashCode + Objects.hashCode(revision());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(type());
hashCode = 31 * hashCode + Objects.hashCode(hasParameters() ? parameters() : null);
hashCode = 31 * hashCode + Objects.hashCode(retryStrategy());
hashCode = 31 * hashCode + Objects.hashCode(containerProperties());
hashCode = 31 * hashCode + Objects.hashCode(timeout());
hashCode = 31 * hashCode + Objects.hashCode(nodeProperties());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(propagateTags());
hashCode = 31 * hashCode + Objects.hashCode(hasPlatformCapabilities() ? platformCapabilitiesAsStrings() : 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 JobDefinition)) {
return false;
}
JobDefinition other = (JobDefinition) obj;
return Objects.equals(jobDefinitionName(), other.jobDefinitionName())
&& Objects.equals(jobDefinitionArn(), other.jobDefinitionArn()) && Objects.equals(revision(), other.revision())
&& Objects.equals(status(), other.status()) && Objects.equals(type(), other.type())
&& hasParameters() == other.hasParameters() && Objects.equals(parameters(), other.parameters())
&& Objects.equals(retryStrategy(), other.retryStrategy())
&& Objects.equals(containerProperties(), other.containerProperties())
&& Objects.equals(timeout(), other.timeout()) && Objects.equals(nodeProperties(), other.nodeProperties())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags())
&& Objects.equals(propagateTags(), other.propagateTags())
&& hasPlatformCapabilities() == other.hasPlatformCapabilities()
&& Objects.equals(platformCapabilitiesAsStrings(), other.platformCapabilitiesAsStrings());
}
/**
* 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("JobDefinition").add("JobDefinitionName", jobDefinitionName())
.add("JobDefinitionArn", jobDefinitionArn()).add("Revision", revision()).add("Status", status())
.add("Type", type()).add("Parameters", hasParameters() ? parameters() : null)
.add("RetryStrategy", retryStrategy()).add("ContainerProperties", containerProperties())
.add("Timeout", timeout()).add("NodeProperties", nodeProperties()).add("Tags", hasTags() ? tags() : null)
.add("PropagateTags", propagateTags())
.add("PlatformCapabilities", hasPlatformCapabilities() ? platformCapabilitiesAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "jobDefinitionName":
return Optional.ofNullable(clazz.cast(jobDefinitionName()));
case "jobDefinitionArn":
return Optional.ofNullable(clazz.cast(jobDefinitionArn()));
case "revision":
return Optional.ofNullable(clazz.cast(revision()));
case "status":
return Optional.ofNullable(clazz.cast(status()));
case "type":
return Optional.ofNullable(clazz.cast(type()));
case "parameters":
return Optional.ofNullable(clazz.cast(parameters()));
case "retryStrategy":
return Optional.ofNullable(clazz.cast(retryStrategy()));
case "containerProperties":
return Optional.ofNullable(clazz.cast(containerProperties()));
case "timeout":
return Optional.ofNullable(clazz.cast(timeout()));
case "nodeProperties":
return Optional.ofNullable(clazz.cast(nodeProperties()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "propagateTags":
return Optional.ofNullable(clazz.cast(propagateTags()));
case "platformCapabilities":
return Optional.ofNullable(clazz.cast(platformCapabilitiesAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((JobDefinition) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The name of the job definition.
*
*
* @param jobDefinitionName
* The name of the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobDefinitionName(String jobDefinitionName);
/**
*
* The Amazon Resource Name (ARN) for the job definition.
*
*
* @param jobDefinitionArn
* The Amazon Resource Name (ARN) for the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder jobDefinitionArn(String jobDefinitionArn);
/**
*
* The revision of the job definition.
*
*
* @param revision
* The revision of the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder revision(Integer revision);
/**
*
* The status of the job definition.
*
*
* @param status
* The status of the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder status(String status);
/**
*
* The type of job definition. If the job is run on Fargate resources, then multinode
isn't
* supported. For more information about multi-node parallel jobs, see Creating a multi-node
* parallel job definition in the AWS Batch User Guide .
*
*
* @param type
* The type of job definition. If the job is run on Fargate resources, then multinode
isn't
* supported. For more information about multi-node parallel jobs, see Creating a
* multi-node parallel job definition in the AWS Batch User Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder type(String type);
/**
*
* Default parameters or parameter substitution placeholders that are set in the job definition. Parameters are
* specified as a key-value pair mapping. Parameters in a SubmitJob
request override any
* corresponding parameter defaults from the job definition. For more information about specifying parameters,
* see Job
* Definition Parameters in the AWS Batch User Guide .
*
*
* @param parameters
* Default parameters or parameter substitution placeholders that are set in the job definition.
* Parameters are specified as a key-value pair mapping. Parameters in a SubmitJob
request
* override any corresponding parameter defaults from the job definition. For more information about
* specifying parameters, see Job
* Definition Parameters in the AWS Batch User Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder parameters(Map parameters);
/**
*
* The retry strategy to use for failed jobs that are submitted with this job definition.
*
*
* @param retryStrategy
* The retry strategy to use for failed jobs that are submitted with this job definition.
* @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 failed jobs that are submitted with this job definition.
*
* 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());
}
/**
*
* An object with various properties specific to container-based jobs.
*
*
* @param containerProperties
* An object with various properties specific to container-based jobs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder containerProperties(ContainerProperties containerProperties);
/**
*
* An object with various properties specific to container-based jobs.
*
* This is a convenience that creates an instance of the {@link ContainerProperties.Builder} avoiding the need
* to create one manually via {@link ContainerProperties#builder()}.
*
* When the {@link Consumer} completes, {@link ContainerProperties.Builder#build()} is called immediately and
* its result is passed to {@link #containerProperties(ContainerProperties)}.
*
* @param containerProperties
* a consumer that will call methods on {@link ContainerProperties.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #containerProperties(ContainerProperties)
*/
default Builder containerProperties(Consumer containerProperties) {
return containerProperties(ContainerProperties.builder().applyMutation(containerProperties).build());
}
/**
*
* The timeout configuration for jobs that are submitted with this job definition. You can specify a timeout
* duration after which AWS Batch terminates your jobs if they haven't finished.
*
*
* @param timeout
* The timeout configuration for jobs that are submitted with this job definition. You can specify a
* timeout duration after which AWS Batch terminates your jobs if they haven't finished.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder timeout(JobTimeout timeout);
/**
*
* The timeout configuration for jobs that are submitted with this job definition. You can specify a timeout
* duration after which AWS Batch terminates your jobs if they haven't finished.
*
* 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());
}
/**
*
* An object with various properties specific to multi-node parallel jobs.
*
*
*
* If the job runs on Fargate resources, then you must not specify nodeProperties
; use
* containerProperties
instead.
*
*
*
* @param nodeProperties
* An object with various properties specific to multi-node parallel jobs.
*
* If the job runs on Fargate resources, then you must not specify nodeProperties
; use
* containerProperties
instead.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nodeProperties(NodeProperties nodeProperties);
/**
*
* An object with various properties specific to multi-node parallel jobs.
*
*
*
* If the job runs on Fargate resources, then you must not specify nodeProperties
; use
* containerProperties
instead.
*
* 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 tags applied to the job definition.
*
*
* @param tags
* The tags applied to the job definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
/**
*
* Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS task.
* If no value is specified, the tags aren't propagated. Tags can only be propagated to the tasks during task
* creation. For tags with the same name, job tags are given priority over job definitions tags. If the total
* number of combined tags from the job and job definition is over 50, the job is moved to the
* FAILED
state.
*
*
* @param propagateTags
* Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS
* task. If no value is specified, the tags aren't propagated. Tags can only be propagated to the tasks
* during task creation. For tags with the same name, job tags are given priority over job definitions
* tags. If the total number of combined tags from the job and job definition is over 50, the job is
* moved to the FAILED
state.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder propagateTags(Boolean propagateTags);
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* @param platformCapabilities
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder platformCapabilitiesWithStrings(Collection platformCapabilities);
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* @param platformCapabilities
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder platformCapabilitiesWithStrings(String... platformCapabilities);
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* @param platformCapabilities
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder platformCapabilities(Collection platformCapabilities);
/**
*
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
*
*
* @param platformCapabilities
* The platform capabilities required by the job definition. If no value is specified, it defaults to
* EC2
. Jobs run on Fargate resources specify FARGATE
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder platformCapabilities(PlatformCapability... platformCapabilities);
}
static final class BuilderImpl implements Builder {
private String jobDefinitionName;
private String jobDefinitionArn;
private Integer revision;
private String status;
private String type;
private Map parameters = DefaultSdkAutoConstructMap.getInstance();
private RetryStrategy retryStrategy;
private ContainerProperties containerProperties;
private JobTimeout timeout;
private NodeProperties nodeProperties;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private Boolean propagateTags;
private List platformCapabilities = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(JobDefinition model) {
jobDefinitionName(model.jobDefinitionName);
jobDefinitionArn(model.jobDefinitionArn);
revision(model.revision);
status(model.status);
type(model.type);
parameters(model.parameters);
retryStrategy(model.retryStrategy);
containerProperties(model.containerProperties);
timeout(model.timeout);
nodeProperties(model.nodeProperties);
tags(model.tags);
propagateTags(model.propagateTags);
platformCapabilitiesWithStrings(model.platformCapabilities);
}
public final String getJobDefinitionName() {
return jobDefinitionName;
}
@Override
public final Builder jobDefinitionName(String jobDefinitionName) {
this.jobDefinitionName = jobDefinitionName;
return this;
}
public final void setJobDefinitionName(String jobDefinitionName) {
this.jobDefinitionName = jobDefinitionName;
}
public final String getJobDefinitionArn() {
return jobDefinitionArn;
}
@Override
public final Builder jobDefinitionArn(String jobDefinitionArn) {
this.jobDefinitionArn = jobDefinitionArn;
return this;
}
public final void setJobDefinitionArn(String jobDefinitionArn) {
this.jobDefinitionArn = jobDefinitionArn;
}
public final Integer getRevision() {
return revision;
}
@Override
public final Builder revision(Integer revision) {
this.revision = revision;
return this;
}
public final void setRevision(Integer revision) {
this.revision = revision;
}
public final String getStatus() {
return status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
public final void setStatus(String status) {
this.status = status;
}
public final String getType() {
return type;
}
@Override
public final Builder type(String type) {
this.type = type;
return this;
}
public final void setType(String type) {
this.type = type;
}
public final Map getParameters() {
if (parameters instanceof SdkAutoConstructMap) {
return null;
}
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 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 ContainerProperties.Builder getContainerProperties() {
return containerProperties != null ? containerProperties.toBuilder() : null;
}
@Override
public final Builder containerProperties(ContainerProperties containerProperties) {
this.containerProperties = containerProperties;
return this;
}
public final void setContainerProperties(ContainerProperties.BuilderImpl containerProperties) {
this.containerProperties = containerProperties != null ? containerProperties.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 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 Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
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);
}
public final Boolean getPropagateTags() {
return propagateTags;
}
@Override
public final Builder propagateTags(Boolean propagateTags) {
this.propagateTags = propagateTags;
return this;
}
public final void setPropagateTags(Boolean propagateTags) {
this.propagateTags = propagateTags;
}
public final Collection getPlatformCapabilities() {
if (platformCapabilities instanceof SdkAutoConstructList) {
return null;
}
return platformCapabilities;
}
@Override
public final Builder platformCapabilitiesWithStrings(Collection platformCapabilities) {
this.platformCapabilities = PlatformCapabilityListCopier.copy(platformCapabilities);
return this;
}
@Override
@SafeVarargs
public final Builder platformCapabilitiesWithStrings(String... platformCapabilities) {
platformCapabilitiesWithStrings(Arrays.asList(platformCapabilities));
return this;
}
@Override
public final Builder platformCapabilities(Collection platformCapabilities) {
this.platformCapabilities = PlatformCapabilityListCopier.copyEnumToString(platformCapabilities);
return this;
}
@Override
@SafeVarargs
public final Builder platformCapabilities(PlatformCapability... platformCapabilities) {
platformCapabilities(Arrays.asList(platformCapabilities));
return this;
}
public final void setPlatformCapabilities(Collection platformCapabilities) {
this.platformCapabilities = PlatformCapabilityListCopier.copy(platformCapabilities);
}
@Override
public JobDefinition build() {
return new JobDefinition(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}