{-# 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.DescribeNotebookExecution
-- 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)
--
-- Provides details of a notebook execution.
module Amazonka.EMR.DescribeNotebookExecution
  ( -- * Creating a Request
    DescribeNotebookExecution (..),
    newDescribeNotebookExecution,

    -- * Request Lenses
    describeNotebookExecution_notebookExecutionId,

    -- * Destructuring the Response
    DescribeNotebookExecutionResponse (..),
    newDescribeNotebookExecutionResponse,

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

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

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

instance Core.AWSRequest DescribeNotebookExecution where
  type
    AWSResponse DescribeNotebookExecution =
      DescribeNotebookExecutionResponse
  request :: DescribeNotebookExecution -> Request DescribeNotebookExecution
request = Service
-> DescribeNotebookExecution -> Request DescribeNotebookExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeNotebookExecution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeNotebookExecution))
-> Logger
-> Service
-> Proxy DescribeNotebookExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeNotebookExecution)))
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 NotebookExecution -> Int -> DescribeNotebookExecutionResponse
DescribeNotebookExecutionResponse'
            (Maybe NotebookExecution
 -> Int -> DescribeNotebookExecutionResponse)
-> Either String (Maybe NotebookExecution)
-> Either String (Int -> DescribeNotebookExecutionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe NotebookExecution)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NotebookExecution")
            Either String (Int -> DescribeNotebookExecutionResponse)
-> Either String Int
-> Either String DescribeNotebookExecutionResponse
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 DescribeNotebookExecution

instance Prelude.NFData DescribeNotebookExecution

instance Core.ToHeaders DescribeNotebookExecution where
  toHeaders :: DescribeNotebookExecution -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeNotebookExecution -> 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.DescribeNotebookExecution" ::
                          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 DescribeNotebookExecution where
  toJSON :: DescribeNotebookExecution -> Value
toJSON DescribeNotebookExecution' {Text
notebookExecutionId :: Text
$sel:notebookExecutionId:DescribeNotebookExecution' :: DescribeNotebookExecution -> 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 DescribeNotebookExecution where
  toPath :: DescribeNotebookExecution -> ByteString
toPath = ByteString -> DescribeNotebookExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DescribeNotebookExecutionResponse' 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:
--
-- 'notebookExecution', 'describeNotebookExecutionResponse_notebookExecution' - Properties of the notebook execution.
--
-- 'httpStatus', 'describeNotebookExecutionResponse_httpStatus' - The response's http status code.
newDescribeNotebookExecutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeNotebookExecutionResponse
newDescribeNotebookExecutionResponse :: Int -> DescribeNotebookExecutionResponse
newDescribeNotebookExecutionResponse Int
pHttpStatus_ =
  DescribeNotebookExecutionResponse' :: Maybe NotebookExecution -> Int -> DescribeNotebookExecutionResponse
DescribeNotebookExecutionResponse'
    { $sel:notebookExecution:DescribeNotebookExecutionResponse' :: Maybe NotebookExecution
notebookExecution =
        Maybe NotebookExecution
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeNotebookExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Properties of the notebook execution.
describeNotebookExecutionResponse_notebookExecution :: Lens.Lens' DescribeNotebookExecutionResponse (Prelude.Maybe NotebookExecution)
describeNotebookExecutionResponse_notebookExecution :: (Maybe NotebookExecution -> f (Maybe NotebookExecution))
-> DescribeNotebookExecutionResponse
-> f DescribeNotebookExecutionResponse
describeNotebookExecutionResponse_notebookExecution = (DescribeNotebookExecutionResponse -> Maybe NotebookExecution)
-> (DescribeNotebookExecutionResponse
    -> Maybe NotebookExecution -> DescribeNotebookExecutionResponse)
-> Lens
     DescribeNotebookExecutionResponse
     DescribeNotebookExecutionResponse
     (Maybe NotebookExecution)
     (Maybe NotebookExecution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotebookExecutionResponse' {Maybe NotebookExecution
notebookExecution :: Maybe NotebookExecution
$sel:notebookExecution:DescribeNotebookExecutionResponse' :: DescribeNotebookExecutionResponse -> Maybe NotebookExecution
notebookExecution} -> Maybe NotebookExecution
notebookExecution) (\s :: DescribeNotebookExecutionResponse
s@DescribeNotebookExecutionResponse' {} Maybe NotebookExecution
a -> DescribeNotebookExecutionResponse
s {$sel:notebookExecution:DescribeNotebookExecutionResponse' :: Maybe NotebookExecution
notebookExecution = Maybe NotebookExecution
a} :: DescribeNotebookExecutionResponse)

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

instance
  Prelude.NFData
    DescribeNotebookExecutionResponse