{-# 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 #-}
module Amazonka.ImageBuilder.GetImageRecipe
(
GetImageRecipe (..),
newGetImageRecipe,
getImageRecipe_imageRecipeArn,
GetImageRecipeResponse (..),
newGetImageRecipeResponse,
getImageRecipeResponse_requestId,
getImageRecipeResponse_imageRecipe,
getImageRecipeResponse_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
data GetImageRecipe = GetImageRecipe'
{
GetImageRecipe -> Text
imageRecipeArn :: Prelude.Text
}
deriving (GetImageRecipe -> GetImageRecipe -> Bool
(GetImageRecipe -> GetImageRecipe -> Bool)
-> (GetImageRecipe -> GetImageRecipe -> Bool) -> Eq GetImageRecipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImageRecipe -> GetImageRecipe -> Bool
$c/= :: GetImageRecipe -> GetImageRecipe -> Bool
== :: GetImageRecipe -> GetImageRecipe -> Bool
$c== :: GetImageRecipe -> GetImageRecipe -> Bool
Prelude.Eq, ReadPrec [GetImageRecipe]
ReadPrec GetImageRecipe
Int -> ReadS GetImageRecipe
ReadS [GetImageRecipe]
(Int -> ReadS GetImageRecipe)
-> ReadS [GetImageRecipe]
-> ReadPrec GetImageRecipe
-> ReadPrec [GetImageRecipe]
-> Read GetImageRecipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImageRecipe]
$creadListPrec :: ReadPrec [GetImageRecipe]
readPrec :: ReadPrec GetImageRecipe
$creadPrec :: ReadPrec GetImageRecipe
readList :: ReadS [GetImageRecipe]
$creadList :: ReadS [GetImageRecipe]
readsPrec :: Int -> ReadS GetImageRecipe
$creadsPrec :: Int -> ReadS GetImageRecipe
Prelude.Read, Int -> GetImageRecipe -> ShowS
[GetImageRecipe] -> ShowS
GetImageRecipe -> String
(Int -> GetImageRecipe -> ShowS)
-> (GetImageRecipe -> String)
-> ([GetImageRecipe] -> ShowS)
-> Show GetImageRecipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImageRecipe] -> ShowS
$cshowList :: [GetImageRecipe] -> ShowS
show :: GetImageRecipe -> String
$cshow :: GetImageRecipe -> String
showsPrec :: Int -> GetImageRecipe -> ShowS
$cshowsPrec :: Int -> GetImageRecipe -> ShowS
Prelude.Show, (forall x. GetImageRecipe -> Rep GetImageRecipe x)
-> (forall x. Rep GetImageRecipe x -> GetImageRecipe)
-> Generic GetImageRecipe
forall x. Rep GetImageRecipe x -> GetImageRecipe
forall x. GetImageRecipe -> Rep GetImageRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImageRecipe x -> GetImageRecipe
$cfrom :: forall x. GetImageRecipe -> Rep GetImageRecipe x
Prelude.Generic)
newGetImageRecipe ::
Prelude.Text ->
GetImageRecipe
newGetImageRecipe :: Text -> GetImageRecipe
newGetImageRecipe Text
pImageRecipeArn_ =
GetImageRecipe' :: Text -> GetImageRecipe
GetImageRecipe' {$sel:imageRecipeArn:GetImageRecipe' :: Text
imageRecipeArn = Text
pImageRecipeArn_}
getImageRecipe_imageRecipeArn :: Lens.Lens' GetImageRecipe Prelude.Text
getImageRecipe_imageRecipeArn :: (Text -> f Text) -> GetImageRecipe -> f GetImageRecipe
getImageRecipe_imageRecipeArn = (GetImageRecipe -> Text)
-> (GetImageRecipe -> Text -> GetImageRecipe)
-> Lens GetImageRecipe GetImageRecipe Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImageRecipe' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:GetImageRecipe' :: GetImageRecipe -> Text
imageRecipeArn} -> Text
imageRecipeArn) (\s :: GetImageRecipe
s@GetImageRecipe' {} Text
a -> GetImageRecipe
s {$sel:imageRecipeArn:GetImageRecipe' :: Text
imageRecipeArn = Text
a} :: GetImageRecipe)
instance Core.AWSRequest GetImageRecipe where
type
AWSResponse GetImageRecipe =
GetImageRecipeResponse
request :: GetImageRecipe -> Request GetImageRecipe
request = Service -> GetImageRecipe -> Request GetImageRecipe
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetImageRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImageRecipe)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetImageRecipe))
-> Logger
-> Service
-> Proxy GetImageRecipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImageRecipe)))
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 ImageRecipe -> Int -> GetImageRecipeResponse
GetImageRecipeResponse'
(Maybe Text -> Maybe ImageRecipe -> Int -> GetImageRecipeResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe ImageRecipe -> Int -> GetImageRecipeResponse)
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 ImageRecipe -> Int -> GetImageRecipeResponse)
-> Either String (Maybe ImageRecipe)
-> Either String (Int -> GetImageRecipeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ImageRecipe)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"imageRecipe")
Either String (Int -> GetImageRecipeResponse)
-> Either String Int -> Either String GetImageRecipeResponse
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 GetImageRecipe
instance Prelude.NFData GetImageRecipe
instance Core.ToHeaders GetImageRecipe where
toHeaders :: GetImageRecipe -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetImageRecipe -> 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 GetImageRecipe where
toPath :: GetImageRecipe -> ByteString
toPath = ByteString -> GetImageRecipe -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetImageRecipe"
instance Core.ToQuery GetImageRecipe where
toQuery :: GetImageRecipe -> QueryString
toQuery GetImageRecipe' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:GetImageRecipe' :: GetImageRecipe -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"imageRecipeArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
imageRecipeArn]
data GetImageRecipeResponse = GetImageRecipeResponse'
{
GetImageRecipeResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
GetImageRecipeResponse -> Maybe ImageRecipe
imageRecipe :: Prelude.Maybe ImageRecipe,
GetImageRecipeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetImageRecipeResponse -> GetImageRecipeResponse -> Bool
(GetImageRecipeResponse -> GetImageRecipeResponse -> Bool)
-> (GetImageRecipeResponse -> GetImageRecipeResponse -> Bool)
-> Eq GetImageRecipeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImageRecipeResponse -> GetImageRecipeResponse -> Bool
$c/= :: GetImageRecipeResponse -> GetImageRecipeResponse -> Bool
== :: GetImageRecipeResponse -> GetImageRecipeResponse -> Bool
$c== :: GetImageRecipeResponse -> GetImageRecipeResponse -> Bool
Prelude.Eq, ReadPrec [GetImageRecipeResponse]
ReadPrec GetImageRecipeResponse
Int -> ReadS GetImageRecipeResponse
ReadS [GetImageRecipeResponse]
(Int -> ReadS GetImageRecipeResponse)
-> ReadS [GetImageRecipeResponse]
-> ReadPrec GetImageRecipeResponse
-> ReadPrec [GetImageRecipeResponse]
-> Read GetImageRecipeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImageRecipeResponse]
$creadListPrec :: ReadPrec [GetImageRecipeResponse]
readPrec :: ReadPrec GetImageRecipeResponse
$creadPrec :: ReadPrec GetImageRecipeResponse
readList :: ReadS [GetImageRecipeResponse]
$creadList :: ReadS [GetImageRecipeResponse]
readsPrec :: Int -> ReadS GetImageRecipeResponse
$creadsPrec :: Int -> ReadS GetImageRecipeResponse
Prelude.Read, Int -> GetImageRecipeResponse -> ShowS
[GetImageRecipeResponse] -> ShowS
GetImageRecipeResponse -> String
(Int -> GetImageRecipeResponse -> ShowS)
-> (GetImageRecipeResponse -> String)
-> ([GetImageRecipeResponse] -> ShowS)
-> Show GetImageRecipeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImageRecipeResponse] -> ShowS
$cshowList :: [GetImageRecipeResponse] -> ShowS
show :: GetImageRecipeResponse -> String
$cshow :: GetImageRecipeResponse -> String
showsPrec :: Int -> GetImageRecipeResponse -> ShowS
$cshowsPrec :: Int -> GetImageRecipeResponse -> ShowS
Prelude.Show, (forall x. GetImageRecipeResponse -> Rep GetImageRecipeResponse x)
-> (forall x.
Rep GetImageRecipeResponse x -> GetImageRecipeResponse)
-> Generic GetImageRecipeResponse
forall x. Rep GetImageRecipeResponse x -> GetImageRecipeResponse
forall x. GetImageRecipeResponse -> Rep GetImageRecipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImageRecipeResponse x -> GetImageRecipeResponse
$cfrom :: forall x. GetImageRecipeResponse -> Rep GetImageRecipeResponse x
Prelude.Generic)
newGetImageRecipeResponse ::
Prelude.Int ->
GetImageRecipeResponse
newGetImageRecipeResponse :: Int -> GetImageRecipeResponse
newGetImageRecipeResponse Int
pHttpStatus_ =
GetImageRecipeResponse' :: Maybe Text -> Maybe ImageRecipe -> Int -> GetImageRecipeResponse
GetImageRecipeResponse'
{ $sel:requestId:GetImageRecipeResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageRecipe:GetImageRecipeResponse' :: Maybe ImageRecipe
imageRecipe = Maybe ImageRecipe
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetImageRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getImageRecipeResponse_requestId :: Lens.Lens' GetImageRecipeResponse (Prelude.Maybe Prelude.Text)
getImageRecipeResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> GetImageRecipeResponse -> f GetImageRecipeResponse
getImageRecipeResponse_requestId = (GetImageRecipeResponse -> Maybe Text)
-> (GetImageRecipeResponse -> Maybe Text -> GetImageRecipeResponse)
-> Lens
GetImageRecipeResponse
GetImageRecipeResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImageRecipeResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:GetImageRecipeResponse' :: GetImageRecipeResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: GetImageRecipeResponse
s@GetImageRecipeResponse' {} Maybe Text
a -> GetImageRecipeResponse
s {$sel:requestId:GetImageRecipeResponse' :: Maybe Text
requestId = Maybe Text
a} :: GetImageRecipeResponse)
getImageRecipeResponse_imageRecipe :: Lens.Lens' GetImageRecipeResponse (Prelude.Maybe ImageRecipe)
getImageRecipeResponse_imageRecipe :: (Maybe ImageRecipe -> f (Maybe ImageRecipe))
-> GetImageRecipeResponse -> f GetImageRecipeResponse
getImageRecipeResponse_imageRecipe = (GetImageRecipeResponse -> Maybe ImageRecipe)
-> (GetImageRecipeResponse
-> Maybe ImageRecipe -> GetImageRecipeResponse)
-> Lens
GetImageRecipeResponse
GetImageRecipeResponse
(Maybe ImageRecipe)
(Maybe ImageRecipe)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImageRecipeResponse' {Maybe ImageRecipe
imageRecipe :: Maybe ImageRecipe
$sel:imageRecipe:GetImageRecipeResponse' :: GetImageRecipeResponse -> Maybe ImageRecipe
imageRecipe} -> Maybe ImageRecipe
imageRecipe) (\s :: GetImageRecipeResponse
s@GetImageRecipeResponse' {} Maybe ImageRecipe
a -> GetImageRecipeResponse
s {$sel:imageRecipe:GetImageRecipeResponse' :: Maybe ImageRecipe
imageRecipe = Maybe ImageRecipe
a} :: GetImageRecipeResponse)
getImageRecipeResponse_httpStatus :: Lens.Lens' GetImageRecipeResponse Prelude.Int
getImageRecipeResponse_httpStatus :: (Int -> f Int)
-> GetImageRecipeResponse -> f GetImageRecipeResponse
getImageRecipeResponse_httpStatus = (GetImageRecipeResponse -> Int)
-> (GetImageRecipeResponse -> Int -> GetImageRecipeResponse)
-> Lens GetImageRecipeResponse GetImageRecipeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImageRecipeResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetImageRecipeResponse' :: GetImageRecipeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetImageRecipeResponse
s@GetImageRecipeResponse' {} Int
a -> GetImageRecipeResponse
s {$sel:httpStatus:GetImageRecipeResponse' :: Int
httpStatus = Int
a} :: GetImageRecipeResponse)
instance Prelude.NFData GetImageRecipeResponse