{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Batch.Types.JobDefinition
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Batch.Types.JobDefinition where

import Amazonka.Batch.Types.ContainerProperties
import Amazonka.Batch.Types.JobTimeout
import Amazonka.Batch.Types.NodeProperties
import Amazonka.Batch.Types.PlatformCapability
import Amazonka.Batch.Types.RetryStrategy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing an Batch job definition.
--
-- /See:/ 'newJobDefinition' smart constructor.
data JobDefinition = JobDefinition'
  { -- | The status of the job definition.
    JobDefinition -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | 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.
    JobDefinition -> Maybe Bool
propagateTags :: Prelude.Maybe Prelude.Bool,
    -- | The retry strategy to use for failed jobs that are submitted with this
    -- job definition.
    JobDefinition -> Maybe RetryStrategy
retryStrategy :: Prelude.Maybe RetryStrategy,
    -- | The platform capabilities required by the job definition. If no value is
    -- specified, it defaults to @EC2@. Jobs run on Fargate resources specify
    -- @FARGATE@.
    JobDefinition -> Maybe [PlatformCapability]
platformCapabilities :: Prelude.Maybe [PlatformCapability],
    -- | 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
    -- <https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html Job Definition Parameters>
    -- in the /Batch User Guide/.
    JobDefinition -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The timeout configuration for jobs that are submitted with this job
    -- definition. You can specify a timeout duration after which Batch
    -- terminates your jobs if they haven\'t finished.
    JobDefinition -> Maybe JobTimeout
timeout :: Prelude.Maybe JobTimeout,
    -- | An object with various properties specific to container-based jobs.
    JobDefinition -> Maybe ContainerProperties
containerProperties :: Prelude.Maybe ContainerProperties,
    -- | 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.
    JobDefinition -> Maybe NodeProperties
nodeProperties :: Prelude.Maybe NodeProperties,
    -- | The tags applied to the job definition.
    JobDefinition -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the job definition.
    JobDefinition -> Text
jobDefinitionName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the job definition.
    JobDefinition -> Text
jobDefinitionArn :: Prelude.Text,
    -- | The revision of the job definition.
    JobDefinition -> Int
revision :: Prelude.Int,
    -- | 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
    -- <https://docs.aws.amazon.com/batch/latest/userguide/multi-node-job-def.html Creating a multi-node parallel job definition>
    -- in the /Batch User Guide/.
    JobDefinition -> Text
type' :: Prelude.Text
  }
  deriving (JobDefinition -> JobDefinition -> Bool
(JobDefinition -> JobDefinition -> Bool)
-> (JobDefinition -> JobDefinition -> Bool) -> Eq JobDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobDefinition -> JobDefinition -> Bool
$c/= :: JobDefinition -> JobDefinition -> Bool
== :: JobDefinition -> JobDefinition -> Bool
$c== :: JobDefinition -> JobDefinition -> Bool
Prelude.Eq, ReadPrec [JobDefinition]
ReadPrec JobDefinition
Int -> ReadS JobDefinition
ReadS [JobDefinition]
(Int -> ReadS JobDefinition)
-> ReadS [JobDefinition]
-> ReadPrec JobDefinition
-> ReadPrec [JobDefinition]
-> Read JobDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobDefinition]
$creadListPrec :: ReadPrec [JobDefinition]
readPrec :: ReadPrec JobDefinition
$creadPrec :: ReadPrec JobDefinition
readList :: ReadS [JobDefinition]
$creadList :: ReadS [JobDefinition]
readsPrec :: Int -> ReadS JobDefinition
$creadsPrec :: Int -> ReadS JobDefinition
Prelude.Read, Int -> JobDefinition -> ShowS
[JobDefinition] -> ShowS
JobDefinition -> String
(Int -> JobDefinition -> ShowS)
-> (JobDefinition -> String)
-> ([JobDefinition] -> ShowS)
-> Show JobDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobDefinition] -> ShowS
$cshowList :: [JobDefinition] -> ShowS
show :: JobDefinition -> String
$cshow :: JobDefinition -> String
showsPrec :: Int -> JobDefinition -> ShowS
$cshowsPrec :: Int -> JobDefinition -> ShowS
Prelude.Show, (forall x. JobDefinition -> Rep JobDefinition x)
-> (forall x. Rep JobDefinition x -> JobDefinition)
-> Generic JobDefinition
forall x. Rep JobDefinition x -> JobDefinition
forall x. JobDefinition -> Rep JobDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobDefinition x -> JobDefinition
$cfrom :: forall x. JobDefinition -> Rep JobDefinition x
Prelude.Generic)

-- |
-- Create a value of 'JobDefinition' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'status', 'jobDefinition_status' - The status of the job definition.
--
-- 'propagateTags', 'jobDefinition_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.
--
-- 'retryStrategy', 'jobDefinition_retryStrategy' - The retry strategy to use for failed jobs that are submitted with this
-- job definition.
--
-- 'platformCapabilities', 'jobDefinition_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@.
--
-- 'parameters', 'jobDefinition_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
-- <https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html Job Definition Parameters>
-- in the /Batch User Guide/.
--
-- 'timeout', 'jobDefinition_timeout' - The timeout configuration for jobs that are submitted with this job
-- definition. You can specify a timeout duration after which Batch
-- terminates your jobs if they haven\'t finished.
--
-- 'containerProperties', 'jobDefinition_containerProperties' - An object with various properties specific to container-based jobs.
--
-- 'nodeProperties', 'jobDefinition_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.
--
-- 'tags', 'jobDefinition_tags' - The tags applied to the job definition.
--
-- 'jobDefinitionName', 'jobDefinition_jobDefinitionName' - The name of the job definition.
--
-- 'jobDefinitionArn', 'jobDefinition_jobDefinitionArn' - The Amazon Resource Name (ARN) for the job definition.
--
-- 'revision', 'jobDefinition_revision' - The revision of the job definition.
--
-- 'type'', 'jobDefinition_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
-- <https://docs.aws.amazon.com/batch/latest/userguide/multi-node-job-def.html Creating a multi-node parallel job definition>
-- in the /Batch User Guide/.
newJobDefinition ::
  -- | 'jobDefinitionName'
  Prelude.Text ->
  -- | 'jobDefinitionArn'
  Prelude.Text ->
  -- | 'revision'
  Prelude.Int ->
  -- | 'type''
  Prelude.Text ->
  JobDefinition
newJobDefinition :: Text -> Text -> Int -> Text -> JobDefinition
newJobDefinition
  Text
pJobDefinitionName_
  Text
pJobDefinitionArn_
  Int
pRevision_
  Text
pType_ =
    JobDefinition' :: Maybe Text
-> Maybe Bool
-> Maybe RetryStrategy
-> Maybe [PlatformCapability]
-> Maybe (HashMap Text Text)
-> Maybe JobTimeout
-> Maybe ContainerProperties
-> Maybe NodeProperties
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Int
-> Text
-> JobDefinition
JobDefinition'
      { $sel:status:JobDefinition' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:propagateTags:JobDefinition' :: Maybe Bool
propagateTags = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:retryStrategy:JobDefinition' :: Maybe RetryStrategy
retryStrategy = Maybe RetryStrategy
forall a. Maybe a
Prelude.Nothing,
        $sel:platformCapabilities:JobDefinition' :: Maybe [PlatformCapability]
platformCapabilities = Maybe [PlatformCapability]
forall a. Maybe a
Prelude.Nothing,
        $sel:parameters:JobDefinition' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:timeout:JobDefinition' :: Maybe JobTimeout
timeout = Maybe JobTimeout
forall a. Maybe a
Prelude.Nothing,
        $sel:containerProperties:JobDefinition' :: Maybe ContainerProperties
containerProperties = Maybe ContainerProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:nodeProperties:JobDefinition' :: Maybe NodeProperties
nodeProperties = Maybe NodeProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:JobDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:jobDefinitionName:JobDefinition' :: Text
jobDefinitionName = Text
pJobDefinitionName_,
        $sel:jobDefinitionArn:JobDefinition' :: Text
jobDefinitionArn = Text
pJobDefinitionArn_,
        $sel:revision:JobDefinition' :: Int
revision = Int
pRevision_,
        $sel:type':JobDefinition' :: Text
type' = Text
pType_
      }

