{-# 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.GetContainerRecipe
-- 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 a container recipe.
module Amazonka.ImageBuilder.GetContainerRecipe
  ( -- * Creating a Request
    GetContainerRecipe (..),
    newGetContainerRecipe,

    -- * Request Lenses
    getContainerRecipe_containerRecipeArn,

    -- * Destructuring the Response
    GetContainerRecipeResponse (..),
    newGetContainerRecipeResponse,

    -- * Response Lenses
    getContainerRecipeResponse_containerRecipe,
    getContainerRecipeResponse_requestId,
    getContainerRecipeResponse_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:/ 'newGetContainerRecipe' smart constructor.
data GetContainerRecipe = GetContainerRecipe'
  { -- | The Amazon Resource Name (ARN) of the container recipe to retrieve.
    GetContainerRecipe -> Text
containerRecipeArn :: Prelude.Text
  }
  deriving (GetContainerRecipe -> GetContainerRecipe -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerRecipe -> GetContainerRecipe -> Bool
$c/= :: GetContainerRecipe -> GetContainerRecipe -> Bool
== :: GetContainerRecipe -> GetContainerRecipe -> Bool
$c== :: GetContainerRecipe -> GetContainerRecipe -> Bool
Prelude.Eq, ReadPrec [GetContainerRecipe]
ReadPrec GetContainerRecipe
Int -> ReadS GetContainerRecipe
ReadS [GetContainerRecipe]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerRecipe]
$creadListPrec :: ReadPrec [GetContainerRecipe]
readPrec :: ReadPrec GetContainerRecipe
$creadPrec :: ReadPrec GetContainerRecipe
readList :: ReadS [GetContainerRecipe]
$creadList :: ReadS [GetContainerRecipe]
readsPrec :: Int -> ReadS GetContainerRecipe
$creadsPrec :: Int -> ReadS GetContainerRecipe
Prelude.Read, Int -> GetContainerRecipe -> ShowS
[GetContainerRecipe] -> ShowS
GetContainerRecipe -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerRecipe] -> ShowS
$cshowList :: [GetContainerRecipe] -> ShowS
show :: GetContainerRecipe -> String
$cshow :: GetContainerRecipe -> String
showsPrec :: Int -> GetContainerRecipe -> ShowS
$cshowsPrec :: Int -> GetContainerRecipe -> ShowS
Prelude.Show, forall x. Rep GetContainerRecipe x -> GetContainerRecipe
forall x. GetContainerRecipe -> Rep GetContainerRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContainerRecipe x -> GetContainerRecipe
$cfrom :: forall x. GetContainerRecipe -> Rep GetContainerRecipe x
Prelude.Generic)

-- |
-- Create a value of 'GetContainerRecipe' 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:
--
-- 'containerRecipeArn', 'getContainerRecipe_containerRecipeArn' - The Amazon Resource Name (ARN) of the container recipe to retrieve.
newGetContainerRecipe ::
  -- | 'containerRecipeArn'
  Prelude.Text ->
  GetContainerRecipe
newGetContainerRecipe :: Text -> GetContainerRecipe
newGetContainerRecipe Text
pContainerRecipeArn_ =
  GetContainerRecipe'
    { $sel:containerRecipeArn:GetContainerRecipe' :: Text
containerRecipeArn =
        Text
pContainerRecipeArn_
    }

-- | The Amazon Resource Name (ARN) of the container recipe to retrieve.
getContainerRecipe_containerRecipeArn :: Lens.Lens' GetContainerRecipe Prelude.Text
getContainerRecipe_containerRecipeArn :: Lens' GetContainerRecipe Text
getContainerRecipe_containerRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerRecipe' {Text
containerRecipeArn :: Text
$sel:containerRecipeArn:GetContainerRecipe' :: GetContainerRecipe -> Text
containerRecipeArn} -> Text
containerRecipeArn) (\s :: GetContainerRecipe
s@GetContainerRecipe' {} Text
a -> GetContainerRecipe
s {$sel:containerRecipeArn:GetContainerRecipe' :: Text
containerRecipeArn = Text
a} :: GetContainerRecipe)

instance Core.AWSRequest GetContainerRecipe where
  type
    AWSResponse GetContainerRecipe =
      GetContainerRecipeResponse
  request :: (Service -> Service)
-> GetContainerRecipe -> Request GetContainerRecipe
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 GetContainerRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetContainerRecipe)))
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 ContainerRecipe
-> Maybe Text -> Int -> GetContainerRecipeResponse
GetContainerRecipeResponse'
            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
"containerRecipe")
            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 GetContainerRecipe where
  hashWithSalt :: Int -> GetContainerRecipe -> Int
hashWithSalt Int
_salt GetContainerRecipe' {Text
containerRecipeArn :: Text
$sel:containerRecipeArn:GetContainerRecipe' :: GetContainerRecipe -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerRecipeArn

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

instance Data.ToHeaders GetContainerRecipe where
  toHeaders :: GetContainerRecipe -> 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 GetContainerRecipe where
  toPath :: GetContainerRecipe -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/GetContainerRecipe"

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

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

-- |
-- Create a value of 'GetContainerRecipeResponse' 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:
--
-- 'containerRecipe', 'getContainerRecipeResponse_containerRecipe' - The container recipe object that is returned.
--
-- 'requestId', 'getContainerRecipeResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'httpStatus', 'getContainerRecipeResponse_httpStatus' - The response's http status code.
newGetContainerRecipeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetContainerRecipeResponse
newGetContainerRecipeResponse :: Int -> GetContainerRecipeResponse
newGetContainerRecipeResponse Int
pHttpStatus_ =
  GetContainerRecipeResponse'
    { $sel:containerRecipe:GetContainerRecipeResponse' :: Maybe ContainerRecipe
containerRecipe =
        forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:GetContainerRecipeResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetContainerRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The container recipe object that is returned.
getContainerRecipeResponse_containerRecipe :: Lens.Lens' GetContainerRecipeResponse (Prelude.Maybe ContainerRecipe)
getContainerRecipeResponse_containerRecipe :: Lens' GetContainerRecipeResponse (Maybe ContainerRecipe)
getContainerRecipeResponse_containerRecipe = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerRecipeResponse' {Maybe ContainerRecipe
containerRecipe :: Maybe ContainerRecipe
$sel:containerRecipe:GetContainerRecipeResponse' :: GetContainerRecipeResponse -> Maybe ContainerRecipe
containerRecipe} -> Maybe ContainerRecipe
containerRecipe) (\s :: GetContainerRecipeResponse
s@GetContainerRecipeResponse' {} Maybe ContainerRecipe
a -> GetContainerRecipeResponse
s {$sel:containerRecipe:GetContainerRecipeResponse' :: Maybe ContainerRecipe
containerRecipe = Maybe ContainerRecipe
a} :: GetContainerRecipeResponse)

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

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

instance Prelude.NFData GetContainerRecipeResponse where
  rnf :: GetContainerRecipeResponse -> ()
rnf GetContainerRecipeResponse' {Int
Maybe Text
Maybe ContainerRecipe
httpStatus :: Int
requestId :: Maybe Text
containerRecipe :: Maybe ContainerRecipe
$sel:httpStatus:GetContainerRecipeResponse' :: GetContainerRecipeResponse -> Int
$sel:requestId:GetContainerRecipeResponse' :: GetContainerRecipeResponse -> Maybe Text
$sel:containerRecipe:GetContainerRecipeResponse' :: GetContainerRecipeResponse -> Maybe ContainerRecipe
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerRecipe
containerRecipe
      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