{-# 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.SESV2.GetEmailTemplate
(
GetEmailTemplate (..),
newGetEmailTemplate,
getEmailTemplate_templateName,
GetEmailTemplateResponse (..),
newGetEmailTemplateResponse,
getEmailTemplateResponse_httpStatus,
getEmailTemplateResponse_templateName,
getEmailTemplateResponse_templateContent,
)
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.SESV2.Types
data GetEmailTemplate = GetEmailTemplate'
{
GetEmailTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetEmailTemplate -> GetEmailTemplate -> Bool
(GetEmailTemplate -> GetEmailTemplate -> Bool)
-> (GetEmailTemplate -> GetEmailTemplate -> Bool)
-> Eq GetEmailTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEmailTemplate -> GetEmailTemplate -> Bool
$c/= :: GetEmailTemplate -> GetEmailTemplate -> Bool
== :: GetEmailTemplate -> GetEmailTemplate -> Bool
$c== :: GetEmailTemplate -> GetEmailTemplate -> Bool
Prelude.Eq, ReadPrec [GetEmailTemplate]
ReadPrec GetEmailTemplate
Int -> ReadS GetEmailTemplate
ReadS [GetEmailTemplate]
(Int -> ReadS GetEmailTemplate)
-> ReadS [GetEmailTemplate]
-> ReadPrec GetEmailTemplate
-> ReadPrec [GetEmailTemplate]
-> Read GetEmailTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEmailTemplate]
$creadListPrec :: ReadPrec [GetEmailTemplate]
readPrec :: ReadPrec GetEmailTemplate
$creadPrec :: ReadPrec GetEmailTemplate
readList :: ReadS [GetEmailTemplate]
$creadList :: ReadS [GetEmailTemplate]
readsPrec :: Int -> ReadS GetEmailTemplate
$creadsPrec :: Int -> ReadS GetEmailTemplate
Prelude.Read, Int -> GetEmailTemplate -> ShowS
[GetEmailTemplate] -> ShowS
GetEmailTemplate -> String
(Int -> GetEmailTemplate -> ShowS)
-> (GetEmailTemplate -> String)
-> ([GetEmailTemplate] -> ShowS)
-> Show GetEmailTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEmailTemplate] -> ShowS
$cshowList :: [GetEmailTemplate] -> ShowS
show :: GetEmailTemplate -> String
$cshow :: GetEmailTemplate -> String
showsPrec :: Int -> GetEmailTemplate -> ShowS
$cshowsPrec :: Int -> GetEmailTemplate -> ShowS
Prelude.Show, (forall x. GetEmailTemplate -> Rep GetEmailTemplate x)
-> (forall x. Rep GetEmailTemplate x -> GetEmailTemplate)
-> Generic GetEmailTemplate
forall x. Rep GetEmailTemplate x -> GetEmailTemplate
forall x. GetEmailTemplate -> Rep GetEmailTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEmailTemplate x -> GetEmailTemplate
$cfrom :: forall x. GetEmailTemplate -> Rep GetEmailTemplate x
Prelude.Generic)
newGetEmailTemplate ::
Prelude.Text ->
GetEmailTemplate
newGetEmailTemplate :: Text -> GetEmailTemplate
newGetEmailTemplate Text
pTemplateName_ =
GetEmailTemplate' :: Text -> GetEmailTemplate
GetEmailTemplate' {$sel:templateName:GetEmailTemplate' :: Text
templateName = Text
pTemplateName_}
getEmailTemplate_templateName :: Lens.Lens' GetEmailTemplate Prelude.Text
getEmailTemplate_templateName :: (Text -> f Text) -> GetEmailTemplate -> f GetEmailTemplate
getEmailTemplate_templateName = (GetEmailTemplate -> Text)
-> (GetEmailTemplate -> Text -> GetEmailTemplate)
-> Lens GetEmailTemplate GetEmailTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEmailTemplate' {Text
templateName :: Text
$sel:templateName:GetEmailTemplate' :: GetEmailTemplate -> Text
templateName} -> Text
templateName) (\s :: GetEmailTemplate
s@GetEmailTemplate' {} Text
a -> GetEmailTemplate
s {$sel:templateName:GetEmailTemplate' :: Text
templateName = Text
a} :: GetEmailTemplate)
instance Core.AWSRequest GetEmailTemplate where
type
AWSResponse GetEmailTemplate =
GetEmailTemplateResponse
request :: GetEmailTemplate -> Request GetEmailTemplate
request = Service -> GetEmailTemplate -> Request GetEmailTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetEmailTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetEmailTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetEmailTemplate))
-> Logger
-> Service
-> Proxy GetEmailTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetEmailTemplate)))
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 ->
Int -> Text -> EmailTemplateContent -> GetEmailTemplateResponse
GetEmailTemplateResponse'
(Int -> Text -> EmailTemplateContent -> GetEmailTemplateResponse)
-> Either String Int
-> Either
String (Text -> EmailTemplateContent -> GetEmailTemplateResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String (Text -> EmailTemplateContent -> GetEmailTemplateResponse)
-> Either String Text
-> Either String (EmailTemplateContent -> GetEmailTemplateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"TemplateName")
Either String (EmailTemplateContent -> GetEmailTemplateResponse)
-> Either String EmailTemplateContent
-> Either String GetEmailTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String EmailTemplateContent
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"TemplateContent")
)
instance Prelude.Hashable GetEmailTemplate
instance Prelude.NFData GetEmailTemplate
instance Core.ToHeaders GetEmailTemplate where
toHeaders :: GetEmailTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetEmailTemplate -> 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 GetEmailTemplate where
toPath :: GetEmailTemplate -> ByteString
toPath GetEmailTemplate' {Text
templateName :: Text
$sel:templateName:GetEmailTemplate' :: GetEmailTemplate -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v2/email/templates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateName]
instance Core.ToQuery GetEmailTemplate where
toQuery :: GetEmailTemplate -> QueryString
toQuery = QueryString -> GetEmailTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetEmailTemplateResponse = GetEmailTemplateResponse'
{
GetEmailTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetEmailTemplateResponse -> Text
templateName :: Prelude.Text,
GetEmailTemplateResponse -> EmailTemplateContent
templateContent :: EmailTemplateContent
}
deriving (GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool
(GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool)
-> (GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool)
-> Eq GetEmailTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool
$c/= :: GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool
== :: GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool
$c== :: GetEmailTemplateResponse -> GetEmailTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetEmailTemplateResponse]
ReadPrec GetEmailTemplateResponse
Int -> ReadS GetEmailTemplateResponse
ReadS [GetEmailTemplateResponse]
(Int -> ReadS GetEmailTemplateResponse)
-> ReadS [GetEmailTemplateResponse]
-> ReadPrec GetEmailTemplateResponse
-> ReadPrec [GetEmailTemplateResponse]
-> Read GetEmailTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEmailTemplateResponse]
$creadListPrec :: ReadPrec [GetEmailTemplateResponse]
readPrec :: ReadPrec GetEmailTemplateResponse
$creadPrec :: ReadPrec GetEmailTemplateResponse
readList :: ReadS [GetEmailTemplateResponse]
$creadList :: ReadS [GetEmailTemplateResponse]
readsPrec :: Int -> ReadS GetEmailTemplateResponse
$creadsPrec :: Int -> ReadS GetEmailTemplateResponse
Prelude.Read, Int -> GetEmailTemplateResponse -> ShowS
[GetEmailTemplateResponse] -> ShowS
GetEmailTemplateResponse -> String
(Int -> GetEmailTemplateResponse -> ShowS)
-> (GetEmailTemplateResponse -> String)
-> ([GetEmailTemplateResponse] -> ShowS)
-> Show GetEmailTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEmailTemplateResponse] -> ShowS
$cshowList :: [GetEmailTemplateResponse] -> ShowS
show :: GetEmailTemplateResponse -> String
$cshow :: GetEmailTemplateResponse -> String
showsPrec :: Int -> GetEmailTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetEmailTemplateResponse -> ShowS
Prelude.Show, (forall x.
GetEmailTemplateResponse -> Rep GetEmailTemplateResponse x)
-> (forall x.
Rep GetEmailTemplateResponse x -> GetEmailTemplateResponse)
-> Generic GetEmailTemplateResponse
forall x.
Rep GetEmailTemplateResponse x -> GetEmailTemplateResponse
forall x.
GetEmailTemplateResponse -> Rep GetEmailTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetEmailTemplateResponse x -> GetEmailTemplateResponse
$cfrom :: forall x.
GetEmailTemplateResponse -> Rep GetEmailTemplateResponse x
Prelude.Generic)
newGetEmailTemplateResponse ::
Prelude.Int ->
Prelude.Text ->
EmailTemplateContent ->
GetEmailTemplateResponse
newGetEmailTemplateResponse :: Int -> Text -> EmailTemplateContent -> GetEmailTemplateResponse
newGetEmailTemplateResponse
Int
pHttpStatus_
Text
pTemplateName_
EmailTemplateContent
pTemplateContent_ =
GetEmailTemplateResponse' :: Int -> Text -> EmailTemplateContent -> GetEmailTemplateResponse
GetEmailTemplateResponse'
{ $sel:httpStatus:GetEmailTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:templateName:GetEmailTemplateResponse' :: Text
templateName = Text
pTemplateName_,
$sel:templateContent:GetEmailTemplateResponse' :: EmailTemplateContent
templateContent = EmailTemplateContent
pTemplateContent_
}
getEmailTemplateResponse_httpStatus :: Lens.Lens' GetEmailTemplateResponse Prelude.Int
getEmailTemplateResponse_httpStatus :: (Int -> f Int)
-> GetEmailTemplateResponse -> f GetEmailTemplateResponse
getEmailTemplateResponse_httpStatus = (GetEmailTemplateResponse -> Int)
-> (GetEmailTemplateResponse -> Int -> GetEmailTemplateResponse)
-> Lens GetEmailTemplateResponse GetEmailTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEmailTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetEmailTemplateResponse' :: GetEmailTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetEmailTemplateResponse
s@GetEmailTemplateResponse' {} Int
a -> GetEmailTemplateResponse
s {$sel:httpStatus:GetEmailTemplateResponse' :: Int
httpStatus = Int
a} :: GetEmailTemplateResponse)
getEmailTemplateResponse_templateName :: Lens.Lens' GetEmailTemplateResponse Prelude.Text
getEmailTemplateResponse_templateName :: (Text -> f Text)
-> GetEmailTemplateResponse -> f GetEmailTemplateResponse
getEmailTemplateResponse_templateName = (GetEmailTemplateResponse -> Text)
-> (GetEmailTemplateResponse -> Text -> GetEmailTemplateResponse)
-> Lens GetEmailTemplateResponse GetEmailTemplateResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEmailTemplateResponse' {Text
templateName :: Text
$sel:templateName:GetEmailTemplateResponse' :: GetEmailTemplateResponse -> Text
templateName} -> Text
templateName) (\s :: GetEmailTemplateResponse
s@GetEmailTemplateResponse' {} Text
a -> GetEmailTemplateResponse
s {$sel:templateName:GetEmailTemplateResponse' :: Text
templateName = Text
a} :: GetEmailTemplateResponse)
getEmailTemplateResponse_templateContent :: Lens.Lens' GetEmailTemplateResponse EmailTemplateContent
getEmailTemplateResponse_templateContent :: (EmailTemplateContent -> f EmailTemplateContent)
-> GetEmailTemplateResponse -> f GetEmailTemplateResponse
getEmailTemplateResponse_templateContent = (GetEmailTemplateResponse -> EmailTemplateContent)
-> (GetEmailTemplateResponse
-> EmailTemplateContent -> GetEmailTemplateResponse)
-> Lens
GetEmailTemplateResponse
GetEmailTemplateResponse
EmailTemplateContent
EmailTemplateContent
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEmailTemplateResponse' {EmailTemplateContent
templateContent :: EmailTemplateContent
$sel:templateContent:GetEmailTemplateResponse' :: GetEmailTemplateResponse -> EmailTemplateContent
templateContent} -> EmailTemplateContent
templateContent) (\s :: GetEmailTemplateResponse
s@GetEmailTemplateResponse' {} EmailTemplateContent
a -> GetEmailTemplateResponse
s {$sel:templateContent:GetEmailTemplateResponse' :: EmailTemplateContent
templateContent = EmailTemplateContent
a} :: GetEmailTemplateResponse)
instance Prelude.NFData GetEmailTemplateResponse