-- | The status of the job definition.
jobDefinition_status :: Lens.Lens' JobDefinition (Prelude.Maybe Prelude.Text)
jobDefinition_status :: (Maybe Text -> f (Maybe Text)) -> JobDefinition -> f JobDefinition
jobDefinition_status = (JobDefinition -> Maybe Text)
-> (JobDefinition -> Maybe Text -> JobDefinition)
-> Lens JobDefinition JobDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe Text
status :: Maybe Text
$sel:status:JobDefinition' :: JobDefinition -> Maybe Text
status} -> Maybe Text
status) (\s :: JobDefinition
s@JobDefinition' {} Maybe Text
a -> JobDefinition
s {$sel:status:JobDefinition' :: Maybe Text
status = Maybe Text
a} :: JobDefinition)

-- | 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.
jobDefinition_propagateTags :: Lens.Lens' JobDefinition (Prelude.Maybe Prelude.Bool)
jobDefinition_propagateTags :: (Maybe Bool -> f (Maybe Bool)) -> JobDefinition -> f JobDefinition
jobDefinition_propagateTags = (JobDefinition -> Maybe Bool)
-> (JobDefinition -> Maybe Bool -> JobDefinition)
-> Lens JobDefinition JobDefinition (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe Bool
propagateTags :: Maybe Bool
$sel:propagateTags:JobDefinition' :: JobDefinition -> Maybe Bool
propagateTags} -> Maybe Bool
propagateTags) (\s :: JobDefinition
s@JobDefinition' {} Maybe Bool
a -> JobDefinition
s {$sel:propagateTags:JobDefinition' :: Maybe Bool
propagateTags = Maybe Bool
a} :: JobDefinition)

-- | The retry strategy to use for failed jobs that are submitted with this
-- job definition.
jobDefinition_retryStrategy :: Lens.Lens' JobDefinition (Prelude.Maybe RetryStrategy)
jobDefinition_retryStrategy :: (Maybe RetryStrategy -> f (Maybe RetryStrategy))
-> JobDefinition -> f JobDefinition
jobDefinition_retryStrategy = (JobDefinition -> Maybe RetryStrategy)
-> (JobDefinition -> Maybe RetryStrategy -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe RetryStrategy)
     (Maybe RetryStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe RetryStrategy
retryStrategy :: Maybe RetryStrategy
$sel:retryStrategy:JobDefinition' :: JobDefinition -> Maybe RetryStrategy
retryStrategy} -> Maybe RetryStrategy
retryStrategy) (\s :: JobDefinition
s@JobDefinition' {} Maybe RetryStrategy
a -> JobDefinition
s {$sel:retryStrategy:JobDefinition' :: Maybe RetryStrategy
retryStrategy = Maybe RetryStrategy
a} :: JobDefinition)

-- | The platform capabilities required by the job definition. If no value is
-- specified, it defaults to @EC2@. Jobs run on Fargate resources specify
-- @FARGATE@.
jobDefinition_platformCapabilities :: Lens.Lens' JobDefinition (Prelude.Maybe [PlatformCapability])
jobDefinition_platformCapabilities :: (Maybe [PlatformCapability] -> f (Maybe [PlatformCapability]))
-> JobDefinition -> f JobDefinition
jobDefinition_platformCapabilities = (JobDefinition -> Maybe [PlatformCapability])
-> (JobDefinition -> Maybe [PlatformCapability] -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe [PlatformCapability])
     (Maybe [PlatformCapability])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe [PlatformCapability]
platformCapabilities :: Maybe [PlatformCapability]
$sel:platformCapabilities:JobDefinition' :: JobDefinition -> Maybe [PlatformCapability]
platformCapabilities} -> Maybe [PlatformCapability]
platformCapabilities) (\s :: JobDefinition
s@JobDefinition' {} Maybe [PlatformCapability]
a -> JobDefinition
s {$sel:platformCapabilities:JobDefinition' :: Maybe [PlatformCapability]
platformCapabilities = Maybe [PlatformCapability]
a} :: JobDefinition) ((Maybe [PlatformCapability] -> f (Maybe [PlatformCapability]))
 -> JobDefinition -> f JobDefinition)
-> ((Maybe [PlatformCapability] -> f (Maybe [PlatformCapability]))
    -> Maybe [PlatformCapability] -> f (Maybe [PlatformCapability]))
-> (Maybe [PlatformCapability] -> f (Maybe [PlatformCapability]))
-> JobDefinition
-> f JobDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PlatformCapability]
  [PlatformCapability]
  [PlatformCapability]
  [PlatformCapability]
-> Iso
     (Maybe [PlatformCapability])
     (Maybe [PlatformCapability])
     (Maybe [PlatformCapability])
     (Maybe [PlatformCapability])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [PlatformCapability]
  [PlatformCapability]
  [PlatformCapability]
  [PlatformCapability]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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
-- <https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html Job Definition Parameters>
-- in the /Batch User Guide/.
jobDefinition_parameters :: Lens.Lens' JobDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
jobDefinition_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> JobDefinition -> f JobDefinition
jobDefinition_parameters = (JobDefinition -> Maybe (HashMap Text Text))
-> (JobDefinition -> Maybe (HashMap Text Text) -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:JobDefinition' :: JobDefinition -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: JobDefinition
s@JobDefinition' {} Maybe (HashMap Text Text)
a -> JobDefinition
s {$sel:parameters:JobDefinition' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: JobDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> JobDefinition -> f JobDefinition)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> JobDefinition
-> f JobDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The timeout configuration for jobs that are submitted with this job
-- definition. You can specify a timeout duration after which Batch
-- terminates your jobs if they haven\'t finished.
jobDefinition_timeout :: Lens.Lens' JobDefinition (Prelude.Maybe JobTimeout)
jobDefinition_timeout :: (Maybe JobTimeout -> f (Maybe JobTimeout))
-> JobDefinition -> f JobDefinition
jobDefinition_timeout = (JobDefinition -> Maybe JobTimeout)
-> (JobDefinition -> Maybe JobTimeout -> JobDefinition)
-> Lens
     JobDefinition JobDefinition (Maybe JobTimeout) (Maybe JobTimeout)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe JobTimeout
timeout :: Maybe JobTimeout
$sel:timeout:JobDefinition' :: JobDefinition -> Maybe JobTimeout
timeout} -> Maybe JobTimeout
timeout) (\s :: JobDefinition
s@JobDefinition' {} Maybe JobTimeout
a -> JobDefinition
s {$sel:timeout:JobDefinition' :: Maybe JobTimeout
timeout = Maybe JobTimeout
a} :: JobDefinition)

-- | An object with various properties specific to container-based jobs.
jobDefinition_containerProperties :: Lens.Lens' JobDefinition (Prelude.Maybe ContainerProperties)
jobDefinition_containerProperties :: (Maybe ContainerProperties -> f (Maybe ContainerProperties))
-> JobDefinition -> f JobDefinition
jobDefinition_containerProperties = (JobDefinition -> Maybe ContainerProperties)
-> (JobDefinition -> Maybe ContainerProperties -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe ContainerProperties)
     (Maybe ContainerProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe ContainerProperties
containerProperties :: Maybe ContainerProperties
$sel:containerProperties:JobDefinition' :: JobDefinition -> Maybe ContainerProperties
containerProperties} -> Maybe ContainerProperties
containerProperties) (\s :: JobDefinition
s@JobDefinition' {} Maybe ContainerProperties
a -> JobDefinition
s {$sel:containerProperties:JobDefinition' :: Maybe ContainerProperties
containerProperties = Maybe ContainerProperties
a} :: JobDefinition)

