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

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

-- |
-- Module      : Amazonka.Glue.StartJobRun
-- 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)
--
-- Starts a job run using a job definition.
module Amazonka.Glue.StartJobRun
  ( -- * Creating a Request
    StartJobRun (..),
    newStartJobRun,

    -- * Request Lenses
    startJobRun_numberOfWorkers,
    startJobRun_notificationProperty,
    startJobRun_arguments,
    startJobRun_workerType,
    startJobRun_securityConfiguration,
    startJobRun_allocatedCapacity,
    startJobRun_maxCapacity,
    startJobRun_timeout,
    startJobRun_jobRunId,
    startJobRun_jobName,

    -- * Destructuring the Response
    StartJobRunResponse (..),
    newStartJobRunResponse,

    -- * Response Lenses
    startJobRunResponse_jobRunId,
    startJobRunResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStartJobRun' smart constructor.
data StartJobRun = StartJobRun'
  { -- | The number of workers of a defined @workerType@ that are allocated when
    -- a job runs.
    --
    -- The maximum number of workers you can define are 299 for @G.1X@, and 149
    -- for @G.2X@.
    StartJobRun -> Maybe Int
numberOfWorkers :: Prelude.Maybe Prelude.Int,
    -- | Specifies configuration properties of a job run notification.
    StartJobRun -> Maybe NotificationProperty
notificationProperty :: Prelude.Maybe NotificationProperty,
    -- | The job arguments specifically for this run. For this job run, they
    -- replace the default arguments set in the job definition itself.
    --
    -- You can specify arguments here that your own job-execution script
    -- consumes, as well as arguments that Glue itself consumes.
    --
    -- For information about how to specify and consume your own Job arguments,
    -- see the
    -- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html Calling Glue APIs in Python>
    -- topic in the developer guide.
    --
    -- For information about the key-value pairs that Glue consumes to set up
    -- your job, see the
    -- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html Special Parameters Used by Glue>
    -- topic in the developer guide.
    StartJobRun -> Maybe (HashMap Text Text)
arguments :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The type of predefined worker that is allocated when a job runs. Accepts
    -- a value of Standard, G.1X, or G.2X.
    --
    -- -   For the @Standard@ worker type, each worker provides 4 vCPU, 16 GB
    --     of memory and a 50GB disk, and 2 executors per worker.
    --
    -- -   For the @G.1X@ worker type, each worker provides 4 vCPU, 16 GB of
    --     memory and a 64GB disk, and 1 executor per worker.
    --
    -- -   For the @G.2X@ worker type, each worker provides 8 vCPU, 32 GB of
    --     memory and a 128GB disk, and 1 executor per worker.
    StartJobRun -> Maybe WorkerType
workerType :: Prelude.Maybe WorkerType,
    -- | The name of the @SecurityConfiguration@ structure to be used with this
    -- job run.
    StartJobRun -> Maybe Text
securityConfiguration :: Prelude.Maybe Prelude.Text,
    -- | This field is deprecated. Use @MaxCapacity@ instead.
    --
    -- The number of Glue data processing units (DPUs) to allocate to this
    -- JobRun. From 2 to 100 DPUs can be allocated; the default is 10. A DPU is
    -- a relative measure of processing power that consists of 4 vCPUs of
    -- compute capacity and 16 GB of memory. For more information, see the
    -- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
    StartJobRun -> Maybe Int
allocatedCapacity :: Prelude.Maybe Prelude.Int,
    -- | The number of Glue data processing units (DPUs) that can be allocated
    -- when this job runs. A DPU is a relative measure of processing power that
    -- consists of 4 vCPUs of compute capacity and 16 GB of memory. For more
    -- information, see the
    -- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
    --
    -- Do not set @Max Capacity@ if using @WorkerType@ and @NumberOfWorkers@.
    --
    -- The value that can be allocated for @MaxCapacity@ depends on whether you
    -- are running a Python shell job, or an Apache Spark ETL job:
    --
    -- -   When you specify a Python shell job
    --     (@JobCommand.Name@=\"pythonshell\"), you can allocate either 0.0625
    --     or 1 DPU. The default is 0.0625 DPU.
    --
    -- -   When you specify an Apache Spark ETL job
    --     (@JobCommand.Name@=\"glueetl\"), you can allocate from 2 to 100
    --     DPUs. The default is 10 DPUs. This job type cannot have a fractional
    --     DPU allocation.
    StartJobRun -> Maybe Double
maxCapacity :: Prelude.Maybe Prelude.Double,
    -- | The @JobRun@ timeout in minutes. This is the maximum time that a job run
    -- can consume resources before it is terminated and enters @TIMEOUT@
    -- status. The default is 2,880 minutes (48 hours). This overrides the
    -- timeout value set in the parent job.
    StartJobRun -> Maybe Natural
timeout :: Prelude.Maybe Prelude.Natural,
    -- | The ID of a previous @JobRun@ to retry.
    StartJobRun -> Maybe Text
jobRunId :: Prelude.Maybe Prelude.Text,
    -- | The name of the job definition to use.
    StartJobRun -> Text
jobName :: Prelude.Text
  }
  deriving (StartJobRun -> StartJobRun -> Bool
(StartJobRun -> StartJobRun -> Bool)
-> (StartJobRun -> StartJobRun -> Bool) -> Eq StartJobRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartJobRun -> StartJobRun -> Bool
$c/= :: StartJobRun -> StartJobRun -> Bool
== :: StartJobRun -> StartJobRun -> Bool
$c== :: StartJobRun -> StartJobRun -> Bool
Prelude.Eq, ReadPrec [StartJobRun]
ReadPrec StartJobRun
Int -> ReadS StartJobRun
ReadS [StartJobRun]
(Int -> ReadS StartJobRun)
-> ReadS [StartJobRun]
-> ReadPrec StartJobRun
-> ReadPrec [StartJobRun]
-> Read StartJobRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartJobRun]
$creadListPrec :: ReadPrec [StartJobRun]
readPrec :: ReadPrec StartJobRun
$creadPrec :: ReadPrec StartJobRun
readList :: ReadS [StartJobRun]
$creadList :: ReadS [StartJobRun]
readsPrec :: Int -> ReadS StartJobRun
$creadsPrec :: Int -> ReadS StartJobRun
Prelude.Read, Int -> StartJobRun -> ShowS
[StartJobRun] -> ShowS
StartJobRun -> String
(Int -> StartJobRun -> ShowS)
-> (StartJobRun -> String)
-> ([StartJobRun] -> ShowS)
-> Show StartJobRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartJobRun] -> ShowS
$cshowList :: [StartJobRun] -> ShowS
show :: StartJobRun -> String
$cshow :: StartJobRun -> String
showsPrec :: Int -> StartJobRun -> ShowS
$cshowsPrec :: Int -> StartJobRun -> ShowS
Prelude.Show, (forall x. StartJobRun -> Rep StartJobRun x)
-> (forall x. Rep StartJobRun x -> StartJobRun)
-> Generic StartJobRun
forall x. Rep StartJobRun x -> StartJobRun
forall x. StartJobRun -> Rep StartJobRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartJobRun x -> StartJobRun
$cfrom :: forall x. StartJobRun -> Rep StartJobRun x
Prelude.Generic)

-- |
-- Create a value of 'StartJobRun' 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:
--
-- 'numberOfWorkers', 'startJobRun_numberOfWorkers' - The number of workers of a defined @workerType@ that are allocated when
-- a job runs.
--
-- The maximum number of workers you can define are 299 for @G.1X@, and 149
-- for @G.2X@.
--
-- 'notificationProperty', 'startJobRun_notificationProperty' - Specifies configuration properties of a job run notification.
--
-- 'arguments', 'startJobRun_arguments' - The job arguments specifically for this run. For this job run, they
-- replace the default arguments set in the job definition itself.
--
-- You can specify arguments here that your own job-execution script
-- consumes, as well as arguments that Glue itself consumes.
--
-- For information about how to specify and consume your own Job arguments,
-- see the
-- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html Calling Glue APIs in Python>
-- topic in the developer guide.
--
-- For information about the key-value pairs that Glue consumes to set up
-- your job, see the
-- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html Special Parameters Used by Glue>
-- topic in the developer guide.
--
-- 'workerType', 'startJobRun_workerType' - The type of predefined worker that is allocated when a job runs. Accepts
-- a value of Standard, G.1X, or G.2X.
--
-- -   For the @Standard@ worker type, each worker provides 4 vCPU, 16 GB
--     of memory and a 50GB disk, and 2 executors per worker.
--
-- -   For the @G.1X@ worker type, each worker provides 4 vCPU, 16 GB of
--     memory and a 64GB disk, and 1 executor per worker.
--
-- -   For the @G.2X@ worker type, each worker provides 8 vCPU, 32 GB of
--     memory and a 128GB disk, and 1 executor per worker.
--
-- 'securityConfiguration', 'startJobRun_securityConfiguration' - The name of the @SecurityConfiguration@ structure to be used with this
-- job run.
--
-- 'allocatedCapacity', 'startJobRun_allocatedCapacity' - This field is deprecated. Use @MaxCapacity@ instead.
--
-- The number of Glue data processing units (DPUs) to allocate to this
-- JobRun. From 2 to 100 DPUs can be allocated; the default is 10. A DPU is
-- a relative measure of processing power that consists of 4 vCPUs of
-- compute capacity and 16 GB of memory. For more information, see the
-- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
--
-- 'maxCapacity', 'startJobRun_maxCapacity' - The number of Glue data processing units (DPUs) that can be allocated
-- when this job runs. A DPU is a relative measure of processing power that
-- consists of 4 vCPUs of compute capacity and 16 GB of memory. For more
-- information, see the
-- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
--
-- Do not set @Max Capacity@ if using @WorkerType@ and @NumberOfWorkers@.
--
-- The value that can be allocated for @MaxCapacity@ depends on whether you
-- are running a Python shell job, or an Apache Spark ETL job:
--
-- -   When you specify a Python shell job
--     (@JobCommand.Name@=\"pythonshell\"), you can allocate either 0.0625
--     or 1 DPU. The default is 0.0625 DPU.
--
-- -   When you specify an Apache Spark ETL job
--     (@JobCommand.Name@=\"glueetl\"), you can allocate from 2 to 100
--     DPUs. The default is 10 DPUs. This job type cannot have a fractional
--     DPU allocation.
--
-- 'timeout', 'startJobRun_timeout' - The @JobRun@ timeout in minutes. This is the maximum time that a job run
-- can consume resources before it is terminated and enters @TIMEOUT@
-- status. The default is 2,880 minutes (48 hours). This overrides the
-- timeout value set in the parent job.
--
-- 'jobRunId', 'startJobRun_jobRunId' - The ID of a previous @JobRun@ to retry.
--
-- 'jobName', 'startJobRun_jobName' - The name of the job definition to use.
newStartJobRun ::
  -- | 'jobName'
  Prelude.Text ->
  StartJobRun
newStartJobRun :: Text -> StartJobRun
newStartJobRun Text
pJobName_ =
  StartJobRun' :: Maybe Int
-> Maybe NotificationProperty
-> Maybe (HashMap Text Text)
-> Maybe WorkerType
-> Maybe Text
-> Maybe Int
-> Maybe Double
-> Maybe Natural
-> Maybe Text
-> Text
-> StartJobRun
StartJobRun'
    { $sel:numberOfWorkers:StartJobRun' :: Maybe Int
numberOfWorkers = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationProperty:StartJobRun' :: Maybe NotificationProperty
notificationProperty = Maybe NotificationProperty
forall a. Maybe a
Prelude.Nothing,
      $sel:arguments:StartJobRun' :: Maybe (HashMap Text Text)
arguments = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:workerType:StartJobRun' :: Maybe WorkerType
workerType = Maybe WorkerType
forall a. Maybe a
Prelude.Nothing,
      $sel:securityConfiguration:StartJobRun' :: Maybe Text
securityConfiguration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:allocatedCapacity:StartJobRun' :: Maybe Int
allocatedCapacity = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:maxCapacity:StartJobRun' :: Maybe Double
maxCapacity = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:timeout:StartJobRun' :: Maybe Natural
timeout = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:jobRunId:StartJobRun' :: Maybe Text
jobRunId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:StartJobRun' :: Text
jobName = Text
pJobName_
    }

-- | The number of workers of a defined @workerType@ that are allocated when
-- a job runs.
--
-- The maximum number of workers you can define are 299 for @G.1X@, and 149
-- for @G.2X@.
startJobRun_numberOfWorkers :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Int)
startJobRun_numberOfWorkers :: (Maybe Int -> f (Maybe Int)) -> StartJobRun -> f StartJobRun
startJobRun_numberOfWorkers = (StartJobRun -> Maybe Int)
-> (StartJobRun -> Maybe Int -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Int
numberOfWorkers :: Maybe Int
$sel:numberOfWorkers:StartJobRun' :: StartJobRun -> Maybe Int
numberOfWorkers} -> Maybe Int
numberOfWorkers) (\s :: StartJobRun
s@StartJobRun' {} Maybe Int
a -> StartJobRun
s {$sel:numberOfWorkers:StartJobRun' :: Maybe Int
numberOfWorkers = Maybe Int
a} :: StartJobRun)

-- | Specifies configuration properties of a job run notification.
startJobRun_notificationProperty :: Lens.Lens' StartJobRun (Prelude.Maybe NotificationProperty)
startJobRun_notificationProperty :: (Maybe NotificationProperty -> f (Maybe NotificationProperty))
-> StartJobRun -> f StartJobRun
startJobRun_notificationProperty = (StartJobRun -> Maybe NotificationProperty)
-> (StartJobRun -> Maybe NotificationProperty -> StartJobRun)
-> Lens
     StartJobRun
     StartJobRun
     (Maybe NotificationProperty)
     (Maybe NotificationProperty)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe NotificationProperty
notificationProperty :: Maybe NotificationProperty
$sel:notificationProperty:StartJobRun' :: StartJobRun -> Maybe NotificationProperty
notificationProperty} -> Maybe NotificationProperty
notificationProperty) (\s :: StartJobRun
s@StartJobRun' {} Maybe NotificationProperty
a -> StartJobRun
s {$sel:notificationProperty:StartJobRun' :: Maybe NotificationProperty
notificationProperty = Maybe NotificationProperty
a} :: StartJobRun)

-- | The job arguments specifically for this run. For this job run, they
-- replace the default arguments set in the job definition itself.
--
-- You can specify arguments here that your own job-execution script
-- consumes, as well as arguments that Glue itself consumes.
--
-- For information about how to specify and consume your own Job arguments,
-- see the
-- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html Calling Glue APIs in Python>
-- topic in the developer guide.
--
-- For information about the key-value pairs that Glue consumes to set up
-- your job, see the
-- <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html Special Parameters Used by Glue>
-- topic in the developer guide.
startJobRun_arguments :: Lens.Lens' StartJobRun (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startJobRun_arguments :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartJobRun -> f StartJobRun
startJobRun_arguments = (StartJobRun -> Maybe (HashMap Text Text))
-> (StartJobRun -> Maybe (HashMap Text Text) -> StartJobRun)
-> Lens
     StartJobRun
     StartJobRun
     (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 (\StartJobRun' {Maybe (HashMap Text Text)
arguments :: Maybe (HashMap Text Text)
$sel:arguments:StartJobRun' :: StartJobRun -> Maybe (HashMap Text Text)
arguments} -> Maybe (HashMap Text Text)
arguments) (\s :: StartJobRun
s@StartJobRun' {} Maybe (HashMap Text Text)
a -> StartJobRun
s {$sel:arguments:StartJobRun' :: Maybe (HashMap Text Text)
arguments = Maybe (HashMap Text Text)
a} :: StartJobRun) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> StartJobRun -> f StartJobRun)
-> ((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)))
-> StartJobRun
-> f StartJobRun
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 type of predefined worker that is allocated when a job runs. Accepts
-- a value of Standard, G.1X, or G.2X.
--
-- -   For the @Standard@ worker type, each worker provides 4 vCPU, 16 GB
--     of memory and a 50GB disk, and 2 executors per worker.
--
-- -   For the @G.1X@ worker type, each worker provides 4 vCPU, 16 GB of
--     memory and a 64GB disk, and 1 executor per worker.
--
-- -   For the @G.2X@ worker type, each worker provides 8 vCPU, 32 GB of
--     memory and a 128GB disk, and 1 executor per worker.
startJobRun_workerType :: Lens.Lens' StartJobRun (Prelude.Maybe WorkerType)
startJobRun_workerType :: (Maybe WorkerType -> f (Maybe WorkerType))
-> StartJobRun -> f StartJobRun
startJobRun_workerType = (StartJobRun -> Maybe WorkerType)
-> (StartJobRun -> Maybe WorkerType -> StartJobRun)
-> Lens
     StartJobRun StartJobRun (Maybe WorkerType) (Maybe WorkerType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe WorkerType
workerType :: Maybe WorkerType
$sel:workerType:StartJobRun' :: StartJobRun -> Maybe WorkerType
workerType} -> Maybe WorkerType
workerType) (\s :: StartJobRun
s@StartJobRun' {} Maybe WorkerType
a -> StartJobRun
s {$sel:workerType:StartJobRun' :: Maybe WorkerType
workerType = Maybe WorkerType
a} :: StartJobRun)

