Class CfnJobDefinition

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.552Z") @Stability(Stable) public class CfnJobDefinition extends CfnResource implements IInspectable
A CloudFormation AWS::Batch::JobDefinition.

The AWS::Batch::JobDefinition resource specifies the parameters for an AWS Batch job definition. For more information, see Job Definitions in the ** .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.batch.*;
 Object labels;
 Object limits;
 Object options;
 Object parameters;
 Object requests;
 Object tags;
 CfnJobDefinition cfnJobDefinition = CfnJobDefinition.Builder.create(this, "MyCfnJobDefinition")
         .type("type")
         // the properties below are optional
         .containerProperties(ContainerPropertiesProperty.builder()
                 .image("image")
                 // the properties below are optional
                 .command(List.of("command"))
                 .environment(List.of(EnvironmentProperty.builder()
                         .name("name")
                         .value("value")
                         .build()))
                 .ephemeralStorage(EphemeralStorageProperty.builder()
                         .sizeInGiB(123)
                         .build())
                 .executionRoleArn("executionRoleArn")
                 .fargatePlatformConfiguration(FargatePlatformConfigurationProperty.builder()
                         .platformVersion("platformVersion")
                         .build())
                 .instanceType("instanceType")
                 .jobRoleArn("jobRoleArn")
                 .linuxParameters(LinuxParametersProperty.builder()
                         .devices(List.of(DeviceProperty.builder()
                                 .containerPath("containerPath")
                                 .hostPath("hostPath")
                                 .permissions(List.of("permissions"))
                                 .build()))
                         .initProcessEnabled(false)
                         .maxSwap(123)
                         .sharedMemorySize(123)
                         .swappiness(123)
                         .tmpfs(List.of(TmpfsProperty.builder()
                                 .containerPath("containerPath")
                                 .size(123)
                                 // the properties below are optional
                                 .mountOptions(List.of("mountOptions"))
                                 .build()))
                         .build())
                 .logConfiguration(LogConfigurationProperty.builder()
                         .logDriver("logDriver")
                         // the properties below are optional
                         .options(options)
                         .secretOptions(List.of(SecretProperty.builder()
                                 .name("name")
                                 .valueFrom("valueFrom")
                                 .build()))
                         .build())
                 .memory(123)
                 .mountPoints(List.of(MountPointsProperty.builder()
                         .containerPath("containerPath")
                         .readOnly(false)
                         .sourceVolume("sourceVolume")
                         .build()))
                 .networkConfiguration(NetworkConfigurationProperty.builder()
                         .assignPublicIp("assignPublicIp")
                         .build())
                 .privileged(false)
                 .readonlyRootFilesystem(false)
                 .resourceRequirements(List.of(ResourceRequirementProperty.builder()
                         .type("type")
                         .value("value")
                         .build()))
                 .secrets(List.of(SecretProperty.builder()
                         .name("name")
                         .valueFrom("valueFrom")
                         .build()))
                 .ulimits(List.of(UlimitProperty.builder()
                         .hardLimit(123)
                         .name("name")
                         .softLimit(123)
                         .build()))
                 .user("user")
                 .vcpus(123)
                 .volumes(List.of(VolumesProperty.builder()
                         .efsVolumeConfiguration(EfsVolumeConfigurationProperty.builder()
                                 .fileSystemId("fileSystemId")
                                 // the properties below are optional
                                 .authorizationConfig(AuthorizationConfigProperty.builder()
                                         .accessPointId("accessPointId")
                                         .iam("iam")
                                         .build())
                                 .rootDirectory("rootDirectory")
                                 .transitEncryption("transitEncryption")
                                 .transitEncryptionPort(123)
                                 .build())
                         .host(VolumesHostProperty.builder()
                                 .sourcePath("sourcePath")
                                 .build())
                         .name("name")
                         .build()))
                 .build())
         .eksProperties(EksPropertiesProperty.builder()
                 .podProperties(PodPropertiesProperty.builder()
                         .containers(List.of(EksContainerProperty.builder()
                                 .image("image")
                                 // the properties below are optional
                                 .args(List.of("args"))
                                 .command(List.of("command"))
                                 .env(List.of(EksContainerEnvironmentVariableProperty.builder()
                                         .name("name")
                                         // the properties below are optional
                                         .value("value")
                                         .build()))
                                 .imagePullPolicy("imagePullPolicy")
                                 .name("name")
                                 .resources(ResourcesProperty.builder()
                                         .limits(limits)
                                         .requests(requests)
                                         .build())
                                 .securityContext(SecurityContextProperty.builder()
                                         .privileged(false)
                                         .readOnlyRootFilesystem(false)
                                         .runAsGroup(123)
                                         .runAsNonRoot(false)
                                         .runAsUser(123)
                                         .build())
                                 .volumeMounts(List.of(EksContainerVolumeMountProperty.builder()
                                         .mountPath("mountPath")
                                         .name("name")
                                         .readOnly(false)
                                         .build()))
                                 .build()))
                         .dnsPolicy("dnsPolicy")
                         .hostNetwork(false)
                         .metadata(MetadataProperty.builder()
                                 .labels(labels)
                                 .build())
                         .serviceAccountName("serviceAccountName")
                         .volumes(List.of(EksVolumeProperty.builder()
                                 .name("name")
                                 // the properties below are optional
                                 .emptyDir(EmptyDirProperty.builder()
                                         .medium("medium")
                                         .sizeLimit("sizeLimit")
                                         .build())
                                 .hostPath(HostPathProperty.builder()
                                         .path("path")
                                         .build())
                                 .secret(EksSecretProperty.builder()
                                         .secretName("secretName")
                                         // the properties below are optional
                                         .optional(false)
                                         .build())
                                 .build()))
                         .build())
                 .build())
         .jobDefinitionName("jobDefinitionName")
         .nodeProperties(NodePropertiesProperty.builder()
                 .mainNode(123)
                 .nodeRangeProperties(List.of(NodeRangePropertyProperty.builder()
                         .targetNodes("targetNodes")
                         // the properties below are optional
                         .container(ContainerPropertiesProperty.builder()
                                 .image("image")
                                 // the properties below are optional
                                 .command(List.of("command"))
                                 .environment(List.of(EnvironmentProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .ephemeralStorage(EphemeralStorageProperty.builder()
                                         .sizeInGiB(123)
                                         .build())
                                 .executionRoleArn("executionRoleArn")
                                 .fargatePlatformConfiguration(FargatePlatformConfigurationProperty.builder()
                                         .platformVersion("platformVersion")
                                         .build())
                                 .instanceType("instanceType")
                                 .jobRoleArn("jobRoleArn")
                                 .linuxParameters(LinuxParametersProperty.builder()
                                         .devices(List.of(DeviceProperty.builder()
                                                 .containerPath("containerPath")
                                                 .hostPath("hostPath")
                                                 .permissions(List.of("permissions"))
                                                 .build()))
                                         .initProcessEnabled(false)
                                         .maxSwap(123)
                                         .sharedMemorySize(123)
                                         .swappiness(123)
                                         .tmpfs(List.of(TmpfsProperty.builder()
                                                 .containerPath("containerPath")
                                                 .size(123)
                                                 // the properties below are optional
                                                 .mountOptions(List.of("mountOptions"))
                                                 .build()))
                                         .build())
                                 .logConfiguration(LogConfigurationProperty.builder()
                                         .logDriver("logDriver")
                                         // the properties below are optional
                                         .options(options)
                                         .secretOptions(List.of(SecretProperty.builder()
                                                 .name("name")
                                                 .valueFrom("valueFrom")
                                                 .build()))
                                         .build())
                                 .memory(123)
                                 .mountPoints(List.of(MountPointsProperty.builder()
                                         .containerPath("containerPath")
                                         .readOnly(false)
                                         .sourceVolume("sourceVolume")
                                         .build()))
                                 .networkConfiguration(NetworkConfigurationProperty.builder()
                                         .assignPublicIp("assignPublicIp")
                                         .build())
                                 .privileged(false)
                                 .readonlyRootFilesystem(false)
                                 .resourceRequirements(List.of(ResourceRequirementProperty.builder()
                                         .type("type")
                                         .value("value")
                                         .build()))
                                 .secrets(List.of(SecretProperty.builder()
                                         .name("name")
                                         .valueFrom("valueFrom")
                                         .build()))
                                 .ulimits(List.of(UlimitProperty.builder()
                                         .hardLimit(123)
                                         .name("name")
                                         .softLimit(123)
                                         .build()))
                                 .user("user")
                                 .vcpus(123)
                                 .volumes(List.of(VolumesProperty.builder()
                                         .efsVolumeConfiguration(EfsVolumeConfigurationProperty.builder()
                                                 .fileSystemId("fileSystemId")
                                                 // the properties below are optional
                                                 .authorizationConfig(AuthorizationConfigProperty.builder()
                                                         .accessPointId("accessPointId")
                                                         .iam("iam")
                                                         .build())
                                                 .rootDirectory("rootDirectory")
                                                 .transitEncryption("transitEncryption")
                                                 .transitEncryptionPort(123)
                                                 .build())
                                         .host(VolumesHostProperty.builder()
                                                 .sourcePath("sourcePath")
                                                 .build())
                                         .name("name")
                                         .build()))
                                 .build())
                         .build()))
                 .numNodes(123)
                 .build())
         .parameters(parameters)
         .platformCapabilities(List.of("platformCapabilities"))
         .propagateTags(false)
         .retryStrategy(RetryStrategyProperty.builder()
                 .attempts(123)
                 .evaluateOnExit(List.of(EvaluateOnExitProperty.builder()
                         .action("action")
                         // the properties below are optional
                         .onExitCode("onExitCode")
                         .onReason("onReason")
                         .onStatusReason("onStatusReason")
                         .build()))
                 .build())
         .schedulingPriority(123)
         .tags(tags)
         .timeout(TimeoutProperty.builder()
                 .attemptDurationSeconds(123)
                 .build())
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnJobDefinition

      protected CfnJobDefinition(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnJobDefinition

      protected CfnJobDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnJobDefinition

      @Stability(Stable) public CfnJobDefinition(@NotNull Construct scope, @NotNull String id, @NotNull CfnJobDefinitionProps props)
      Create a new AWS::Batch::JobDefinition.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      The tags that are applied to the job definition.
    • getParameters

      @Stability(Stable) @NotNull public Object getParameters()
      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 .

    • setParameters

      @Stability(Stable) public void setParameters(@NotNull Object value)
      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 .

    • getType

      @Stability(Stable) @NotNull public String getType()
      The type of job definition.

      For more information about multi-node parallel jobs, see Creating a multi-node parallel job definition in the AWS Batch User Guide .

      If the job is run on Fargate resources, then multinode isn't supported.

    • setType

      @Stability(Stable) public void setType(@NotNull String value)
      The type of job definition.

      For more information about multi-node parallel jobs, see Creating a multi-node parallel job definition in the AWS Batch User Guide .

      If the job is run on Fargate resources, then multinode isn't supported.

    • getContainerProperties

      @Stability(Stable) @Nullable public Object getContainerProperties()
      An object with various properties specific to Amazon ECS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • setContainerProperties

      @Stability(Stable) public void setContainerProperties(@Nullable IResolvable value)
      An object with various properties specific to Amazon ECS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • setContainerProperties

      @Stability(Stable) public void setContainerProperties(@Nullable CfnJobDefinition.ContainerPropertiesProperty value)
      An object with various properties specific to Amazon ECS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • getEksProperties

      @Stability(Stable) @Nullable public Object getEksProperties()
      An object with various properties that are specific to Amazon EKS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • setEksProperties

      @Stability(Stable) public void setEksProperties(@Nullable IResolvable value)
      An object with various properties that are specific to Amazon EKS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • setEksProperties

      @Stability(Stable) public void setEksProperties(@Nullable CfnJobDefinition.EksPropertiesProperty value)
      An object with various properties that are specific to Amazon EKS based jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

    • getJobDefinitionName

      @Stability(Stable) @Nullable public String getJobDefinitionName()
      The name of the job definition.
    • setJobDefinitionName

      @Stability(Stable) public void setJobDefinitionName(@Nullable String value)
      The name of the job definition.
    • getNodeProperties

      @Stability(Stable) @Nullable public Object getNodeProperties()
      An object with various properties that are specific to multi-node parallel jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

      If the job runs on Fargate resources, don't specify nodeProperties . Use containerProperties instead.

    • setNodeProperties

      @Stability(Stable) public void setNodeProperties(@Nullable IResolvable value)
      An object with various properties that are specific to multi-node parallel jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

      If the job runs on Fargate resources, don't specify nodeProperties . Use containerProperties instead.

    • setNodeProperties

      @Stability(Stable) public void setNodeProperties(@Nullable CfnJobDefinition.NodePropertiesProperty value)
      An object with various properties that are specific to multi-node parallel jobs.

      Valid values are containerProperties , eksProperties , and nodeProperties . Only one can be specified.

      If the job runs on Fargate resources, don't specify nodeProperties . Use containerProperties instead.

    • getPlatformCapabilities

      @Stability(Stable) @Nullable public List<String> getPlatformCapabilities()
      The platform capabilities required by the job definition.

      If no value is specified, it defaults to EC2 . Jobs run on Fargate resources specify FARGATE .

    • setPlatformCapabilities

      @Stability(Stable) public void setPlatformCapabilities(@Nullable List<String> value)
      The platform capabilities required by the job definition.

      If no value is specified, it defaults to EC2 . Jobs run on Fargate resources specify FARGATE .

    • getPropagateTags

      @Stability(Stable) @Nullable public Object getPropagateTags()
      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 when the tasks are created. 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.

    • setPropagateTags

      @Stability(Stable) public void setPropagateTags(@Nullable Boolean value)
      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 when the tasks are created. 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.

    • setPropagateTags

      @Stability(Stable) public void setPropagateTags(@Nullable IResolvable value)
      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 when the tasks are created. 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.

    • getRetryStrategy

      @Stability(Stable) @Nullable public Object getRetryStrategy()
      The retry strategy to use for failed jobs that are submitted with this job definition.
    • setRetryStrategy

      @Stability(Stable) public void setRetryStrategy(@Nullable IResolvable value)
      The retry strategy to use for failed jobs that are submitted with this job definition.
    • setRetryStrategy

      @Stability(Stable) public void setRetryStrategy(@Nullable CfnJobDefinition.RetryStrategyProperty value)
      The retry strategy to use for failed jobs that are submitted with this job definition.
    • getSchedulingPriority

      @Stability(Stable) @Nullable public Number getSchedulingPriority()
      The scheduling priority of the job definition.

      This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.

    • setSchedulingPriority

      @Stability(Stable) public void setSchedulingPriority(@Nullable Number value)
      The scheduling priority of the job definition.

      This only affects jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority.

    • getTimeout

      @Stability(Stable) @Nullable public Object getTimeout()
      The timeout time for jobs that are submitted with this job definition.

      After the amount of time you specify passes, AWS Batch terminates your jobs if they aren't finished.

    • setTimeout

      @Stability(Stable) public void setTimeout(@Nullable IResolvable value)
      The timeout time for jobs that are submitted with this job definition.

      After the amount of time you specify passes, AWS Batch terminates your jobs if they aren't finished.

    • setTimeout

      @Stability(Stable) public void setTimeout(@Nullable CfnJobDefinition.TimeoutProperty value)
      The timeout time for jobs that are submitted with this job definition.

      After the amount of time you specify passes, AWS Batch terminates your jobs if they aren't finished.