-- | 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.
jobDefinition_nodeProperties :: Lens.Lens' JobDefinition (Prelude.Maybe NodeProperties)
jobDefinition_nodeProperties :: (Maybe NodeProperties -> f (Maybe NodeProperties))
-> JobDefinition -> f JobDefinition
jobDefinition_nodeProperties = (JobDefinition -> Maybe NodeProperties)
-> (JobDefinition -> Maybe NodeProperties -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe NodeProperties)
     (Maybe NodeProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe NodeProperties
nodeProperties :: Maybe NodeProperties
$sel:nodeProperties:JobDefinition' :: JobDefinition -> Maybe NodeProperties
nodeProperties} -> Maybe NodeProperties
nodeProperties) (\s :: JobDefinition
s@JobDefinition' {} Maybe NodeProperties
a -> JobDefinition
s {$sel:nodeProperties:JobDefinition' :: Maybe NodeProperties
nodeProperties = Maybe NodeProperties
a} :: JobDefinition)

-- | The tags applied to the job definition.
jobDefinition_tags :: Lens.Lens' JobDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
jobDefinition_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> JobDefinition -> f JobDefinition
jobDefinition_tags = (JobDefinition -> Maybe (HashMap Text Text))
-> (JobDefinition -> Maybe (HashMap Text Text) -> JobDefinition)
-> Lens
     JobDefinition
     JobDefinition
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:JobDefinition' :: JobDefinition -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: JobDefinition
s@JobDefinition' {} Maybe (HashMap Text Text)
a -> JobDefinition
s {$sel:tags:JobDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: JobDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> JobDefinition -> f JobDefinition)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> JobDefinition
-> f JobDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the job definition.
jobDefinition_jobDefinitionName :: Lens.Lens' JobDefinition Prelude.Text
jobDefinition_jobDefinitionName :: (Text -> f Text) -> JobDefinition -> f JobDefinition
jobDefinition_jobDefinitionName = (JobDefinition -> Text)
-> (JobDefinition -> Text -> JobDefinition)
-> Lens JobDefinition JobDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Text
jobDefinitionName :: Text
$sel:jobDefinitionName:JobDefinition' :: JobDefinition -> Text
jobDefinitionName} -> Text
jobDefinitionName) (\s :: JobDefinition
s@JobDefinition' {} Text
a -> JobDefinition
s {$sel:jobDefinitionName:JobDefinition' :: Text
jobDefinitionName = Text
a} :: JobDefinition)

-- | The Amazon Resource Name (ARN) for the job definition.
jobDefinition_jobDefinitionArn :: Lens.Lens' JobDefinition Prelude.Text
jobDefinition_jobDefinitionArn :: (Text -> f Text) -> JobDefinition -> f JobDefinition
jobDefinition_jobDefinitionArn = (JobDefinition -> Text)
-> (JobDefinition -> Text -> JobDefinition)
-> Lens JobDefinition JobDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Text
jobDefinitionArn :: Text
$sel:jobDefinitionArn:JobDefinition' :: JobDefinition -> Text
jobDefinitionArn} -> Text
jobDefinitionArn) (\s :: JobDefinition
s@JobDefinition' {} Text
a -> JobDefinition
s {$sel:jobDefinitionArn:JobDefinition' :: Text
jobDefinitionArn = Text
a} :: JobDefinition)

-- | The revision of the job definition.
jobDefinition_revision :: Lens.Lens' JobDefinition Prelude.Int
jobDefinition_revision :: (Int -> f Int) -> JobDefinition -> f JobDefinition
jobDefinition_revision = (JobDefinition -> Int)
-> (JobDefinition -> Int -> JobDefinition)
-> Lens JobDefinition JobDefinition Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Int
revision :: Int
$sel:revision:JobDefinition' :: JobDefinition -> Int
revision} -> Int
revision) (\s :: JobDefinition
s@JobDefinition' {} Int
a -> JobDefinition
s {$sel:revision:JobDefinition' :: Int
revision = Int
a} :: JobDefinition)