-- | The name of the @SecurityConfiguration@ structure to be used with this
-- job run.
startJobRun_securityConfiguration :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Text)
startJobRun_securityConfiguration :: (Maybe Text -> f (Maybe Text)) -> StartJobRun -> f StartJobRun
startJobRun_securityConfiguration = (StartJobRun -> Maybe Text)
-> (StartJobRun -> Maybe Text -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Text
securityConfiguration :: Maybe Text
$sel:securityConfiguration:StartJobRun' :: StartJobRun -> Maybe Text
securityConfiguration} -> Maybe Text
securityConfiguration) (\s :: StartJobRun
s@StartJobRun' {} Maybe Text
a -> StartJobRun
s {$sel:securityConfiguration:StartJobRun' :: Maybe Text
securityConfiguration = Maybe Text
a} :: StartJobRun)

-- | This field is deprecated. Use @MaxCapacity@ instead.
--
-- The number of Glue data processing units (DPUs) to allocate to this
-- JobRun. From 2 to 100 DPUs can be allocated; the default is 10. A DPU is
-- a relative measure of processing power that consists of 4 vCPUs of
-- compute capacity and 16 GB of memory. For more information, see the
-- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
startJobRun_allocatedCapacity :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Int)
startJobRun_allocatedCapacity :: (Maybe Int -> f (Maybe Int)) -> StartJobRun -> f StartJobRun
startJobRun_allocatedCapacity = (StartJobRun -> Maybe Int)
-> (StartJobRun -> Maybe Int -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Int
allocatedCapacity :: Maybe Int
$sel:allocatedCapacity:StartJobRun' :: StartJobRun -> Maybe Int
allocatedCapacity} -> Maybe Int
allocatedCapacity) (\s :: StartJobRun
s@StartJobRun' {} Maybe Int
a -> StartJobRun
s {$sel:allocatedCapacity:StartJobRun' :: Maybe Int
allocatedCapacity = Maybe Int
a} :: StartJobRun)

