{-# 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.SES.GetTemplate
(
GetTemplate (..),
newGetTemplate,
getTemplate_templateName,
GetTemplateResponse (..),
newGetTemplateResponse,
getTemplateResponse_template,
getTemplateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types
data GetTemplate = GetTemplate'
{
GetTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetTemplate -> GetTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplate -> GetTemplate -> Bool
$c/= :: GetTemplate -> GetTemplate -> Bool
== :: GetTemplate -> GetTemplate -> Bool
$c== :: GetTemplate -> GetTemplate -> Bool
Prelude.Eq, ReadPrec [GetTemplate]
ReadPrec GetTemplate
Int -> ReadS GetTemplate
ReadS [GetTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplate]
$creadListPrec :: ReadPrec [GetTemplate]
readPrec :: ReadPrec GetTemplate
$creadPrec :: ReadPrec GetTemplate
readList :: ReadS [GetTemplate]
$creadList :: ReadS [GetTemplate]
readsPrec :: Int -> ReadS GetTemplate
$creadsPrec :: Int -> ReadS GetTemplate
Prelude.Read, Int -> GetTemplate -> ShowS
[GetTemplate] -> ShowS
GetTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplate] -> ShowS
$cshowList :: [GetTemplate] -> ShowS
show :: GetTemplate -> String
$cshow :: GetTemplate -> String
showsPrec :: Int -> GetTemplate -> ShowS
$cshowsPrec :: Int -> GetTemplate -> ShowS
Prelude.Show, forall x. Rep GetTemplate x -> GetTemplate
forall x. GetTemplate -> Rep GetTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplate x -> GetTemplate
$cfrom :: forall x. GetTemplate -> Rep GetTemplate x
Prelude.Generic)
newGetTemplate ::
Prelude.Text ->
GetTemplate
newGetTemplate :: Text -> GetTemplate
newGetTemplate Text
pTemplateName_ =
GetTemplate' {$sel:templateName:GetTemplate' :: Text
templateName = Text
pTemplateName_}
getTemplate_templateName :: Lens.Lens' GetTemplate Prelude.Text
getTemplate_templateName :: Lens' GetTemplate Text
getTemplate_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplate' {Text
templateName :: Text
$sel:templateName:GetTemplate' :: GetTemplate -> Text
templateName} -> Text
templateName) (\s :: GetTemplate
s@GetTemplate' {} Text
a -> GetTemplate
s {$sel:templateName:GetTemplate' :: Text
templateName = Text
a} :: GetTemplate)
instance Core.AWSRequest GetTemplate where
type AWSResponse GetTemplate = GetTemplateResponse
request :: (Service -> Service) -> GetTemplate -> Request GetTemplate
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetTemplateResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Template -> Int -> GetTemplateResponse
GetTemplateResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Template")
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 GetTemplate where
hashWithSalt :: Int -> GetTemplate -> Int
hashWithSalt Int
_salt GetTemplate' {Text
templateName :: Text
$sel:templateName:GetTemplate' :: GetTemplate -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName
instance Prelude.NFData GetTemplate where
rnf :: GetTemplate -> ()
rnf GetTemplate' {Text
templateName :: Text
$sel:templateName:GetTemplate' :: GetTemplate -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
templateName
instance Data.ToHeaders GetTemplate where
toHeaders :: GetTemplate -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetTemplate where
toPath :: GetTemplate -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetTemplate where
toQuery :: GetTemplate -> QueryString
toQuery GetTemplate' {Text
templateName :: Text
$sel:templateName:GetTemplate' :: GetTemplate -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetTemplate" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"TemplateName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
templateName
]
data GetTemplateResponse = GetTemplateResponse'
{ GetTemplateResponse -> Maybe Template
template :: Prelude.Maybe Template,
GetTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTemplateResponse -> GetTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
== :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c== :: GetTemplateResponse -> GetTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetTemplateResponse]
ReadPrec GetTemplateResponse
Int -> ReadS GetTemplateResponse
ReadS [GetTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplateResponse]
$creadListPrec :: ReadPrec [GetTemplateResponse]
readPrec :: ReadPrec GetTemplateResponse
$creadPrec :: ReadPrec GetTemplateResponse
readList :: ReadS [GetTemplateResponse]
$creadList :: ReadS [GetTemplateResponse]
readsPrec :: Int -> ReadS GetTemplateResponse
$creadsPrec :: Int -> ReadS GetTemplateResponse
Prelude.Read, Int -> GetTemplateResponse -> ShowS
[GetTemplateResponse] -> ShowS
GetTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplateResponse] -> ShowS
$cshowList :: [GetTemplateResponse] -> ShowS
show :: GetTemplateResponse -> String
$cshow :: GetTemplateResponse -> String
showsPrec :: Int -> GetTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetTemplateResponse -> ShowS
Prelude.Show, forall x. Rep GetTemplateResponse x -> GetTemplateResponse
forall x. GetTemplateResponse -> Rep GetTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplateResponse x -> GetTemplateResponse
$cfrom :: forall x. GetTemplateResponse -> Rep GetTemplateResponse x
Prelude.Generic)
newGetTemplateResponse ::
Prelude.Int ->
GetTemplateResponse
newGetTemplateResponse :: Int -> GetTemplateResponse
newGetTemplateResponse Int
pHttpStatus_ =
GetTemplateResponse'
{ $sel:template:GetTemplateResponse' :: Maybe Template
template = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTemplateResponse_template :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Template)
getTemplateResponse_template :: Lens' GetTemplateResponse (Maybe Template)
getTemplateResponse_template = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe Template
template :: Maybe Template
$sel:template:GetTemplateResponse' :: GetTemplateResponse -> Maybe Template
template} -> Maybe Template
template) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe Template
a -> GetTemplateResponse
s {$sel:template:GetTemplateResponse' :: Maybe Template
template = Maybe Template
a} :: GetTemplateResponse)
getTemplateResponse_httpStatus :: Lens.Lens' GetTemplateResponse Prelude.Int
getTemplateResponse_httpStatus :: Lens' GetTemplateResponse Int
getTemplateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTemplateResponse' :: GetTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Int
a -> GetTemplateResponse
s {$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
a} :: GetTemplateResponse)
instance Prelude.NFData GetTemplateResponse where
rnf :: GetTemplateResponse -> ()
rnf GetTemplateResponse' {Int
Maybe Template
httpStatus :: Int
template :: Maybe Template
$sel:httpStatus:GetTemplateResponse' :: GetTemplateResponse -> Int
$sel:template:GetTemplateResponse' :: GetTemplateResponse -> Maybe Template
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Template
template
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus