{-# 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.Lens as Lens
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
(GetTemplate -> GetTemplate -> Bool)
-> (GetTemplate -> GetTemplate -> Bool) -> Eq GetTemplate
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]
(Int -> ReadS GetTemplate)
-> ReadS [GetTemplate]
-> ReadPrec GetTemplate
-> ReadPrec [GetTemplate]
-> Read 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
(Int -> GetTemplate -> ShowS)
-> (GetTemplate -> String)
-> ([GetTemplate] -> ShowS)
-> Show GetTemplate
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. GetTemplate -> Rep GetTemplate x)
-> (forall x. Rep GetTemplate x -> GetTemplate)
-> Generic GetTemplate
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' :: Text -> GetTemplate
GetTemplate' {$sel:templateName:GetTemplate' :: Text
templateName = Text
pTemplateName_}
getTemplate_templateName :: Lens.Lens' GetTemplate Prelude.Text
getTemplate_templateName :: (Text -> f Text) -> GetTemplate -> f GetTemplate
getTemplate_templateName = (GetTemplate -> Text)
-> (GetTemplate -> Text -> GetTemplate)
-> Lens GetTemplate GetTemplate Text Text
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 :: GetTemplate -> Request GetTemplate
request = Service -> GetTemplate -> Request GetTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetTemplate))
-> Logger
-> Service
-> Proxy GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> 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'
(Maybe Template -> Int -> GetTemplateResponse)
-> Either String (Maybe Template)
-> Either String (Int -> GetTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Template)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Template")
Either String (Int -> GetTemplateResponse)
-> Either String Int -> Either String GetTemplateResponse
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 GetTemplate
instance Prelude.NFData GetTemplate
instance Core.ToHeaders GetTemplate where
toHeaders :: GetTemplate -> ResponseHeaders
toHeaders = ResponseHeaders -> GetTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetTemplate where
toPath :: GetTemplate -> ByteString
toPath = ByteString -> GetTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTemplate where
toQuery :: GetTemplate -> QueryString
toQuery GetTemplate' {Text
templateName :: Text
$sel:templateName:GetTemplate' :: GetTemplate -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetTemplate" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"TemplateName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
templateName
]
data GetTemplateResponse = GetTemplateResponse'
{ GetTemplateResponse -> Maybe Template
template :: Prelude.Maybe Template,
GetTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTemplateResponse -> GetTemplateResponse -> Bool
(GetTemplateResponse -> GetTemplateResponse -> Bool)
-> (GetTemplateResponse -> GetTemplateResponse -> Bool)
-> Eq GetTemplateResponse
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]
(Int -> ReadS GetTemplateResponse)
-> ReadS [GetTemplateResponse]
-> ReadPrec GetTemplateResponse
-> ReadPrec [GetTemplateResponse]
-> Read 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
(Int -> GetTemplateResponse -> ShowS)
-> (GetTemplateResponse -> String)
-> ([GetTemplateResponse] -> ShowS)
-> Show GetTemplateResponse
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. GetTemplateResponse -> Rep GetTemplateResponse x)
-> (forall x. Rep GetTemplateResponse x -> GetTemplateResponse)
-> Generic GetTemplateResponse
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' :: Maybe Template -> Int -> GetTemplateResponse
GetTemplateResponse'
{ $sel:template:GetTemplateResponse' :: Maybe Template
template = Maybe Template
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTemplateResponse_template :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Template)
getTemplateResponse_template :: (Maybe Template -> f (Maybe Template))
-> GetTemplateResponse -> f GetTemplateResponse
getTemplateResponse_template = (GetTemplateResponse -> Maybe Template)
-> (GetTemplateResponse -> Maybe Template -> GetTemplateResponse)
-> Lens
GetTemplateResponse
GetTemplateResponse
(Maybe Template)
(Maybe 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 :: (Int -> f Int) -> GetTemplateResponse -> f GetTemplateResponse
getTemplateResponse_httpStatus = (GetTemplateResponse -> Int)
-> (GetTemplateResponse -> Int -> GetTemplateResponse)
-> Lens GetTemplateResponse GetTemplateResponse Int Int
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