-- | The number of Glue data processing units (DPUs) that can be allocated
-- when this job runs. A DPU is a relative measure of processing power that
-- consists of 4 vCPUs of compute capacity and 16 GB of memory. For more
-- information, see the
-- <https://aws.amazon.com/glue/pricing/ Glue pricing page>.
--
-- Do not set @Max Capacity@ if using @WorkerType@ and @NumberOfWorkers@.
--
-- The value that can be allocated for @MaxCapacity@ depends on whether you
-- are running a Python shell job, or an Apache Spark ETL job:
--
-- -   When you specify a Python shell job
--     (@JobCommand.Name@=\"pythonshell\"), you can allocate either 0.0625
--     or 1 DPU. The default is 0.0625 DPU.
--
-- -   When you specify an Apache Spark ETL job
--     (@JobCommand.Name@=\"glueetl\"), you can allocate from 2 to 100
--     DPUs. The default is 10 DPUs. This job type cannot have a fractional
--     DPU allocation.
startJobRun_maxCapacity :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Double)
startJobRun_maxCapacity :: (Maybe Double -> f (Maybe Double)) -> StartJobRun -> f StartJobRun
startJobRun_maxCapacity = (StartJobRun -> Maybe Double)
-> (StartJobRun -> Maybe Double -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Double
maxCapacity :: Maybe Double
$sel:maxCapacity:StartJobRun' :: StartJobRun -> Maybe Double
maxCapacity} -> Maybe Double
maxCapacity) (\s :: StartJobRun
s@StartJobRun' {} Maybe Double
a -> StartJobRun
s {$sel:maxCapacity:StartJobRun' :: Maybe Double
maxCapacity = Maybe Double
a} :: StartJobRun)

-- | The @JobRun@ timeout in minutes. This is the maximum time that a job run
-- can consume resources before it is terminated and enters @TIMEOUT@
-- status. The default is 2,880 minutes (48 hours). This overrides the
-- timeout value set in the parent job.
startJobRun_timeout :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Natural)
startJobRun_timeout :: (Maybe Natural -> f (Maybe Natural))
-> StartJobRun -> f StartJobRun
startJobRun_timeout = (StartJobRun -> Maybe Natural)
-> (StartJobRun -> Maybe Natural -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Natural
timeout :: Maybe Natural
$sel:timeout:StartJobRun' :: StartJobRun -> Maybe Natural
timeout} -> Maybe Natural
timeout) (\s :: StartJobRun
s@StartJobRun' {} Maybe Natural
a -> StartJobRun
s {$sel:timeout:StartJobRun' :: Maybe Natural
timeout = Maybe Natural
a} :: StartJobRun)

-- | The ID of a previous @JobRun@ to retry.
startJobRun_jobRunId :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Text)
startJobRun_jobRunId :: (Maybe Text -> f (Maybe Text)) -> StartJobRun -> f StartJobRun
startJobRun_jobRunId = (StartJobRun -> Maybe Text)
-> (StartJobRun -> Maybe Text -> StartJobRun)
-> Lens StartJobRun StartJobRun (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe Text
jobRunId :: Maybe Text
$sel:jobRunId:StartJobRun' :: StartJobRun -> Maybe Text
jobRunId} -> Maybe Text
jobRunId) (\s :: StartJobRun
s@StartJobRun' {} Maybe Text
a -> StartJobRun
s {$sel:jobRunId:StartJobRun' :: Maybe Text
jobRunId = Maybe Text
a} :: StartJobRun)

