{-# 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.EMRContainers.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. A job run is a unit of work, such as a Spark jar,
-- PySpark script, or SparkSQL query, that you submit to Amazon EMR on EKS.
module Amazonka.EMRContainers.StartJobRun
  ( -- * Creating a Request
    StartJobRun (..),
    newStartJobRun,

    -- * Request Lenses
    startJobRun_configurationOverrides,
    startJobRun_name,
    startJobRun_tags,
    startJobRun_virtualClusterId,
    startJobRun_clientToken,
    startJobRun_executionRoleArn,
    startJobRun_releaseLabel,
    startJobRun_jobDriver,

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

    -- * Response Lenses
    startJobRunResponse_arn,
    startJobRunResponse_name,
    startJobRunResponse_id,
    startJobRunResponse_virtualClusterId,
    startJobRunResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.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 configuration overrides for the job run.
    StartJobRun -> Maybe ConfigurationOverrides
configurationOverrides :: Prelude.Maybe ConfigurationOverrides,
    -- | The name of the job run.
    StartJobRun -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The tags assigned to job runs.
    StartJobRun -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The virtual cluster ID for which the job run request is submitted.
    StartJobRun -> Text
virtualClusterId :: Prelude.Text,
    -- | The client idempotency token of the job run request.
    StartJobRun -> Text
clientToken :: Prelude.Text,
    -- | The execution role ARN for the job run.
    StartJobRun -> Text
executionRoleArn :: Prelude.Text,
    -- | The Amazon EMR release version to use for the job run.
    StartJobRun -> Text
releaseLabel :: Prelude.Text,
    -- | The job driver for the job run.
    StartJobRun -> JobDriver
jobDriver :: JobDriver
  }
  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, 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:
--
-- 'configurationOverrides', 'startJobRun_configurationOverrides' - The configuration overrides for the job run.
--
-- 'name', 'startJobRun_name' - The name of the job run.
--
-- 'tags', 'startJobRun_tags' - The tags assigned to job runs.
--
-- 'virtualClusterId', 'startJobRun_virtualClusterId' - The virtual cluster ID for which the job run request is submitted.
--
-- 'clientToken', 'startJobRun_clientToken' - The client idempotency token of the job run request.
--
-- 'executionRoleArn', 'startJobRun_executionRoleArn' - The execution role ARN for the job run.
--
-- 'releaseLabel', 'startJobRun_releaseLabel' - The Amazon EMR release version to use for the job run.
--
-- 'jobDriver', 'startJobRun_jobDriver' - The job driver for the job run.
newStartJobRun ::
  -- | 'virtualClusterId'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'executionRoleArn'
  Prelude.Text ->
  -- | 'releaseLabel'
  Prelude.Text ->
  -- | 'jobDriver'
  JobDriver ->
  StartJobRun
newStartJobRun :: Text -> Text -> Text -> Text -> JobDriver -> StartJobRun
newStartJobRun
  Text
pVirtualClusterId_
  Text
pClientToken_
  Text
pExecutionRoleArn_
  Text
pReleaseLabel_
  JobDriver
pJobDriver_ =
    StartJobRun' :: Maybe ConfigurationOverrides
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> JobDriver
-> StartJobRun
StartJobRun'
      { $sel:configurationOverrides:StartJobRun' :: Maybe ConfigurationOverrides
configurationOverrides =
          Maybe ConfigurationOverrides
forall a. Maybe a
Prelude.Nothing,
        $sel:name:StartJobRun' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:StartJobRun' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:virtualClusterId:StartJobRun' :: Text
virtualClusterId = Text
pVirtualClusterId_,
        $sel:clientToken:StartJobRun' :: Text
clientToken = Text
pClientToken_,
        $sel:executionRoleArn:StartJobRun' :: Text
executionRoleArn = Text
pExecutionRoleArn_,
        $sel:releaseLabel:StartJobRun' :: Text
releaseLabel = Text
pReleaseLabel_,
        $sel:jobDriver:StartJobRun' :: JobDriver
jobDriver = JobDriver
pJobDriver_
      }

-- | The configuration overrides for the job run.
startJobRun_configurationOverrides :: Lens.Lens' StartJobRun (Prelude.Maybe ConfigurationOverrides)
startJobRun_configurationOverrides :: (Maybe ConfigurationOverrides -> f (Maybe ConfigurationOverrides))
-> StartJobRun -> f StartJobRun
startJobRun_configurationOverrides = (StartJobRun -> Maybe ConfigurationOverrides)
-> (StartJobRun -> Maybe ConfigurationOverrides -> StartJobRun)
-> Lens
     StartJobRun
     StartJobRun
     (Maybe ConfigurationOverrides)
     (Maybe ConfigurationOverrides)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {Maybe ConfigurationOverrides
configurationOverrides :: Maybe ConfigurationOverrides
$sel:configurationOverrides:StartJobRun' :: StartJobRun -> Maybe ConfigurationOverrides
configurationOverrides} -> Maybe ConfigurationOverrides
configurationOverrides) (\s :: StartJobRun
s@StartJobRun' {} Maybe ConfigurationOverrides
a -> StartJobRun
s {$sel:configurationOverrides:StartJobRun' :: Maybe ConfigurationOverrides
configurationOverrides = Maybe ConfigurationOverrides
a} :: StartJobRun)

-- | The name of the job run.
startJobRun_name :: Lens.Lens' StartJobRun (Prelude.Maybe Prelude.Text)
startJobRun_name :: (Maybe Text -> f (Maybe Text)) -> StartJobRun -> f StartJobRun
startJobRun_name = (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
name :: Maybe Text
$sel:name:StartJobRun' :: StartJobRun -> Maybe Text
name} -> Maybe Text
name) (\s :: StartJobRun
s@StartJobRun' {} Maybe Text
a -> StartJobRun
s {$sel:name:StartJobRun' :: Maybe Text
name = Maybe Text
a} :: StartJobRun)

-- | The tags assigned to job runs.
startJobRun_tags :: Lens.Lens' StartJobRun (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startJobRun_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartJobRun -> f StartJobRun
startJobRun_tags = (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)
tags :: Maybe (HashMap Text Text)
$sel:tags:StartJobRun' :: StartJobRun -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: StartJobRun
s@StartJobRun' {} Maybe (HashMap Text Text)
a -> StartJobRun
s {$sel:tags:StartJobRun' :: Maybe (HashMap Text Text)
tags = 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 virtual cluster ID for which the job run request is submitted.
startJobRun_virtualClusterId :: Lens.Lens' StartJobRun Prelude.Text
startJobRun_virtualClusterId :: (Text -> f Text) -> StartJobRun -> f StartJobRun
startJobRun_virtualClusterId = (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
virtualClusterId :: Text
$sel:virtualClusterId:StartJobRun' :: StartJobRun -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: StartJobRun
s@StartJobRun' {} Text
a -> StartJobRun
s {$sel:virtualClusterId:StartJobRun' :: Text
virtualClusterId = Text
a} :: StartJobRun)

-- | The client idempotency token of the job run request.
startJobRun_clientToken :: Lens.Lens' StartJobRun Prelude.Text
startJobRun_clientToken :: (Text -> f Text) -> StartJobRun -> f StartJobRun
startJobRun_clientToken = (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
clientToken :: Text
$sel:clientToken:StartJobRun' :: StartJobRun -> Text
clientToken} -> Text
clientToken) (\s :: StartJobRun
s@StartJobRun' {} Text
a -> StartJobRun
s {$sel:clientToken:StartJobRun' :: Text
clientToken = Text
a} :: StartJobRun)

-- | The execution role ARN for the job run.
startJobRun_executionRoleArn :: Lens.Lens' StartJobRun Prelude.Text
startJobRun_executionRoleArn :: (Text -> f Text) -> StartJobRun -> f StartJobRun
startJobRun_executionRoleArn = (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
executionRoleArn :: Text
$sel:executionRoleArn:StartJobRun' :: StartJobRun -> Text
executionRoleArn} -> Text
executionRoleArn) (\s :: StartJobRun
s@StartJobRun' {} Text
a -> StartJobRun
s {$sel:executionRoleArn:StartJobRun' :: Text
executionRoleArn = Text
a} :: StartJobRun)

-- | The Amazon EMR release version to use for the job run.
startJobRun_releaseLabel :: Lens.Lens' StartJobRun Prelude.Text
startJobRun_releaseLabel :: (Text -> f Text) -> StartJobRun -> f StartJobRun
startJobRun_releaseLabel = (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
releaseLabel :: Text
$sel:releaseLabel:StartJobRun' :: StartJobRun -> Text
releaseLabel} -> Text
releaseLabel) (\s :: StartJobRun
s@StartJobRun' {} Text
a -> StartJobRun
s {$sel:releaseLabel:StartJobRun' :: Text
releaseLabel = Text
a} :: StartJobRun)

-- | The job driver for the job run.
startJobRun_jobDriver :: Lens.Lens' StartJobRun JobDriver
startJobRun_jobDriver :: (JobDriver -> f JobDriver) -> StartJobRun -> f StartJobRun
startJobRun_jobDriver = (StartJobRun -> JobDriver)
-> (StartJobRun -> JobDriver -> StartJobRun)
-> Lens StartJobRun StartJobRun JobDriver JobDriver
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartJobRun' {JobDriver
jobDriver :: JobDriver
$sel:jobDriver:StartJobRun' :: StartJobRun -> JobDriver
jobDriver} -> JobDriver
jobDriver) (\s :: StartJobRun
s@StartJobRun' {} JobDriver
a -> StartJobRun
s {$sel:jobDriver:StartJobRun' :: JobDriver
jobDriver = JobDriver
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
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> StartJobRunResponse
StartJobRunResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> StartJobRunResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> 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
"arn")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> StartJobRunResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> StartJobRunResponse)
forall (f :: * -> *) a b. Applicative f => 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
"name")
            Either
  String (Maybe Text -> Maybe Text -> Int -> StartJobRunResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> StartJobRunResponse)
forall (f :: * -> *) a b. Applicative f => 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
"id")
            Either String (Maybe Text -> Int -> StartJobRunResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartJobRunResponse)
forall (f :: * -> *) a b. Applicative f => 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
"virtualClusterId")
            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
"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 Text
Maybe (HashMap Text Text)
Maybe ConfigurationOverrides
Text
JobDriver
jobDriver :: JobDriver
releaseLabel :: Text
executionRoleArn :: Text
clientToken :: Text
virtualClusterId :: Text
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
configurationOverrides :: Maybe ConfigurationOverrides
$sel:jobDriver:StartJobRun' :: StartJobRun -> JobDriver
$sel:releaseLabel:StartJobRun' :: StartJobRun -> Text
$sel:executionRoleArn:StartJobRun' :: StartJobRun -> Text
$sel:clientToken:StartJobRun' :: StartJobRun -> Text
$sel:virtualClusterId:StartJobRun' :: StartJobRun -> Text
$sel:tags:StartJobRun' :: StartJobRun -> Maybe (HashMap Text Text)
$sel:name:StartJobRun' :: StartJobRun -> Maybe Text
$sel:configurationOverrides:StartJobRun' :: StartJobRun -> Maybe ConfigurationOverrides
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"configurationOverrides" Text -> ConfigurationOverrides -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfigurationOverrides -> Pair)
-> Maybe ConfigurationOverrides -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationOverrides
configurationOverrides,
            (Text
"name" 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
name,
            (Text
"tags" 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)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"executionRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"releaseLabel" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
releaseLabel),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobDriver" Text -> JobDriver -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= JobDriver
jobDriver)
          ]
      )

instance Core.ToPath StartJobRun where
  toPath :: StartJobRun -> ByteString
toPath StartJobRun' {Maybe Text
Maybe (HashMap Text Text)
Maybe ConfigurationOverrides
Text
JobDriver
jobDriver :: JobDriver
releaseLabel :: Text
executionRoleArn :: Text
clientToken :: Text
virtualClusterId :: Text
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
configurationOverrides :: Maybe ConfigurationOverrides
$sel:jobDriver:StartJobRun' :: StartJobRun -> JobDriver
$sel:releaseLabel:StartJobRun' :: StartJobRun -> Text
$sel:executionRoleArn:StartJobRun' :: StartJobRun -> Text
$sel:clientToken:StartJobRun' :: StartJobRun -> Text
$sel:virtualClusterId:StartJobRun' :: StartJobRun -> Text
$sel:tags:StartJobRun' :: StartJobRun -> Maybe (HashMap Text Text)
$sel:name:StartJobRun' :: StartJobRun -> Maybe Text
$sel:configurationOverrides:StartJobRun' :: StartJobRun -> Maybe ConfigurationOverrides
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/virtualclusters/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualClusterId,
        ByteString
"/jobruns"
      ]

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'
  { -- | This output lists the ARN of job run.
    StartJobRunResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | This output displays the name of the started job run.
    StartJobRunResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | This output displays the started job run ID.
    StartJobRunResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | This output displays the virtual cluster ID for which the job run was
    -- submitted.
    StartJobRunResponse -> Maybe Text
virtualClusterId :: 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:
--
-- 'arn', 'startJobRunResponse_arn' - This output lists the ARN of job run.
--
-- 'name', 'startJobRunResponse_name' - This output displays the name of the started job run.
--
-- 'id', 'startJobRunResponse_id' - This output displays the started job run ID.
--
-- 'virtualClusterId', 'startJobRunResponse_virtualClusterId' - This output displays the virtual cluster ID for which the job run was
-- submitted.
--
-- 'httpStatus', 'startJobRunResponse_httpStatus' - The response's http status code.
newStartJobRunResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartJobRunResponse
newStartJobRunResponse :: Int -> StartJobRunResponse
newStartJobRunResponse Int
pHttpStatus_ =
  StartJobRunResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> StartJobRunResponse
StartJobRunResponse'
    { $sel:arn:StartJobRunResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:StartJobRunResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:StartJobRunResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualClusterId:StartJobRunResponse' :: Maybe Text
virtualClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartJobRunResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output lists the ARN of job run.
startJobRunResponse_arn :: Lens.Lens' StartJobRunResponse (Prelude.Maybe Prelude.Text)
startJobRunResponse_arn :: (Maybe Text -> f (Maybe Text))
-> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_arn = (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
arn :: Maybe Text
$sel:arn:StartJobRunResponse' :: StartJobRunResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Maybe Text
a -> StartJobRunResponse
s {$sel:arn:StartJobRunResponse' :: Maybe Text
arn = Maybe Text
a} :: StartJobRunResponse)

-- | This output displays the name of the started job run.
startJobRunResponse_name :: Lens.Lens' StartJobRunResponse (Prelude.Maybe Prelude.Text)
startJobRunResponse_name :: (Maybe Text -> f (Maybe Text))
-> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_name = (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
name :: Maybe Text
$sel:name:StartJobRunResponse' :: StartJobRunResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Maybe Text
a -> StartJobRunResponse
s {$sel:name:StartJobRunResponse' :: Maybe Text
name = Maybe Text
a} :: StartJobRunResponse)

-- | This output displays the started job run ID.
startJobRunResponse_id :: Lens.Lens' StartJobRunResponse (Prelude.Maybe Prelude.Text)
startJobRunResponse_id :: (Maybe Text -> f (Maybe Text))
-> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_id = (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
id :: Maybe Text
$sel:id:StartJobRunResponse' :: StartJobRunResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Maybe Text
a -> StartJobRunResponse
s {$sel:id:StartJobRunResponse' :: Maybe Text
id = Maybe Text
a} :: StartJobRunResponse)

-- | This output displays the virtual cluster ID for which the job run was
-- submitted.
startJobRunResponse_virtualClusterId :: Lens.Lens' StartJobRunResponse (Prelude.Maybe Prelude.Text)
startJobRunResponse_virtualClusterId :: (Maybe Text -> f (Maybe Text))
-> StartJobRunResponse -> f StartJobRunResponse
startJobRunResponse_virtualClusterId = (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
virtualClusterId :: Maybe Text
$sel:virtualClusterId:StartJobRunResponse' :: StartJobRunResponse -> Maybe Text
virtualClusterId} -> Maybe Text
virtualClusterId) (\s :: StartJobRunResponse
s@StartJobRunResponse' {} Maybe Text
a -> StartJobRunResponse
s {$sel:virtualClusterId:StartJobRunResponse' :: Maybe Text
virtualClusterId = 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