{-# 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.EMR.StartNotebookExecution
-- 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 notebook execution.
module Amazonka.EMR.StartNotebookExecution
  ( -- * Creating a Request
    StartNotebookExecution (..),
    newStartNotebookExecution,

    -- * Request Lenses
    startNotebookExecution_notebookInstanceSecurityGroupId,
    startNotebookExecution_notebookExecutionName,
    startNotebookExecution_notebookParams,
    startNotebookExecution_tags,
    startNotebookExecution_editorId,
    startNotebookExecution_relativePath,
    startNotebookExecution_executionEngine,
    startNotebookExecution_serviceRole,

    -- * Destructuring the Response
    StartNotebookExecutionResponse (..),
    newStartNotebookExecutionResponse,

    -- * Response Lenses
    startNotebookExecutionResponse_notebookExecutionId,
    startNotebookExecutionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMR.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:/ 'newStartNotebookExecution' smart constructor.
data StartNotebookExecution = StartNotebookExecution'
  { -- | The unique identifier of the Amazon EC2 security group to associate with
    -- the EMR Notebook for this notebook execution.
    StartNotebookExecution -> Maybe Text
notebookInstanceSecurityGroupId :: Prelude.Maybe Prelude.Text,
    -- | An optional name for the notebook execution.
    StartNotebookExecution -> Maybe Text
notebookExecutionName :: Prelude.Maybe Prelude.Text,
    -- | Input parameters in JSON format passed to the EMR Notebook at runtime
    -- for execution.
    StartNotebookExecution -> Maybe Text
notebookParams :: Prelude.Maybe Prelude.Text,
    -- | A list of tags associated with a notebook execution. Tags are
    -- user-defined key-value pairs that consist of a required key string with
    -- a maximum of 128 characters and an optional value string with a maximum
    -- of 256 characters.
    StartNotebookExecution -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The unique identifier of the EMR Notebook to use for notebook execution.
    StartNotebookExecution -> Text
editorId :: Prelude.Text,
    -- | The path and file name of the notebook file for this execution, relative
    -- to the path specified for the EMR Notebook. For example, if you specify
    -- a path of @s3:\/\/MyBucket\/MyNotebooks@ when you create an EMR Notebook
    -- for a notebook with an ID of @e-ABCDEFGHIJK1234567890ABCD@ (the
    -- @EditorID@ of this request), and you specify a @RelativePath@ of
    -- @my_notebook_executions\/notebook_execution.ipynb@, the location of the
    -- file for the notebook execution is
    -- @s3:\/\/MyBucket\/MyNotebooks\/e-ABCDEFGHIJK1234567890ABCD\/my_notebook_executions\/notebook_execution.ipynb@.
    StartNotebookExecution -> Text
relativePath :: Prelude.Text,
    -- | Specifies the execution engine (cluster) that runs the notebook
    -- execution.
    StartNotebookExecution -> ExecutionEngineConfig
executionEngine :: ExecutionEngineConfig,
    -- | The name or ARN of the IAM role that is used as the service role for
    -- Amazon EMR (the EMR role) for the notebook execution.
    StartNotebookExecution -> Text
serviceRole :: Prelude.Text
  }
  deriving (StartNotebookExecution -> StartNotebookExecution -> Bool
(StartNotebookExecution -> StartNotebookExecution -> Bool)
-> (StartNotebookExecution -> StartNotebookExecution -> Bool)
-> Eq StartNotebookExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartNotebookExecution -> StartNotebookExecution -> Bool
$c/= :: StartNotebookExecution -> StartNotebookExecution -> Bool
== :: StartNotebookExecution -> StartNotebookExecution -> Bool
$c== :: StartNotebookExecution -> StartNotebookExecution -> Bool
Prelude.Eq, ReadPrec [StartNotebookExecution]
ReadPrec StartNotebookExecution
Int -> ReadS StartNotebookExecution
ReadS [StartNotebookExecution]
(Int -> ReadS StartNotebookExecution)
-> ReadS [StartNotebookExecution]
-> ReadPrec StartNotebookExecution
-> ReadPrec [StartNotebookExecution]
-> Read StartNotebookExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartNotebookExecution]
$creadListPrec :: ReadPrec [StartNotebookExecution]
readPrec :: ReadPrec StartNotebookExecution
$creadPrec :: ReadPrec StartNotebookExecution
readList :: ReadS [StartNotebookExecution]
$creadList :: ReadS [StartNotebookExecution]
readsPrec :: Int -> ReadS StartNotebookExecution
$creadsPrec :: Int -> ReadS StartNotebookExecution
Prelude.Read, Int -> StartNotebookExecution -> ShowS
[StartNotebookExecution] -> ShowS
StartNotebookExecution -> String
(Int -> StartNotebookExecution -> ShowS)
-> (StartNotebookExecution -> String)
-> ([StartNotebookExecution] -> ShowS)
-> Show StartNotebookExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartNotebookExecution] -> ShowS
$cshowList :: [StartNotebookExecution] -> ShowS
show :: StartNotebookExecution -> String
$cshow :: StartNotebookExecution -> String
showsPrec :: Int -> StartNotebookExecution -> ShowS
$cshowsPrec :: Int -> StartNotebookExecution -> ShowS
Prelude.Show, (forall x. StartNotebookExecution -> Rep StartNotebookExecution x)
-> (forall x.
    Rep StartNotebookExecution x -> StartNotebookExecution)
-> Generic StartNotebookExecution
forall x. Rep StartNotebookExecution x -> StartNotebookExecution
forall x. StartNotebookExecution -> Rep StartNotebookExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartNotebookExecution x -> StartNotebookExecution
$cfrom :: forall x. StartNotebookExecution -> Rep StartNotebookExecution x
Prelude.Generic)

-- |
-- Create a value of 'StartNotebookExecution' 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:
--
-- 'notebookInstanceSecurityGroupId', 'startNotebookExecution_notebookInstanceSecurityGroupId' - The unique identifier of the Amazon EC2 security group to associate with
-- the EMR Notebook for this notebook execution.
--
-- 'notebookExecutionName', 'startNotebookExecution_notebookExecutionName' - An optional name for the notebook execution.
--
-- 'notebookParams', 'startNotebookExecution_notebookParams' - Input parameters in JSON format passed to the EMR Notebook at runtime
-- for execution.
--
-- 'tags', 'startNotebookExecution_tags' - A list of tags associated with a notebook execution. Tags are
-- user-defined key-value pairs that consist of a required key string with
-- a maximum of 128 characters and an optional value string with a maximum
-- of 256 characters.
--
-- 'editorId', 'startNotebookExecution_editorId' - The unique identifier of the EMR Notebook to use for notebook execution.
--
-- 'relativePath', 'startNotebookExecution_relativePath' - The path and file name of the notebook file for this execution, relative
-- to the path specified for the EMR Notebook. For example, if you specify
-- a path of @s3:\/\/MyBucket\/MyNotebooks@ when you create an EMR Notebook
-- for a notebook with an ID of @e-ABCDEFGHIJK1234567890ABCD@ (the
-- @EditorID@ of this request), and you specify a @RelativePath@ of
-- @my_notebook_executions\/notebook_execution.ipynb@, the location of the
-- file for the notebook execution is
-- @s3:\/\/MyBucket\/MyNotebooks\/e-ABCDEFGHIJK1234567890ABCD\/my_notebook_executions\/notebook_execution.ipynb@.
--
-- 'executionEngine', 'startNotebookExecution_executionEngine' - Specifies the execution engine (cluster) that runs the notebook
-- execution.
--
-- 'serviceRole', 'startNotebookExecution_serviceRole' - The name or ARN of the IAM role that is used as the service role for
-- Amazon EMR (the EMR role) for the notebook execution.
newStartNotebookExecution ::
  -- | 'editorId'
  Prelude.Text ->
  -- | 'relativePath'
  Prelude.Text ->
  -- | 'executionEngine'
  ExecutionEngineConfig ->
  -- | 'serviceRole'
  Prelude.Text ->
  StartNotebookExecution
newStartNotebookExecution :: Text
-> Text -> ExecutionEngineConfig -> Text -> StartNotebookExecution
newStartNotebookExecution
  Text
pEditorId_
  Text
pRelativePath_
  ExecutionEngineConfig
pExecutionEngine_
  Text
pServiceRole_ =
    StartNotebookExecution' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> ExecutionEngineConfig
-> Text
-> StartNotebookExecution
StartNotebookExecution'
      { $sel:notebookInstanceSecurityGroupId:StartNotebookExecution' :: Maybe Text
notebookInstanceSecurityGroupId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:notebookExecutionName:StartNotebookExecution' :: Maybe Text
notebookExecutionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:notebookParams:StartNotebookExecution' :: Maybe Text
notebookParams = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:StartNotebookExecution' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:editorId:StartNotebookExecution' :: Text
editorId = Text
pEditorId_,
        $sel:relativePath:StartNotebookExecution' :: Text
relativePath = Text
pRelativePath_,
        $sel:executionEngine:StartNotebookExecution' :: ExecutionEngineConfig
executionEngine = ExecutionEngineConfig
pExecutionEngine_,
        $sel:serviceRole:StartNotebookExecution' :: Text
serviceRole = Text
pServiceRole_
      }

-- | The unique identifier of the Amazon EC2 security group to associate with
-- the EMR Notebook for this notebook execution.
startNotebookExecution_notebookInstanceSecurityGroupId :: Lens.Lens' StartNotebookExecution (Prelude.Maybe Prelude.Text)
startNotebookExecution_notebookInstanceSecurityGroupId :: (Maybe Text -> f (Maybe Text))
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_notebookInstanceSecurityGroupId = (StartNotebookExecution -> Maybe Text)
-> (StartNotebookExecution -> Maybe Text -> StartNotebookExecution)
-> Lens
     StartNotebookExecution
     StartNotebookExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Maybe Text
notebookInstanceSecurityGroupId :: Maybe Text
$sel:notebookInstanceSecurityGroupId:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
notebookInstanceSecurityGroupId} -> Maybe Text
notebookInstanceSecurityGroupId) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Maybe Text
a -> StartNotebookExecution
s {$sel:notebookInstanceSecurityGroupId:StartNotebookExecution' :: Maybe Text
notebookInstanceSecurityGroupId = Maybe Text
a} :: StartNotebookExecution)

-- | An optional name for the notebook execution.
startNotebookExecution_notebookExecutionName :: Lens.Lens' StartNotebookExecution (Prelude.Maybe Prelude.Text)
startNotebookExecution_notebookExecutionName :: (Maybe Text -> f (Maybe Text))
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_notebookExecutionName = (StartNotebookExecution -> Maybe Text)
-> (StartNotebookExecution -> Maybe Text -> StartNotebookExecution)
-> Lens
     StartNotebookExecution
     StartNotebookExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Maybe Text
notebookExecutionName :: Maybe Text
$sel:notebookExecutionName:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
notebookExecutionName} -> Maybe Text
notebookExecutionName) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Maybe Text
a -> StartNotebookExecution
s {$sel:notebookExecutionName:StartNotebookExecution' :: Maybe Text
notebookExecutionName = Maybe Text
a} :: StartNotebookExecution)

-- | Input parameters in JSON format passed to the EMR Notebook at runtime
-- for execution.
startNotebookExecution_notebookParams :: Lens.Lens' StartNotebookExecution (Prelude.Maybe Prelude.Text)
startNotebookExecution_notebookParams :: (Maybe Text -> f (Maybe Text))
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_notebookParams = (StartNotebookExecution -> Maybe Text)
-> (StartNotebookExecution -> Maybe Text -> StartNotebookExecution)
-> Lens
     StartNotebookExecution
     StartNotebookExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Maybe Text
notebookParams :: Maybe Text
$sel:notebookParams:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
notebookParams} -> Maybe Text
notebookParams) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Maybe Text
a -> StartNotebookExecution
s {$sel:notebookParams:StartNotebookExecution' :: Maybe Text
notebookParams = Maybe Text
a} :: StartNotebookExecution)

-- | A list of tags associated with a notebook execution. Tags are
-- user-defined key-value pairs that consist of a required key string with
-- a maximum of 128 characters and an optional value string with a maximum
-- of 256 characters.
startNotebookExecution_tags :: Lens.Lens' StartNotebookExecution (Prelude.Maybe [Tag])
startNotebookExecution_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_tags = (StartNotebookExecution -> Maybe [Tag])
-> (StartNotebookExecution
    -> Maybe [Tag] -> StartNotebookExecution)
-> Lens
     StartNotebookExecution
     StartNotebookExecution
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StartNotebookExecution' :: StartNotebookExecution -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Maybe [Tag]
a -> StartNotebookExecution
s {$sel:tags:StartNotebookExecution' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StartNotebookExecution) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> StartNotebookExecution -> f StartNotebookExecution)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> StartNotebookExecution
-> f StartNotebookExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier of the EMR Notebook to use for notebook execution.
startNotebookExecution_editorId :: Lens.Lens' StartNotebookExecution Prelude.Text
startNotebookExecution_editorId :: (Text -> f Text)
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_editorId = (StartNotebookExecution -> Text)
-> (StartNotebookExecution -> Text -> StartNotebookExecution)
-> Lens StartNotebookExecution StartNotebookExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Text
editorId :: Text
$sel:editorId:StartNotebookExecution' :: StartNotebookExecution -> Text
editorId} -> Text
editorId) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Text
a -> StartNotebookExecution
s {$sel:editorId:StartNotebookExecution' :: Text
editorId = Text
a} :: StartNotebookExecution)

-- | The path and file name of the notebook file for this execution, relative
-- to the path specified for the EMR Notebook. For example, if you specify
-- a path of @s3:\/\/MyBucket\/MyNotebooks@ when you create an EMR Notebook
-- for a notebook with an ID of @e-ABCDEFGHIJK1234567890ABCD@ (the
-- @EditorID@ of this request), and you specify a @RelativePath@ of
-- @my_notebook_executions\/notebook_execution.ipynb@, the location of the
-- file for the notebook execution is
-- @s3:\/\/MyBucket\/MyNotebooks\/e-ABCDEFGHIJK1234567890ABCD\/my_notebook_executions\/notebook_execution.ipynb@.
startNotebookExecution_relativePath :: Lens.Lens' StartNotebookExecution Prelude.Text
startNotebookExecution_relativePath :: (Text -> f Text)
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_relativePath = (StartNotebookExecution -> Text)
-> (StartNotebookExecution -> Text -> StartNotebookExecution)
-> Lens StartNotebookExecution StartNotebookExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Text
relativePath :: Text
$sel:relativePath:StartNotebookExecution' :: StartNotebookExecution -> Text
relativePath} -> Text
relativePath) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Text
a -> StartNotebookExecution
s {$sel:relativePath:StartNotebookExecution' :: Text
relativePath = Text
a} :: StartNotebookExecution)

-- | Specifies the execution engine (cluster) that runs the notebook
-- execution.
startNotebookExecution_executionEngine :: Lens.Lens' StartNotebookExecution ExecutionEngineConfig
startNotebookExecution_executionEngine :: (ExecutionEngineConfig -> f ExecutionEngineConfig)
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_executionEngine = (StartNotebookExecution -> ExecutionEngineConfig)
-> (StartNotebookExecution
    -> ExecutionEngineConfig -> StartNotebookExecution)
-> Lens
     StartNotebookExecution
     StartNotebookExecution
     ExecutionEngineConfig
     ExecutionEngineConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {ExecutionEngineConfig
executionEngine :: ExecutionEngineConfig
$sel:executionEngine:StartNotebookExecution' :: StartNotebookExecution -> ExecutionEngineConfig
executionEngine} -> ExecutionEngineConfig
executionEngine) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} ExecutionEngineConfig
a -> StartNotebookExecution
s {$sel:executionEngine:StartNotebookExecution' :: ExecutionEngineConfig
executionEngine = ExecutionEngineConfig
a} :: StartNotebookExecution)

-- | The name or ARN of the IAM role that is used as the service role for
-- Amazon EMR (the EMR role) for the notebook execution.
startNotebookExecution_serviceRole :: Lens.Lens' StartNotebookExecution Prelude.Text
startNotebookExecution_serviceRole :: (Text -> f Text)
-> StartNotebookExecution -> f StartNotebookExecution
startNotebookExecution_serviceRole = (StartNotebookExecution -> Text)
-> (StartNotebookExecution -> Text -> StartNotebookExecution)
-> Lens StartNotebookExecution StartNotebookExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecution' {Text
serviceRole :: Text
$sel:serviceRole:StartNotebookExecution' :: StartNotebookExecution -> Text
serviceRole} -> Text
serviceRole) (\s :: StartNotebookExecution
s@StartNotebookExecution' {} Text
a -> StartNotebookExecution
s {$sel:serviceRole:StartNotebookExecution' :: Text
serviceRole = Text
a} :: StartNotebookExecution)

instance Core.AWSRequest StartNotebookExecution where
  type
    AWSResponse StartNotebookExecution =
      StartNotebookExecutionResponse
  request :: StartNotebookExecution -> Request StartNotebookExecution
request = Service -> StartNotebookExecution -> Request StartNotebookExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartNotebookExecution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartNotebookExecution))
-> Logger
-> Service
-> Proxy StartNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartNotebookExecution)))
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 -> StartNotebookExecutionResponse
StartNotebookExecutionResponse'
            (Maybe Text -> Int -> StartNotebookExecutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartNotebookExecutionResponse)
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
"NotebookExecutionId")
            Either String (Int -> StartNotebookExecutionResponse)
-> Either String Int
-> Either String StartNotebookExecutionResponse
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 StartNotebookExecution

instance Prelude.NFData StartNotebookExecution

instance Core.ToHeaders StartNotebookExecution where
  toHeaders :: StartNotebookExecution -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartNotebookExecution -> 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
"ElasticMapReduce.StartNotebookExecution" ::
                          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 StartNotebookExecution where
  toJSON :: StartNotebookExecution -> Value
toJSON StartNotebookExecution' {Maybe [Tag]
Maybe Text
Text
ExecutionEngineConfig
serviceRole :: Text
executionEngine :: ExecutionEngineConfig
relativePath :: Text
editorId :: Text
tags :: Maybe [Tag]
notebookParams :: Maybe Text
notebookExecutionName :: Maybe Text
notebookInstanceSecurityGroupId :: Maybe Text
$sel:serviceRole:StartNotebookExecution' :: StartNotebookExecution -> Text
$sel:executionEngine:StartNotebookExecution' :: StartNotebookExecution -> ExecutionEngineConfig
$sel:relativePath:StartNotebookExecution' :: StartNotebookExecution -> Text
$sel:editorId:StartNotebookExecution' :: StartNotebookExecution -> Text
$sel:tags:StartNotebookExecution' :: StartNotebookExecution -> Maybe [Tag]
$sel:notebookParams:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
$sel:notebookExecutionName:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
$sel:notebookInstanceSecurityGroupId:StartNotebookExecution' :: StartNotebookExecution -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NotebookInstanceSecurityGroupId" 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
notebookInstanceSecurityGroupId,
            (Text
"NotebookExecutionName" 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
notebookExecutionName,
            (Text
"NotebookParams" 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
notebookParams,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EditorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
editorId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RelativePath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
relativePath),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExecutionEngine" Text -> ExecutionEngineConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ExecutionEngineConfig
executionEngine),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceRole)
          ]
      )

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

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

-- | /See:/ 'newStartNotebookExecutionResponse' smart constructor.
data StartNotebookExecutionResponse = StartNotebookExecutionResponse'
  { -- | The unique identifier of the notebook execution.
    StartNotebookExecutionResponse -> Maybe Text
notebookExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartNotebookExecutionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartNotebookExecutionResponse
-> StartNotebookExecutionResponse -> Bool
(StartNotebookExecutionResponse
 -> StartNotebookExecutionResponse -> Bool)
-> (StartNotebookExecutionResponse
    -> StartNotebookExecutionResponse -> Bool)
-> Eq StartNotebookExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartNotebookExecutionResponse
-> StartNotebookExecutionResponse -> Bool
$c/= :: StartNotebookExecutionResponse
-> StartNotebookExecutionResponse -> Bool
== :: StartNotebookExecutionResponse
-> StartNotebookExecutionResponse -> Bool
$c== :: StartNotebookExecutionResponse
-> StartNotebookExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StartNotebookExecutionResponse]
ReadPrec StartNotebookExecutionResponse
Int -> ReadS StartNotebookExecutionResponse
ReadS [StartNotebookExecutionResponse]
(Int -> ReadS StartNotebookExecutionResponse)
-> ReadS [StartNotebookExecutionResponse]
-> ReadPrec StartNotebookExecutionResponse
-> ReadPrec [StartNotebookExecutionResponse]
-> Read StartNotebookExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartNotebookExecutionResponse]
$creadListPrec :: ReadPrec [StartNotebookExecutionResponse]
readPrec :: ReadPrec StartNotebookExecutionResponse
$creadPrec :: ReadPrec StartNotebookExecutionResponse
readList :: ReadS [StartNotebookExecutionResponse]
$creadList :: ReadS [StartNotebookExecutionResponse]
readsPrec :: Int -> ReadS StartNotebookExecutionResponse
$creadsPrec :: Int -> ReadS StartNotebookExecutionResponse
Prelude.Read, Int -> StartNotebookExecutionResponse -> ShowS
[StartNotebookExecutionResponse] -> ShowS
StartNotebookExecutionResponse -> String
(Int -> StartNotebookExecutionResponse -> ShowS)
-> (StartNotebookExecutionResponse -> String)
-> ([StartNotebookExecutionResponse] -> ShowS)
-> Show StartNotebookExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartNotebookExecutionResponse] -> ShowS
$cshowList :: [StartNotebookExecutionResponse] -> ShowS
show :: StartNotebookExecutionResponse -> String
$cshow :: StartNotebookExecutionResponse -> String
showsPrec :: Int -> StartNotebookExecutionResponse -> ShowS
$cshowsPrec :: Int -> StartNotebookExecutionResponse -> ShowS
Prelude.Show, (forall x.
 StartNotebookExecutionResponse
 -> Rep StartNotebookExecutionResponse x)
-> (forall x.
    Rep StartNotebookExecutionResponse x
    -> StartNotebookExecutionResponse)
-> Generic StartNotebookExecutionResponse
forall x.
Rep StartNotebookExecutionResponse x
-> StartNotebookExecutionResponse
forall x.
StartNotebookExecutionResponse
-> Rep StartNotebookExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartNotebookExecutionResponse x
-> StartNotebookExecutionResponse
$cfrom :: forall x.
StartNotebookExecutionResponse
-> Rep StartNotebookExecutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartNotebookExecutionResponse' 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:
--
-- 'notebookExecutionId', 'startNotebookExecutionResponse_notebookExecutionId' - The unique identifier of the notebook execution.
--
-- 'httpStatus', 'startNotebookExecutionResponse_httpStatus' - The response's http status code.
newStartNotebookExecutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartNotebookExecutionResponse
newStartNotebookExecutionResponse :: Int -> StartNotebookExecutionResponse
newStartNotebookExecutionResponse Int
pHttpStatus_ =
  StartNotebookExecutionResponse' :: Maybe Text -> Int -> StartNotebookExecutionResponse
StartNotebookExecutionResponse'
    { $sel:notebookExecutionId:StartNotebookExecutionResponse' :: Maybe Text
notebookExecutionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartNotebookExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of the notebook execution.
startNotebookExecutionResponse_notebookExecutionId :: Lens.Lens' StartNotebookExecutionResponse (Prelude.Maybe Prelude.Text)
startNotebookExecutionResponse_notebookExecutionId :: (Maybe Text -> f (Maybe Text))
-> StartNotebookExecutionResponse
-> f StartNotebookExecutionResponse
startNotebookExecutionResponse_notebookExecutionId = (StartNotebookExecutionResponse -> Maybe Text)
-> (StartNotebookExecutionResponse
    -> Maybe Text -> StartNotebookExecutionResponse)
-> Lens
     StartNotebookExecutionResponse
     StartNotebookExecutionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookExecutionResponse' {Maybe Text
notebookExecutionId :: Maybe Text
$sel:notebookExecutionId:StartNotebookExecutionResponse' :: StartNotebookExecutionResponse -> Maybe Text
notebookExecutionId} -> Maybe Text
notebookExecutionId) (\s :: StartNotebookExecutionResponse
s@StartNotebookExecutionResponse' {} Maybe Text
a -> StartNotebookExecutionResponse
s {$sel:notebookExecutionId:StartNotebookExecutionResponse' :: Maybe Text
notebookExecutionId = Maybe Text
a} :: StartNotebookExecutionResponse)

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

instance
  Prelude.NFData
    StartNotebookExecutionResponse