-- | The name of the job definition to use.
startJobRun_jobName :: Lens.Lens' StartJobRun Prelude.Text
startJobRun_jobName :: (Text -> f Text) -> StartJobRun -> f StartJobRun
startJobRun_jobName = (StartJobRun -> Text)
-> (StartJobRun -> Text -> StartJobRun)
-> Lens StartJobRun StartJobRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Text
jobName :: Text
$sel:jobName:StartJobRun' :: StartJobRun -> Text
jobName} -> Text
jobName) (\s :: StartJobRun
s@StartJobRun' {} Text
a -> StartJobRun
s {$sel:jobName:StartJobRun' :: Text
jobName = Text
a} :: StartJobRun)

instance Core.AWSRequest StartJobRun where
  type AWSResponse StartJobRun = StartJobRunResponse
  request :: StartJobRun -> Request StartJobRun
request = Service -> StartJobRun -> Request StartJobRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartJobRun)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartJobRun))
-> Logger
-> Service
-> Proxy StartJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartJobRun)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> StartJobRunResponse
StartJobRunResponse'
            (Maybe Text -> Int -> StartJobRunResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartJobRunResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobRunId")
            Either String (Int -> StartJobRunResponse)
-> Either String Int -> Either String StartJobRunResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartJobRun

instance Prelude.NFData StartJobRun

instance Core.ToHeaders StartJobRun where
  toHeaders :: StartJobRun -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartJobRun -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSGlue.StartJobRun" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartJobRun where
  toJSON :: StartJobRun -> Value
toJSON StartJobRun' {Maybe Double
Maybe Int
Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe NotificationProperty
Maybe WorkerType
Text
jobName :: Text
jobRunId :: Maybe Text
timeout :: Maybe Natural
maxCapacity :: Maybe Double
allocatedCapacity :: Maybe Int
securityConfiguration :: Maybe Text
workerType :: Maybe WorkerType
arguments :: Maybe (HashMap Text Text)
notificationProperty :: Maybe NotificationProperty
numberOfWorkers :: Maybe Int
$sel:jobName:StartJobRun' :: StartJobRun -> Text
$sel:jobRunId:StartJobRun' :: StartJobRun -> Maybe Text
$sel:timeout:StartJobRun' :: StartJobRun -> Maybe Natural
$sel:maxCapacity:StartJobRun' :: StartJobRun -> Maybe Double
$sel:allocatedCapacity:StartJobRun' :: StartJobRun -> Maybe Int
$sel:securityConfiguration:StartJobRun' :: StartJobRun -> Maybe Text
$sel:workerType:StartJobRun' :: StartJobRun -> Maybe WorkerType
$sel:arguments:StartJobRun' :: StartJobRun -> Maybe (HashMap Text Text)
$sel:notificationProperty:StartJobRun' :: StartJobRun -> Maybe NotificationProperty
$sel:numberOfWorkers:StartJobRun' :: StartJobRun -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NumberOfWorkers" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
numberOfWorkers,
            (Text
"NotificationProperty" Text -> NotificationProperty -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NotificationProperty -> Pair)
-> Maybe NotificationProperty -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationProperty
notificationProperty,
            (Text
"Arguments" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
arguments,
            (Text
"WorkerType" Text -> WorkerType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WorkerType -> Pair) -> Maybe WorkerType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkerType
workerType,
            (Text
"SecurityConfiguration" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
securityConfiguration,
            (Text
"AllocatedCapacity" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
allocatedCapacity,
            (Text
"MaxCapacity" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
maxCapacity,
            (Text
"Timeout" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeout,
            (Text
"JobRunId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobRunId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobName)
          ]
      )

instance Core.ToPath StartJobRun where
  toPath :: StartJobRun -> ByteString
toPath = ByteString -> StartJobRun -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery StartJobRun where
  toQuery :: StartJobRun -> QueryString
toQuery = QueryString -> StartJobRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartJobRunResponse' smart constructor.
data StartJobRunResponse = StartJobRunResponse'
  { -- | The ID assigned to this job run.
    StartJobRunResponse -> Maybe Text
jobRunId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartJobRunResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartJobRunResponse -> StartJobRunResponse -> Bool
(StartJobRunResponse -> StartJobRunResponse -> Bool)
-> (StartJobRunResponse -> StartJobRunResponse -> Bool)
-> Eq StartJobRunResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartJobRunResponse -> StartJobRunResponse -> Bool
$c/= :: StartJobRunResponse -> StartJobRunResponse -> Bool
== :: StartJobRunResponse -> StartJobRunResponse -> Bool
$c== :: StartJobRunResponse -> StartJobRunResponse -> Bool
Prelude.Eq, ReadPrec [StartJobRunResponse]
ReadPrec StartJobRunResponse
Int -> ReadS StartJobRunResponse
ReadS [StartJobRunResponse]
(Int -> ReadS StartJobRunResponse)
-> ReadS [StartJobRunResponse]
-> ReadPrec StartJobRunResponse
-> ReadPrec [StartJobRunResponse]
-> Read StartJobRunResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartJobRunResponse]
$creadListPrec :: ReadPrec [StartJobRunResponse]
readPrec :: ReadPrec StartJobRunResponse
$creadPrec :: ReadPrec StartJobRunResponse
readList :: ReadS [StartJobRunResponse]
$creadList :: ReadS [StartJobRunResponse]
readsPrec :: Int -> ReadS StartJobRunResponse
$creadsPrec :: Int -> ReadS StartJobRunResponse
Prelude.Read, Int -> StartJobRunResponse -> ShowS
[StartJobRunResponse] -> ShowS
StartJobRunResponse -> String
(Int -> StartJobRunResponse -> ShowS)
-> (StartJobRunResponse -> String)
-> ([StartJobRunResponse] -> ShowS)
-> Show StartJobRunResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartJobRunResponse] -> ShowS
$cshowList :: [StartJobRunResponse] -> ShowS
show :: StartJobRunResponse -> String
$cshow :: StartJobRunResponse -> String
showsPrec :: Int -> StartJobRunResponse -> ShowS
$cshowsPrec :: Int -> StartJobRunResponse -> ShowS
Prelude.Show, (forall x. StartJobRunResponse -> Rep StartJobRunResponse x)
-> (forall x. Rep StartJobRunResponse x -> StartJobRunResponse)
-> Generic StartJobRunResponse
forall x. Rep StartJobRunResponse x -> StartJobRunResponse
forall x. StartJobRunResponse -> Rep StartJobRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartJobRunResponse x -> StartJobRunResponse
$cfrom :: forall x. StartJobRunResponse -> Rep StartJobRunResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartJobRunResponse' 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:
--
-- 'jobRunId', 'startJobRunResponse_jobRunId' - The ID assigned to this job run.
--
-- 'httpStatus', 'startJobRunResponse_httpStatus' - The response's http status code.
newStartJobRunResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartJobRunResponse
newStartJobRunResponse :: Int -> StartJobRunResponse
newStartJobRunResponse Int
pHttpStatus_ =
  StartJobRunResponse' :: Maybe Text -> Int -> StartJobRunResponse
StartJobRunResponse'
    { $sel:jobRunId:StartJobRunResponse' :: Maybe Text
jobRunId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartJobRunResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID assigned to this job run.
startJobRunResponse_jobRunId :: Lens.Lens' StartJobRunResponse (Prelude.Maybe Prelude.Text)
startJobRunResponse_jobRunId :: (Maybe Text -> f (Maybe Text))
-> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_jobRunId = (StartJobRunResponse -> Maybe Text)
-> (StartJobRunResponse -> Maybe Text -> StartJobRunResponse)
-> Lens
     StartJobRunResponse StartJobRunResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRunResponse' {Maybe Text
jobRunId :: Maybe Text
$sel:jobRunId:StartJobRunResponse' :: StartJobRunResponse -> Maybe Text
jobRunId} -> Maybe Text
jobRunId) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Maybe Text
a -> StartJobRunResponse
s {$sel:jobRunId:StartJobRunResponse' :: Maybe Text
jobRunId = Maybe Text
a} :: StartJobRunResponse)

-- | The response's http status code.
startJobRunResponse_httpStatus :: Lens.Lens' StartJobRunResponse Prelude.Int
startJobRunResponse_httpStatus :: (Int -> f Int) -> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_httpStatus = (StartJobRunResponse -> Int)
-> (StartJobRunResponse -> Int -> StartJobRunResponse)
-> Lens StartJobRunResponse StartJobRunResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRunResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartJobRunResponse' :: StartJobRunResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Int
a -> StartJobRunResponse
s {$sel:httpStatus:StartJobRunResponse' :: Int
httpStatus = Int
a} :: StartJobRunResponse)

instance Prelude.NFData StartJobRunResponse