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

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

-- |
-- Module      : Amazonka.Glue.GetBlueprintRun
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the details of a blueprint run.
module Amazonka.Glue.GetBlueprintRun
  ( -- * Creating a Request
    GetBlueprintRun (..),
    newGetBlueprintRun,

    -- * Request Lenses
    getBlueprintRun_blueprintName,
    getBlueprintRun_runId,

    -- * Destructuring the Response
    GetBlueprintRunResponse (..),
    newGetBlueprintRunResponse,

    -- * Response Lenses
    getBlueprintRunResponse_blueprintRun,
    getBlueprintRunResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetBlueprintRun' smart constructor.
data GetBlueprintRun = GetBlueprintRun'
  { -- | The name of the blueprint.
    GetBlueprintRun -> Text
blueprintName :: Prelude.Text,
    -- | The run ID for the blueprint run you want to retrieve.
    GetBlueprintRun -> Text
runId :: Prelude.Text
  }
  deriving (GetBlueprintRun -> GetBlueprintRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBlueprintRun -> GetBlueprintRun -> Bool
$c/= :: GetBlueprintRun -> GetBlueprintRun -> Bool
== :: GetBlueprintRun -> GetBlueprintRun -> Bool
$c== :: GetBlueprintRun -> GetBlueprintRun -> Bool
Prelude.Eq, ReadPrec [GetBlueprintRun]
ReadPrec GetBlueprintRun
Int -> ReadS GetBlueprintRun
ReadS [GetBlueprintRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBlueprintRun]
$creadListPrec :: ReadPrec [GetBlueprintRun]
readPrec :: ReadPrec GetBlueprintRun
$creadPrec :: ReadPrec GetBlueprintRun
readList :: ReadS [GetBlueprintRun]
$creadList :: ReadS [GetBlueprintRun]
readsPrec :: Int -> ReadS GetBlueprintRun
$creadsPrec :: Int -> ReadS GetBlueprintRun
Prelude.Read, Int -> GetBlueprintRun -> ShowS
[GetBlueprintRun] -> ShowS
GetBlueprintRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBlueprintRun] -> ShowS
$cshowList :: [GetBlueprintRun] -> ShowS
show :: GetBlueprintRun -> String
$cshow :: GetBlueprintRun -> String
showsPrec :: Int -> GetBlueprintRun -> ShowS
$cshowsPrec :: Int -> GetBlueprintRun -> ShowS
Prelude.Show, forall x. Rep GetBlueprintRun x -> GetBlueprintRun
forall x. GetBlueprintRun -> Rep GetBlueprintRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBlueprintRun x -> GetBlueprintRun
$cfrom :: forall x. GetBlueprintRun -> Rep GetBlueprintRun x
Prelude.Generic)

-- |
-- Create a value of 'GetBlueprintRun' 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:
--
-- 'blueprintName', 'getBlueprintRun_blueprintName' - The name of the blueprint.
--
-- 'runId', 'getBlueprintRun_runId' - The run ID for the blueprint run you want to retrieve.
newGetBlueprintRun ::
  -- | 'blueprintName'
  Prelude.Text ->
  -- | 'runId'
  Prelude.Text ->
  GetBlueprintRun
newGetBlueprintRun :: Text -> Text -> GetBlueprintRun
newGetBlueprintRun Text
pBlueprintName_ Text
pRunId_ =
  GetBlueprintRun'
    { $sel:blueprintName:GetBlueprintRun' :: Text
blueprintName = Text
pBlueprintName_,
      $sel:runId:GetBlueprintRun' :: Text
runId = Text
pRunId_
    }

-- | The name of the blueprint.
getBlueprintRun_blueprintName :: Lens.Lens' GetBlueprintRun Prelude.Text
getBlueprintRun_blueprintName :: Lens' GetBlueprintRun Text
getBlueprintRun_blueprintName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlueprintRun' {Text
blueprintName :: Text
$sel:blueprintName:GetBlueprintRun' :: GetBlueprintRun -> Text
blueprintName} -> Text
blueprintName) (\s :: GetBlueprintRun
s@GetBlueprintRun' {} Text
a -> GetBlueprintRun
s {$sel:blueprintName:GetBlueprintRun' :: Text
blueprintName = Text
a} :: GetBlueprintRun)

-- | The run ID for the blueprint run you want to retrieve.
getBlueprintRun_runId :: Lens.Lens' GetBlueprintRun Prelude.Text
getBlueprintRun_runId :: Lens' GetBlueprintRun Text
getBlueprintRun_runId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlueprintRun' {Text
runId :: Text
$sel:runId:GetBlueprintRun' :: GetBlueprintRun -> Text
runId} -> Text
runId) (\s :: GetBlueprintRun
s@GetBlueprintRun' {} Text
a -> GetBlueprintRun
s {$sel:runId:GetBlueprintRun' :: Text
runId = Text
a} :: GetBlueprintRun)

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

instance Prelude.Hashable GetBlueprintRun where
  hashWithSalt :: Int -> GetBlueprintRun -> Int
hashWithSalt Int
_salt GetBlueprintRun' {Text
runId :: Text
blueprintName :: Text
$sel:runId:GetBlueprintRun' :: GetBlueprintRun -> Text
$sel:blueprintName:GetBlueprintRun' :: GetBlueprintRun -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
blueprintName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
runId

instance Prelude.NFData GetBlueprintRun where
  rnf :: GetBlueprintRun -> ()
rnf GetBlueprintRun' {Text
runId :: Text
blueprintName :: Text
$sel:runId:GetBlueprintRun' :: GetBlueprintRun -> Text
$sel:blueprintName:GetBlueprintRun' :: GetBlueprintRun -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
blueprintName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
runId

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

instance Data.ToJSON GetBlueprintRun where
  toJSON :: GetBlueprintRun -> Value
toJSON GetBlueprintRun' {Text
runId :: Text
blueprintName :: Text
$sel:runId:GetBlueprintRun' :: GetBlueprintRun -> Text
$sel:blueprintName:GetBlueprintRun' :: GetBlueprintRun -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"BlueprintName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
blueprintName),
            forall a. a -> Maybe a
Prelude.Just (Key
"RunId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
runId)
          ]
      )

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

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

-- | /See:/ 'newGetBlueprintRunResponse' smart constructor.
data GetBlueprintRunResponse = GetBlueprintRunResponse'
  { -- | Returns a @BlueprintRun@ object.
    GetBlueprintRunResponse -> Maybe BlueprintRun
blueprintRun :: Prelude.Maybe BlueprintRun,
    -- | The response's http status code.
    GetBlueprintRunResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBlueprintRunResponse -> GetBlueprintRunResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBlueprintRunResponse -> GetBlueprintRunResponse -> Bool
$c/= :: GetBlueprintRunResponse -> GetBlueprintRunResponse -> Bool
== :: GetBlueprintRunResponse -> GetBlueprintRunResponse -> Bool
$c== :: GetBlueprintRunResponse -> GetBlueprintRunResponse -> Bool
Prelude.Eq, ReadPrec [GetBlueprintRunResponse]
ReadPrec GetBlueprintRunResponse
Int -> ReadS GetBlueprintRunResponse
ReadS [GetBlueprintRunResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBlueprintRunResponse]
$creadListPrec :: ReadPrec [GetBlueprintRunResponse]
readPrec :: ReadPrec GetBlueprintRunResponse
$creadPrec :: ReadPrec GetBlueprintRunResponse
readList :: ReadS [GetBlueprintRunResponse]
$creadList :: ReadS [GetBlueprintRunResponse]
readsPrec :: Int -> ReadS GetBlueprintRunResponse
$creadsPrec :: Int -> ReadS GetBlueprintRunResponse
Prelude.Read, Int -> GetBlueprintRunResponse -> ShowS
[GetBlueprintRunResponse] -> ShowS
GetBlueprintRunResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBlueprintRunResponse] -> ShowS
$cshowList :: [GetBlueprintRunResponse] -> ShowS
show :: GetBlueprintRunResponse -> String
$cshow :: GetBlueprintRunResponse -> String
showsPrec :: Int -> GetBlueprintRunResponse -> ShowS
$cshowsPrec :: Int -> GetBlueprintRunResponse -> ShowS
Prelude.Show, forall x. Rep GetBlueprintRunResponse x -> GetBlueprintRunResponse
forall x. GetBlueprintRunResponse -> Rep GetBlueprintRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBlueprintRunResponse x -> GetBlueprintRunResponse
$cfrom :: forall x. GetBlueprintRunResponse -> Rep GetBlueprintRunResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetBlueprintRunResponse' 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:
--
-- 'blueprintRun', 'getBlueprintRunResponse_blueprintRun' - Returns a @BlueprintRun@ object.
--
-- 'httpStatus', 'getBlueprintRunResponse_httpStatus' - The response's http status code.
newGetBlueprintRunResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBlueprintRunResponse
newGetBlueprintRunResponse :: Int -> GetBlueprintRunResponse
newGetBlueprintRunResponse Int
pHttpStatus_ =
  GetBlueprintRunResponse'
    { $sel:blueprintRun:GetBlueprintRunResponse' :: Maybe BlueprintRun
blueprintRun =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBlueprintRunResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns a @BlueprintRun@ object.
getBlueprintRunResponse_blueprintRun :: Lens.Lens' GetBlueprintRunResponse (Prelude.Maybe BlueprintRun)
getBlueprintRunResponse_blueprintRun :: Lens' GetBlueprintRunResponse (Maybe BlueprintRun)
getBlueprintRunResponse_blueprintRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlueprintRunResponse' {Maybe BlueprintRun
blueprintRun :: Maybe BlueprintRun
$sel:blueprintRun:GetBlueprintRunResponse' :: GetBlueprintRunResponse -> Maybe BlueprintRun
blueprintRun} -> Maybe BlueprintRun
blueprintRun) (\s :: GetBlueprintRunResponse
s@GetBlueprintRunResponse' {} Maybe BlueprintRun
a -> GetBlueprintRunResponse
s {$sel:blueprintRun:GetBlueprintRunResponse' :: Maybe BlueprintRun
blueprintRun = Maybe BlueprintRun
a} :: GetBlueprintRunResponse)

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

instance Prelude.NFData GetBlueprintRunResponse where
  rnf :: GetBlueprintRunResponse -> ()
rnf GetBlueprintRunResponse' {Int
Maybe BlueprintRun
httpStatus :: Int
blueprintRun :: Maybe BlueprintRun
$sel:httpStatus:GetBlueprintRunResponse' :: GetBlueprintRunResponse -> Int
$sel:blueprintRun:GetBlueprintRunResponse' :: GetBlueprintRunResponse -> Maybe BlueprintRun
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BlueprintRun
blueprintRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus