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

    -- * Request Lenses
    stopNotebookExecution_notebookExecutionId,

    -- * Destructuring the Response
    StopNotebookExecutionResponse (..),
    newStopNotebookExecutionResponse,
  )
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:/ 'newStopNotebookExecution' smart constructor.
data StopNotebookExecution = StopNotebookExecution'
  { -- | The unique identifier of the notebook execution.
    StopNotebookExecution -> Text
notebookExecutionId :: Prelude.Text
  }
  deriving (StopNotebookExecution -> StopNotebookExecution -> Bool
(StopNotebookExecution -> StopNotebookExecution -> Bool)
-> (StopNotebookExecution -> StopNotebookExecution -> Bool)
-> Eq StopNotebookExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopNotebookExecution -> StopNotebookExecution -> Bool
$c/= :: StopNotebookExecution -> StopNotebookExecution -> Bool
== :: StopNotebookExecution -> StopNotebookExecution -> Bool
$c== :: StopNotebookExecution -> StopNotebookExecution -> Bool
Prelude.Eq, ReadPrec [StopNotebookExecution]
ReadPrec StopNotebookExecution
Int -> ReadS StopNotebookExecution
ReadS [StopNotebookExecution]
(Int -> ReadS StopNotebookExecution)
-> ReadS [StopNotebookExecution]
-> ReadPrec StopNotebookExecution
-> ReadPrec [StopNotebookExecution]
-> Read StopNotebookExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopNotebookExecution]
$creadListPrec :: ReadPrec [StopNotebookExecution]
readPrec :: ReadPrec StopNotebookExecution
$creadPrec :: ReadPrec StopNotebookExecution
readList :: ReadS [StopNotebookExecution]
$creadList :: ReadS [StopNotebookExecution]
readsPrec :: Int -> ReadS StopNotebookExecution
$creadsPrec :: Int -> ReadS StopNotebookExecution
Prelude.Read, Int -> StopNotebookExecution -> ShowS
[StopNotebookExecution] -> ShowS
StopNotebookExecution -> String
(Int -> StopNotebookExecution -> ShowS)
-> (StopNotebookExecution -> String)
-> ([StopNotebookExecution] -> ShowS)
-> Show StopNotebookExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopNotebookExecution] -> ShowS
$cshowList :: [StopNotebookExecution] -> ShowS
show :: StopNotebookExecution -> String
$cshow :: StopNotebookExecution -> String
showsPrec :: Int -> StopNotebookExecution -> ShowS
$cshowsPrec :: Int -> StopNotebookExecution -> ShowS
Prelude.Show, (forall x. StopNotebookExecution -> Rep StopNotebookExecution x)
-> (forall x. Rep StopNotebookExecution x -> StopNotebookExecution)
-> Generic StopNotebookExecution
forall x. Rep StopNotebookExecution x -> StopNotebookExecution
forall x. StopNotebookExecution -> Rep StopNotebookExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopNotebookExecution x -> StopNotebookExecution
$cfrom :: forall x. StopNotebookExecution -> Rep StopNotebookExecution x
Prelude.Generic)

-- |
-- Create a value of 'StopNotebookExecution' 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', 'stopNotebookExecution_notebookExecutionId' - The unique identifier of the notebook execution.
newStopNotebookExecution ::
  -- | 'notebookExecutionId'
  Prelude.Text ->
  StopNotebookExecution
newStopNotebookExecution :: Text -> StopNotebookExecution
newStopNotebookExecution Text
pNotebookExecutionId_ =
  StopNotebookExecution' :: Text -> StopNotebookExecution
StopNotebookExecution'
    { $sel:notebookExecutionId:StopNotebookExecution' :: Text
notebookExecutionId =
        Text
pNotebookExecutionId_
    }

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

instance Core.AWSRequest StopNotebookExecution where
  type
    AWSResponse StopNotebookExecution =
      StopNotebookExecutionResponse
  request :: StopNotebookExecution -> Request StopNotebookExecution
request = Service -> StopNotebookExecution -> Request StopNotebookExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopNotebookExecution)))
response =
    AWSResponse StopNotebookExecution
-> Logger
-> Service
-> Proxy StopNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopNotebookExecution)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse StopNotebookExecution
StopNotebookExecutionResponse
StopNotebookExecutionResponse'

instance Prelude.Hashable StopNotebookExecution

instance Prelude.NFData StopNotebookExecution

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

instance Core.ToJSON StopNotebookExecution where
  toJSON :: StopNotebookExecution -> Value
toJSON StopNotebookExecution' {Text
notebookExecutionId :: Text
$sel:notebookExecutionId:StopNotebookExecution' :: StopNotebookExecution -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"NotebookExecutionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
notebookExecutionId)
          ]
      )

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

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

-- | /See:/ 'newStopNotebookExecutionResponse' smart constructor.
data StopNotebookExecutionResponse = StopNotebookExecutionResponse'
  {
  }
  deriving (StopNotebookExecutionResponse
-> StopNotebookExecutionResponse -> Bool
(StopNotebookExecutionResponse
 -> StopNotebookExecutionResponse -> Bool)
-> (StopNotebookExecutionResponse
    -> StopNotebookExecutionResponse -> Bool)
-> Eq StopNotebookExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopNotebookExecutionResponse
-> StopNotebookExecutionResponse -> Bool
$c/= :: StopNotebookExecutionResponse
-> StopNotebookExecutionResponse -> Bool
== :: StopNotebookExecutionResponse
-> StopNotebookExecutionResponse -> Bool
$c== :: StopNotebookExecutionResponse
-> StopNotebookExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StopNotebookExecutionResponse]
ReadPrec StopNotebookExecutionResponse
Int -> ReadS StopNotebookExecutionResponse
ReadS [StopNotebookExecutionResponse]
(Int -> ReadS StopNotebookExecutionResponse)
-> ReadS [StopNotebookExecutionResponse]
-> ReadPrec StopNotebookExecutionResponse
-> ReadPrec [StopNotebookExecutionResponse]
-> Read StopNotebookExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopNotebookExecutionResponse]
$creadListPrec :: ReadPrec [StopNotebookExecutionResponse]
readPrec :: ReadPrec StopNotebookExecutionResponse
$creadPrec :: ReadPrec StopNotebookExecutionResponse
readList :: ReadS [StopNotebookExecutionResponse]
$creadList :: ReadS [StopNotebookExecutionResponse]
readsPrec :: Int -> ReadS StopNotebookExecutionResponse
$creadsPrec :: Int -> ReadS StopNotebookExecutionResponse
Prelude.Read, Int -> StopNotebookExecutionResponse -> ShowS
[StopNotebookExecutionResponse] -> ShowS
StopNotebookExecutionResponse -> String
(Int -> StopNotebookExecutionResponse -> ShowS)
-> (StopNotebookExecutionResponse -> String)
-> ([StopNotebookExecutionResponse] -> ShowS)
-> Show StopNotebookExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopNotebookExecutionResponse] -> ShowS
$cshowList :: [StopNotebookExecutionResponse] -> ShowS
show :: StopNotebookExecutionResponse -> String
$cshow :: StopNotebookExecutionResponse -> String
showsPrec :: Int -> StopNotebookExecutionResponse -> ShowS
$cshowsPrec :: Int -> StopNotebookExecutionResponse -> ShowS
Prelude.Show, (forall x.
 StopNotebookExecutionResponse
 -> Rep StopNotebookExecutionResponse x)
-> (forall x.
    Rep StopNotebookExecutionResponse x
    -> StopNotebookExecutionResponse)
-> Generic StopNotebookExecutionResponse
forall x.
Rep StopNotebookExecutionResponse x
-> StopNotebookExecutionResponse
forall x.
StopNotebookExecutionResponse
-> Rep StopNotebookExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopNotebookExecutionResponse x
-> StopNotebookExecutionResponse
$cfrom :: forall x.
StopNotebookExecutionResponse
-> Rep StopNotebookExecutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopNotebookExecutionResponse' 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.
newStopNotebookExecutionResponse ::
  StopNotebookExecutionResponse
newStopNotebookExecutionResponse :: StopNotebookExecutionResponse
newStopNotebookExecutionResponse =
  StopNotebookExecutionResponse
StopNotebookExecutionResponse'

instance Prelude.NFData StopNotebookExecutionResponse