{-# 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.ImageBuilder.GetImagePipeline
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets an image pipeline.
module Amazonka.ImageBuilder.GetImagePipeline
  ( -- * Creating a Request
    GetImagePipeline (..),
    newGetImagePipeline,

    -- * Request Lenses
    getImagePipeline_imagePipelineArn,

    -- * Destructuring the Response
    GetImagePipelineResponse (..),
    newGetImagePipelineResponse,

    -- * Response Lenses
    getImagePipelineResponse_imagePipeline,
    getImagePipelineResponse_requestId,
    getImagePipelineResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetImagePipeline' smart constructor.
data GetImagePipeline = GetImagePipeline'
  { -- | The Amazon Resource Name (ARN) of the image pipeline that you want to
    -- retrieve.
    GetImagePipeline -> Text
imagePipelineArn :: Prelude.Text
  }
  deriving (GetImagePipeline -> GetImagePipeline -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImagePipeline -> GetImagePipeline -> Bool
$c/= :: GetImagePipeline -> GetImagePipeline -> Bool
== :: GetImagePipeline -> GetImagePipeline -> Bool
$c== :: GetImagePipeline -> GetImagePipeline -> Bool
Prelude.Eq, ReadPrec [GetImagePipeline]
ReadPrec GetImagePipeline
Int -> ReadS GetImagePipeline
ReadS [GetImagePipeline]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImagePipeline]
$creadListPrec :: ReadPrec [GetImagePipeline]
readPrec :: ReadPrec GetImagePipeline
$creadPrec :: ReadPrec GetImagePipeline
readList :: ReadS [GetImagePipeline]
$creadList :: ReadS [GetImagePipeline]
readsPrec :: Int -> ReadS GetImagePipeline
$creadsPrec :: Int -> ReadS GetImagePipeline
Prelude.Read, Int -> GetImagePipeline -> ShowS
[GetImagePipeline] -> ShowS
GetImagePipeline -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImagePipeline] -> ShowS
$cshowList :: [GetImagePipeline] -> ShowS
show :: GetImagePipeline -> String
$cshow :: GetImagePipeline -> String
showsPrec :: Int -> GetImagePipeline -> ShowS
$cshowsPrec :: Int -> GetImagePipeline -> ShowS
Prelude.Show, forall x. Rep GetImagePipeline x -> GetImagePipeline
forall x. GetImagePipeline -> Rep GetImagePipeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImagePipeline x -> GetImagePipeline
$cfrom :: forall x. GetImagePipeline -> Rep GetImagePipeline x
Prelude.Generic)

-- |
-- Create a value of 'GetImagePipeline' 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:
--
-- 'imagePipelineArn', 'getImagePipeline_imagePipelineArn' - The Amazon Resource Name (ARN) of the image pipeline that you want to
-- retrieve.
newGetImagePipeline ::
  -- | 'imagePipelineArn'
  Prelude.Text ->
  GetImagePipeline
newGetImagePipeline :: Text -> GetImagePipeline
newGetImagePipeline Text
pImagePipelineArn_ =
  GetImagePipeline'
    { $sel:imagePipelineArn:GetImagePipeline' :: Text
imagePipelineArn =
        Text
pImagePipelineArn_
    }

-- | The Amazon Resource Name (ARN) of the image pipeline that you want to
-- retrieve.
getImagePipeline_imagePipelineArn :: Lens.Lens' GetImagePipeline Prelude.Text
getImagePipeline_imagePipelineArn :: Lens' GetImagePipeline Text
getImagePipeline_imagePipelineArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImagePipeline' {Text
imagePipelineArn :: Text
$sel:imagePipelineArn:GetImagePipeline' :: GetImagePipeline -> Text
imagePipelineArn} -> Text
imagePipelineArn) (\s :: GetImagePipeline
s@GetImagePipeline' {} Text
a -> GetImagePipeline
s {$sel:imagePipelineArn:GetImagePipeline' :: Text
imagePipelineArn = Text
a} :: GetImagePipeline)

instance Core.AWSRequest GetImagePipeline where
  type
    AWSResponse GetImagePipeline =
      GetImagePipelineResponse
  request :: (Service -> Service)
-> GetImagePipeline -> Request GetImagePipeline
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetImagePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImagePipeline)))
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 ImagePipeline
-> Maybe Text -> Int -> GetImagePipelineResponse
GetImagePipelineResponse'
            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
"imagePipeline")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"requestId")
            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 GetImagePipeline where
  hashWithSalt :: Int -> GetImagePipeline -> Int
hashWithSalt Int
_salt GetImagePipeline' {Text
imagePipelineArn :: Text
$sel:imagePipelineArn:GetImagePipeline' :: GetImagePipeline -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imagePipelineArn

instance Prelude.NFData GetImagePipeline where
  rnf :: GetImagePipeline -> ()
rnf GetImagePipeline' {Text
imagePipelineArn :: Text
$sel:imagePipelineArn:GetImagePipeline' :: GetImagePipeline -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
imagePipelineArn

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

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

instance Data.ToQuery GetImagePipeline where
  toQuery :: GetImagePipeline -> QueryString
toQuery GetImagePipeline' {Text
imagePipelineArn :: Text
$sel:imagePipelineArn:GetImagePipeline' :: GetImagePipeline -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"imagePipelineArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
imagePipelineArn]

-- | /See:/ 'newGetImagePipelineResponse' smart constructor.
data GetImagePipelineResponse = GetImagePipelineResponse'
  { -- | The image pipeline object.
    GetImagePipelineResponse -> Maybe ImagePipeline
imagePipeline :: Prelude.Maybe ImagePipeline,
    -- | The request ID that uniquely identifies this request.
    GetImagePipelineResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetImagePipelineResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
$c/= :: GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
== :: GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
$c== :: GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
Prelude.Eq, ReadPrec [GetImagePipelineResponse]
ReadPrec GetImagePipelineResponse
Int -> ReadS GetImagePipelineResponse
ReadS [GetImagePipelineResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImagePipelineResponse]
$creadListPrec :: ReadPrec [GetImagePipelineResponse]
readPrec :: ReadPrec GetImagePipelineResponse
$creadPrec :: ReadPrec GetImagePipelineResponse
readList :: ReadS [GetImagePipelineResponse]
$creadList :: ReadS [GetImagePipelineResponse]
readsPrec :: Int -> ReadS GetImagePipelineResponse
$creadsPrec :: Int -> ReadS GetImagePipelineResponse
Prelude.Read, Int -> GetImagePipelineResponse -> ShowS
[GetImagePipelineResponse] -> ShowS
GetImagePipelineResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImagePipelineResponse] -> ShowS
$cshowList :: [GetImagePipelineResponse] -> ShowS
show :: GetImagePipelineResponse -> String
$cshow :: GetImagePipelineResponse -> String
showsPrec :: Int -> GetImagePipelineResponse -> ShowS
$cshowsPrec :: Int -> GetImagePipelineResponse -> ShowS
Prelude.Show, forall x.
Rep GetImagePipelineResponse x -> GetImagePipelineResponse
forall x.
GetImagePipelineResponse -> Rep GetImagePipelineResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetImagePipelineResponse x -> GetImagePipelineResponse
$cfrom :: forall x.
GetImagePipelineResponse -> Rep GetImagePipelineResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetImagePipelineResponse' 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:
--
-- 'imagePipeline', 'getImagePipelineResponse_imagePipeline' - The image pipeline object.
--
-- 'requestId', 'getImagePipelineResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'httpStatus', 'getImagePipelineResponse_httpStatus' - The response's http status code.
newGetImagePipelineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetImagePipelineResponse
newGetImagePipelineResponse :: Int -> GetImagePipelineResponse
newGetImagePipelineResponse Int
pHttpStatus_ =
  GetImagePipelineResponse'
    { $sel:imagePipeline:GetImagePipelineResponse' :: Maybe ImagePipeline
imagePipeline =
        forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:GetImagePipelineResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetImagePipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The image pipeline object.
getImagePipelineResponse_imagePipeline :: Lens.Lens' GetImagePipelineResponse (Prelude.Maybe ImagePipeline)
getImagePipelineResponse_imagePipeline :: Lens' GetImagePipelineResponse (Maybe ImagePipeline)
getImagePipelineResponse_imagePipeline = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImagePipelineResponse' {Maybe ImagePipeline
imagePipeline :: Maybe ImagePipeline
$sel:imagePipeline:GetImagePipelineResponse' :: GetImagePipelineResponse -> Maybe ImagePipeline
imagePipeline} -> Maybe ImagePipeline
imagePipeline) (\s :: GetImagePipelineResponse
s@GetImagePipelineResponse' {} Maybe ImagePipeline
a -> GetImagePipelineResponse
s {$sel:imagePipeline:GetImagePipelineResponse' :: Maybe ImagePipeline
imagePipeline = Maybe ImagePipeline
a} :: GetImagePipelineResponse)

-- | The request ID that uniquely identifies this request.
getImagePipelineResponse_requestId :: Lens.Lens' GetImagePipelineResponse (Prelude.Maybe Prelude.Text)
getImagePipelineResponse_requestId :: Lens' GetImagePipelineResponse (Maybe Text)
getImagePipelineResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImagePipelineResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:GetImagePipelineResponse' :: GetImagePipelineResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: GetImagePipelineResponse
s@GetImagePipelineResponse' {} Maybe Text
a -> GetImagePipelineResponse
s {$sel:requestId:GetImagePipelineResponse' :: Maybe Text
requestId = Maybe Text
a} :: GetImagePipelineResponse)

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

instance Prelude.NFData GetImagePipelineResponse where
  rnf :: GetImagePipelineResponse -> ()
rnf GetImagePipelineResponse' {Int
Maybe Text
Maybe ImagePipeline
httpStatus :: Int
requestId :: Maybe Text
imagePipeline :: Maybe ImagePipeline
$sel:httpStatus:GetImagePipelineResponse' :: GetImagePipelineResponse -> Int
$sel:requestId:GetImagePipelineResponse' :: GetImagePipelineResponse -> Maybe Text
$sel:imagePipeline:GetImagePipelineResponse' :: GetImagePipelineResponse -> Maybe ImagePipeline
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ImagePipeline
imagePipeline
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus