{-# 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-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)
--
-- 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_requestId,
    getImagePipelineResponse_imagePipeline,
    getImagePipelineResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.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:/ '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
(GetImagePipeline -> GetImagePipeline -> Bool)
-> (GetImagePipeline -> GetImagePipeline -> Bool)
-> Eq GetImagePipeline
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]
(Int -> ReadS GetImagePipeline)
-> ReadS [GetImagePipeline]
-> ReadPrec GetImagePipeline
-> ReadPrec [GetImagePipeline]
-> Read 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
(Int -> GetImagePipeline -> ShowS)
-> (GetImagePipeline -> String)
-> ([GetImagePipeline] -> ShowS)
-> Show GetImagePipeline
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. GetImagePipeline -> Rep GetImagePipeline x)
-> (forall x. Rep GetImagePipeline x -> GetImagePipeline)
-> Generic GetImagePipeline
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' :: Text -> GetImagePipeline
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 :: (Text -> f Text) -> GetImagePipeline -> f GetImagePipeline
getImagePipeline_imagePipelineArn = (GetImagePipeline -> Text)
-> (GetImagePipeline -> Text -> GetImagePipeline)
-> Lens GetImagePipeline GetImagePipeline Text Text
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 :: GetImagePipeline -> Request GetImagePipeline
request = Service -> GetImagePipeline -> Request GetImagePipeline
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetImagePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImagePipeline)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetImagePipeline))
-> Logger
-> Service
-> Proxy GetImagePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImagePipeline)))
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
-> Maybe ImagePipeline -> Int -> GetImagePipelineResponse
GetImagePipelineResponse'
            (Maybe Text
 -> Maybe ImagePipeline -> Int -> GetImagePipelineResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe ImagePipeline -> Int -> GetImagePipelineResponse)
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
"requestId")
            Either
  String (Maybe ImagePipeline -> Int -> GetImagePipelineResponse)
-> Either String (Maybe ImagePipeline)
-> Either String (Int -> GetImagePipelineResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ImagePipeline)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"imagePipeline")
            Either String (Int -> GetImagePipelineResponse)
-> Either String Int -> Either String GetImagePipelineResponse
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 GetImagePipeline

instance Prelude.NFData GetImagePipeline

instance Core.ToHeaders GetImagePipeline where
  toHeaders :: GetImagePipeline -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetImagePipeline -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetImagePipeline where
  toPath :: GetImagePipeline -> ByteString
toPath = ByteString -> GetImagePipeline -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetImagePipeline"

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

-- | /See:/ 'newGetImagePipelineResponse' smart constructor.
data GetImagePipelineResponse = GetImagePipelineResponse'
  { -- | The request ID that uniquely identifies this request.
    GetImagePipelineResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The image pipeline object.
    GetImagePipelineResponse -> Maybe ImagePipeline
imagePipeline :: Prelude.Maybe ImagePipeline,
    -- | The response's http status code.
    GetImagePipelineResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetImagePipelineResponse -> GetImagePipelineResponse -> Bool
(GetImagePipelineResponse -> GetImagePipelineResponse -> Bool)
-> (GetImagePipelineResponse -> GetImagePipelineResponse -> Bool)
-> Eq GetImagePipelineResponse
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]
(Int -> ReadS GetImagePipelineResponse)
-> ReadS [GetImagePipelineResponse]
-> ReadPrec GetImagePipelineResponse
-> ReadPrec [GetImagePipelineResponse]
-> Read 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
(Int -> GetImagePipelineResponse -> ShowS)
-> (GetImagePipelineResponse -> String)
-> ([GetImagePipelineResponse] -> ShowS)
-> Show GetImagePipelineResponse
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.
 GetImagePipelineResponse -> Rep GetImagePipelineResponse x)
-> (forall x.
    Rep GetImagePipelineResponse x -> GetImagePipelineResponse)
-> Generic GetImagePipelineResponse
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:
--
-- 'requestId', 'getImagePipelineResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'imagePipeline', 'getImagePipelineResponse_imagePipeline' - The image pipeline object.
--
-- 'httpStatus', 'getImagePipelineResponse_httpStatus' - The response's http status code.
newGetImagePipelineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetImagePipelineResponse
newGetImagePipelineResponse :: Int -> GetImagePipelineResponse
newGetImagePipelineResponse Int
pHttpStatus_ =
  GetImagePipelineResponse' :: Maybe Text
-> Maybe ImagePipeline -> Int -> GetImagePipelineResponse
GetImagePipelineResponse'
    { $sel:requestId:GetImagePipelineResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imagePipeline:GetImagePipelineResponse' :: Maybe ImagePipeline
imagePipeline = Maybe ImagePipeline
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetImagePipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request ID that uniquely identifies this request.
getImagePipelineResponse_requestId :: Lens.Lens' GetImagePipelineResponse (Prelude.Maybe Prelude.Text)
getImagePipelineResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> GetImagePipelineResponse -> f GetImagePipelineResponse
getImagePipelineResponse_requestId = (GetImagePipelineResponse -> Maybe Text)
-> (GetImagePipelineResponse
    -> Maybe Text -> GetImagePipelineResponse)
-> Lens
     GetImagePipelineResponse
     GetImagePipelineResponse
     (Maybe Text)
     (Maybe Text)
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 image pipeline object.
getImagePipelineResponse_imagePipeline :: Lens.Lens' GetImagePipelineResponse (Prelude.Maybe ImagePipeline)
getImagePipelineResponse_imagePipeline :: (Maybe ImagePipeline -> f (Maybe ImagePipeline))
-> GetImagePipelineResponse -> f GetImagePipelineResponse
getImagePipelineResponse_imagePipeline = (GetImagePipelineResponse -> Maybe ImagePipeline)
-> (GetImagePipelineResponse
    -> Maybe ImagePipeline -> GetImagePipelineResponse)
-> Lens
     GetImagePipelineResponse
     GetImagePipelineResponse
     (Maybe ImagePipeline)
     (Maybe 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 response's http status code.
getImagePipelineResponse_httpStatus :: Lens.Lens' GetImagePipelineResponse Prelude.Int
getImagePipelineResponse_httpStatus :: (Int -> f Int)
-> GetImagePipelineResponse -> f GetImagePipelineResponse
getImagePipelineResponse_httpStatus = (GetImagePipelineResponse -> Int)
-> (GetImagePipelineResponse -> Int -> GetImagePipelineResponse)
-> Lens GetImagePipelineResponse GetImagePipelineResponse Int Int
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