{-# 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.TestRenderEmailTemplate
(
TestRenderEmailTemplate (..),
newTestRenderEmailTemplate,
testRenderEmailTemplate_templateName,
testRenderEmailTemplate_templateData,
TestRenderEmailTemplateResponse (..),
newTestRenderEmailTemplateResponse,
testRenderEmailTemplateResponse_httpStatus,
testRenderEmailTemplateResponse_renderedTemplate,
)
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 TestRenderEmailTemplate = TestRenderEmailTemplate'
{
TestRenderEmailTemplate -> Text
templateName :: Prelude.Text,
TestRenderEmailTemplate -> Text
templateData :: Prelude.Text
}
deriving (TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool
(TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool)
-> (TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool)
-> Eq TestRenderEmailTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool
$c/= :: TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool
== :: TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool
$c== :: TestRenderEmailTemplate -> TestRenderEmailTemplate -> Bool
Prelude.Eq, ReadPrec [TestRenderEmailTemplate]
ReadPrec TestRenderEmailTemplate
Int -> ReadS TestRenderEmailTemplate
ReadS [TestRenderEmailTemplate]
(Int -> ReadS TestRenderEmailTemplate)
-> ReadS [TestRenderEmailTemplate]
-> ReadPrec TestRenderEmailTemplate
-> ReadPrec [TestRenderEmailTemplate]
-> Read TestRenderEmailTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestRenderEmailTemplate]
$creadListPrec :: ReadPrec [TestRenderEmailTemplate]
readPrec :: ReadPrec TestRenderEmailTemplate
$creadPrec :: ReadPrec TestRenderEmailTemplate
readList :: ReadS [TestRenderEmailTemplate]
$creadList :: ReadS [TestRenderEmailTemplate]
readsPrec :: Int -> ReadS TestRenderEmailTemplate
$creadsPrec :: Int -> ReadS TestRenderEmailTemplate
Prelude.Read, Int -> TestRenderEmailTemplate -> ShowS
[TestRenderEmailTemplate] -> ShowS
TestRenderEmailTemplate -> String
(Int -> TestRenderEmailTemplate -> ShowS)
-> (TestRenderEmailTemplate -> String)
-> ([TestRenderEmailTemplate] -> ShowS)
-> Show TestRenderEmailTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestRenderEmailTemplate] -> ShowS
$cshowList :: [TestRenderEmailTemplate] -> ShowS
show :: TestRenderEmailTemplate -> String
$cshow :: TestRenderEmailTemplate -> String
showsPrec :: Int -> TestRenderEmailTemplate -> ShowS
$cshowsPrec :: Int -> TestRenderEmailTemplate -> ShowS
Prelude.Show, (forall x.
TestRenderEmailTemplate -> Rep TestRenderEmailTemplate x)
-> (forall x.
Rep TestRenderEmailTemplate x -> TestRenderEmailTemplate)
-> Generic TestRenderEmailTemplate
forall x. Rep TestRenderEmailTemplate x -> TestRenderEmailTemplate
forall x. TestRenderEmailTemplate -> Rep TestRenderEmailTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestRenderEmailTemplate x -> TestRenderEmailTemplate
$cfrom :: forall x. TestRenderEmailTemplate -> Rep TestRenderEmailTemplate x
Prelude.Generic)
newTestRenderEmailTemplate ::
Prelude.Text ->
Prelude.Text ->
TestRenderEmailTemplate
newTestRenderEmailTemplate :: Text -> Text -> TestRenderEmailTemplate
newTestRenderEmailTemplate
Text
pTemplateName_
Text
pTemplateData_ =
TestRenderEmailTemplate' :: Text -> Text -> TestRenderEmailTemplate
TestRenderEmailTemplate'
{ $sel:templateName:TestRenderEmailTemplate' :: Text
templateName =
Text
pTemplateName_,
$sel:templateData:TestRenderEmailTemplate' :: Text
templateData = Text
pTemplateData_
}
testRenderEmailTemplate_templateName :: Lens.Lens' TestRenderEmailTemplate Prelude.Text
testRenderEmailTemplate_templateName :: (Text -> f Text)
-> TestRenderEmailTemplate -> f TestRenderEmailTemplate
testRenderEmailTemplate_templateName = (TestRenderEmailTemplate -> Text)
-> (TestRenderEmailTemplate -> Text -> TestRenderEmailTemplate)
-> Lens TestRenderEmailTemplate TestRenderEmailTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestRenderEmailTemplate' {Text
templateName :: Text
$sel:templateName:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> Text
templateName} -> Text
templateName) (\s :: TestRenderEmailTemplate
s@TestRenderEmailTemplate' {} Text
a -> TestRenderEmailTemplate
s {$sel:templateName:TestRenderEmailTemplate' :: Text
templateName = Text
a} :: TestRenderEmailTemplate)
testRenderEmailTemplate_templateData :: Lens.Lens' TestRenderEmailTemplate Prelude.Text
testRenderEmailTemplate_templateData :: (Text -> f Text)
-> TestRenderEmailTemplate -> f TestRenderEmailTemplate
testRenderEmailTemplate_templateData = (TestRenderEmailTemplate -> Text)
-> (TestRenderEmailTemplate -> Text -> TestRenderEmailTemplate)
-> Lens TestRenderEmailTemplate TestRenderEmailTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestRenderEmailTemplate' {Text
templateData :: Text
$sel:templateData:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> Text
templateData} -> Text
templateData) (\s :: TestRenderEmailTemplate
s@TestRenderEmailTemplate' {} Text
a -> TestRenderEmailTemplate
s {$sel:templateData:TestRenderEmailTemplate' :: Text
templateData = Text
a} :: TestRenderEmailTemplate)
instance Core.AWSRequest TestRenderEmailTemplate where
type
AWSResponse TestRenderEmailTemplate =
TestRenderEmailTemplateResponse
request :: TestRenderEmailTemplate -> Request TestRenderEmailTemplate
request = Service
-> TestRenderEmailTemplate -> Request TestRenderEmailTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TestRenderEmailTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TestRenderEmailTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TestRenderEmailTemplate))
-> Logger
-> Service
-> Proxy TestRenderEmailTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TestRenderEmailTemplate)))
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 -> TestRenderEmailTemplateResponse
TestRenderEmailTemplateResponse'
(Int -> Text -> TestRenderEmailTemplateResponse)
-> Either String Int
-> Either String (Text -> TestRenderEmailTemplateResponse)
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 -> TestRenderEmailTemplateResponse)
-> Either String Text
-> Either String TestRenderEmailTemplateResponse
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
"RenderedTemplate")
)
instance Prelude.Hashable TestRenderEmailTemplate
instance Prelude.NFData TestRenderEmailTemplate
instance Core.ToHeaders TestRenderEmailTemplate where
toHeaders :: TestRenderEmailTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> TestRenderEmailTemplate -> 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.ToJSON TestRenderEmailTemplate where
toJSON :: TestRenderEmailTemplate -> Value
toJSON TestRenderEmailTemplate' {Text
templateData :: Text
templateName :: Text
$sel:templateData:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> Text
$sel:templateName:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TemplateData" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateData)]
)
instance Core.ToPath TestRenderEmailTemplate where
toPath :: TestRenderEmailTemplate -> ByteString
toPath TestRenderEmailTemplate' {Text
templateData :: Text
templateName :: Text
$sel:templateData:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> Text
$sel:templateName:TestRenderEmailTemplate' :: TestRenderEmailTemplate -> 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,
ByteString
"/render"
]
instance Core.ToQuery TestRenderEmailTemplate where
toQuery :: TestRenderEmailTemplate -> QueryString
toQuery = QueryString -> TestRenderEmailTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TestRenderEmailTemplateResponse = TestRenderEmailTemplateResponse'
{
TestRenderEmailTemplateResponse -> Int
httpStatus :: Prelude.Int,
TestRenderEmailTemplateResponse -> Text
renderedTemplate :: Prelude.Text
}
deriving (TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool
(TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool)
-> (TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool)
-> Eq TestRenderEmailTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool
$c/= :: TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool
== :: TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool
$c== :: TestRenderEmailTemplateResponse
-> TestRenderEmailTemplateResponse -> Bool
Prelude.Eq, ReadPrec [TestRenderEmailTemplateResponse]
ReadPrec TestRenderEmailTemplateResponse
Int -> ReadS TestRenderEmailTemplateResponse
ReadS [TestRenderEmailTemplateResponse]
(Int -> ReadS TestRenderEmailTemplateResponse)
-> ReadS [TestRenderEmailTemplateResponse]
-> ReadPrec TestRenderEmailTemplateResponse
-> ReadPrec [TestRenderEmailTemplateResponse]
-> Read TestRenderEmailTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestRenderEmailTemplateResponse]
$creadListPrec :: ReadPrec [TestRenderEmailTemplateResponse]
readPrec :: ReadPrec TestRenderEmailTemplateResponse
$creadPrec :: ReadPrec TestRenderEmailTemplateResponse
readList :: ReadS [TestRenderEmailTemplateResponse]
$creadList :: ReadS [TestRenderEmailTemplateResponse]
readsPrec :: Int -> ReadS TestRenderEmailTemplateResponse
$creadsPrec :: Int -> ReadS TestRenderEmailTemplateResponse
Prelude.Read, Int -> TestRenderEmailTemplateResponse -> ShowS
[TestRenderEmailTemplateResponse] -> ShowS
TestRenderEmailTemplateResponse -> String
(Int -> TestRenderEmailTemplateResponse -> ShowS)
-> (TestRenderEmailTemplateResponse -> String)
-> ([TestRenderEmailTemplateResponse] -> ShowS)
-> Show TestRenderEmailTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestRenderEmailTemplateResponse] -> ShowS
$cshowList :: [TestRenderEmailTemplateResponse] -> ShowS
show :: TestRenderEmailTemplateResponse -> String
$cshow :: TestRenderEmailTemplateResponse -> String
showsPrec :: Int -> TestRenderEmailTemplateResponse -> ShowS
$cshowsPrec :: Int -> TestRenderEmailTemplateResponse -> ShowS
Prelude.Show, (forall x.
TestRenderEmailTemplateResponse
-> Rep TestRenderEmailTemplateResponse x)
-> (forall x.
Rep TestRenderEmailTemplateResponse x
-> TestRenderEmailTemplateResponse)
-> Generic TestRenderEmailTemplateResponse
forall x.
Rep TestRenderEmailTemplateResponse x
-> TestRenderEmailTemplateResponse
forall x.
TestRenderEmailTemplateResponse
-> Rep TestRenderEmailTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TestRenderEmailTemplateResponse x
-> TestRenderEmailTemplateResponse
$cfrom :: forall x.
TestRenderEmailTemplateResponse
-> Rep TestRenderEmailTemplateResponse x
Prelude.Generic)
newTestRenderEmailTemplateResponse ::
Prelude.Int ->
Prelude.Text ->
TestRenderEmailTemplateResponse
newTestRenderEmailTemplateResponse :: Int -> Text -> TestRenderEmailTemplateResponse
newTestRenderEmailTemplateResponse
Int
pHttpStatus_
Text
pRenderedTemplate_ =
TestRenderEmailTemplateResponse' :: Int -> Text -> TestRenderEmailTemplateResponse
TestRenderEmailTemplateResponse'
{ $sel:httpStatus:TestRenderEmailTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:renderedTemplate:TestRenderEmailTemplateResponse' :: Text
renderedTemplate = Text
pRenderedTemplate_
}
testRenderEmailTemplateResponse_httpStatus :: Lens.Lens' TestRenderEmailTemplateResponse Prelude.Int
testRenderEmailTemplateResponse_httpStatus :: (Int -> f Int)
-> TestRenderEmailTemplateResponse
-> f TestRenderEmailTemplateResponse
testRenderEmailTemplateResponse_httpStatus = (TestRenderEmailTemplateResponse -> Int)
-> (TestRenderEmailTemplateResponse
-> Int -> TestRenderEmailTemplateResponse)
-> Lens
TestRenderEmailTemplateResponse
TestRenderEmailTemplateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestRenderEmailTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:TestRenderEmailTemplateResponse' :: TestRenderEmailTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TestRenderEmailTemplateResponse
s@TestRenderEmailTemplateResponse' {} Int
a -> TestRenderEmailTemplateResponse
s {$sel:httpStatus:TestRenderEmailTemplateResponse' :: Int
httpStatus = Int
a} :: TestRenderEmailTemplateResponse)
testRenderEmailTemplateResponse_renderedTemplate :: Lens.Lens' TestRenderEmailTemplateResponse Prelude.Text
testRenderEmailTemplateResponse_renderedTemplate :: (Text -> f Text)
-> TestRenderEmailTemplateResponse
-> f TestRenderEmailTemplateResponse
testRenderEmailTemplateResponse_renderedTemplate = (TestRenderEmailTemplateResponse -> Text)
-> (TestRenderEmailTemplateResponse
-> Text -> TestRenderEmailTemplateResponse)
-> Lens
TestRenderEmailTemplateResponse
TestRenderEmailTemplateResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestRenderEmailTemplateResponse' {Text
renderedTemplate :: Text
$sel:renderedTemplate:TestRenderEmailTemplateResponse' :: TestRenderEmailTemplateResponse -> Text
renderedTemplate} -> Text
renderedTemplate) (\s :: TestRenderEmailTemplateResponse
s@TestRenderEmailTemplateResponse' {} Text
a -> TestRenderEmailTemplateResponse
s {$sel:renderedTemplate:TestRenderEmailTemplateResponse' :: Text
renderedTemplate = Text
a} :: TestRenderEmailTemplateResponse)
instance
Prelude.NFData
TestRenderEmailTemplateResponse