-- | 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
-- <https://docs.aws.amazon.com/batch/latest/userguide/multi-node-job-def.html Creating a multi-node parallel job definition>
-- in the /Batch User Guide/.
jobDefinition_type :: Lens.Lens' JobDefinition Prelude.Text
jobDefinition_type :: (Text -> f Text) -> JobDefinition -> f JobDefinition
jobDefinition_type = (JobDefinition -> Text)
-> (JobDefinition -> Text -> JobDefinition)
-> Lens JobDefinition JobDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDefinition' {Text
type' :: Text
$sel:type':JobDefinition' :: JobDefinition -> Text
type'} -> Text
type') (\s :: JobDefinition
s@JobDefinition' {} Text
a -> JobDefinition
s {$sel:type':JobDefinition' :: Text
type' = Text
a} :: JobDefinition)

instance Core.FromJSON JobDefinition where
  parseJSON :: Value -> Parser JobDefinition
parseJSON =
    String
-> (Object -> Parser JobDefinition)
-> Value
-> Parser JobDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobDefinition"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe RetryStrategy
-> Maybe [PlatformCapability]
-> Maybe (HashMap Text Text)
-> Maybe JobTimeout
-> Maybe ContainerProperties
-> Maybe NodeProperties
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Int
-> Text
-> JobDefinition
JobDefinition'
            (Maybe Text
 -> Maybe Bool
 -> Maybe RetryStrategy
 -> Maybe [PlatformCapability]
 -> Maybe (HashMap Text Text)
 -> Maybe JobTimeout
 -> Maybe ContainerProperties
 -> Maybe NodeProperties
 -> Maybe (HashMap Text Text)
 -> Text
 -> Text
 -> Int
 -> Text
 -> JobDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe RetryStrategy
      -> Maybe [PlatformCapability]
      -> Maybe (HashMap Text Text)
      -> Maybe JobTimeout
      -> Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Bool
   -> Maybe RetryStrategy
   -> Maybe [PlatformCapability]
   -> Maybe (HashMap Text Text)
   -> Maybe JobTimeout
   -> Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe Bool)
-> Parser
     (Maybe RetryStrategy
      -> Maybe [PlatformCapability]
      -> Maybe (HashMap Text Text)
      -> Maybe JobTimeout
      -> Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"propagateTags")
            Parser
  (Maybe RetryStrategy
   -> Maybe [PlatformCapability]
   -> Maybe (HashMap Text Text)
   -> Maybe JobTimeout
   -> Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe RetryStrategy)
-> Parser
     (Maybe [PlatformCapability]
      -> Maybe (HashMap Text Text)
      -> Maybe JobTimeout
      -> Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RetryStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"retryStrategy")
            Parser
  (Maybe [PlatformCapability]
   -> Maybe (HashMap Text Text)
   -> Maybe JobTimeout
   -> Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe [PlatformCapability])
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe JobTimeout
      -> Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [PlatformCapability]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"platformCapabilities"
                            Parser (Maybe (Maybe [PlatformCapability]))
-> Maybe [PlatformCapability]
-> Parser (Maybe [PlatformCapability])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PlatformCapability]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe JobTimeout
   -> Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe JobTimeout
      -> Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"parameters" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe JobTimeout
   -> Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe JobTimeout)
-> Parser
     (Maybe ContainerProperties
      -> Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobTimeout)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timeout")
            Parser
  (Maybe ContainerProperties
   -> Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe ContainerProperties)
-> Parser
     (Maybe NodeProperties
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> Int
      -> Text
      -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerProperties")
            Parser
  (Maybe NodeProperties
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> Int
   -> Text
   -> JobDefinition)
-> Parser (Maybe NodeProperties)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text -> Text -> Int -> Text -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NodeProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nodeProperties")
            Parser
  (Maybe (HashMap Text Text)
   -> Text -> Text -> Int -> Text -> JobDefinition)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> Int -> Text -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> Int -> Text -> JobDefinition)
-> Parser Text -> Parser (Text -> Int -> Text -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobDefinitionName")
            Parser (Text -> Int -> Text -> JobDefinition)
-> Parser Text -> Parser (Int -> Text -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobDefinitionArn")
            Parser (Int -> Text -> JobDefinition)
-> Parser Int -> Parser (Text -> JobDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"revision")
            Parser (Text -> JobDefinition)
-> Parser Text -> Parser JobDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
      )

instance Prelude.Hashable JobDefinition

instance Prelude.NFData JobDefinition