{-# 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.CreateTemplate
(
CreateTemplate (..),
newCreateTemplate,
createTemplate_template,
CreateTemplateResponse (..),
newCreateTemplateResponse,
createTemplateResponse_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 CreateTemplate = CreateTemplate'
{
CreateTemplate -> Template
template :: Template
}
deriving (CreateTemplate -> CreateTemplate -> Bool
(CreateTemplate -> CreateTemplate -> Bool)
-> (CreateTemplate -> CreateTemplate -> Bool) -> Eq CreateTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTemplate -> CreateTemplate -> Bool
$c/= :: CreateTemplate -> CreateTemplate -> Bool
== :: CreateTemplate -> CreateTemplate -> Bool
$c== :: CreateTemplate -> CreateTemplate -> Bool
Prelude.Eq, ReadPrec [CreateTemplate]
ReadPrec CreateTemplate
Int -> ReadS CreateTemplate
ReadS [CreateTemplate]
(Int -> ReadS CreateTemplate)
-> ReadS [CreateTemplate]
-> ReadPrec CreateTemplate
-> ReadPrec [CreateTemplate]
-> Read CreateTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTemplate]
$creadListPrec :: ReadPrec [CreateTemplate]
readPrec :: ReadPrec CreateTemplate
$creadPrec :: ReadPrec CreateTemplate
readList :: ReadS [CreateTemplate]
$creadList :: ReadS [CreateTemplate]
readsPrec :: Int -> ReadS CreateTemplate
$creadsPrec :: Int -> ReadS CreateTemplate
Prelude.Read, Int -> CreateTemplate -> ShowS
[CreateTemplate] -> ShowS
CreateTemplate -> String
(Int -> CreateTemplate -> ShowS)
-> (CreateTemplate -> String)
-> ([CreateTemplate] -> ShowS)
-> Show CreateTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTemplate] -> ShowS
$cshowList :: [CreateTemplate] -> ShowS
show :: CreateTemplate -> String
$cshow :: CreateTemplate -> String
showsPrec :: Int -> CreateTemplate -> ShowS
$cshowsPrec :: Int -> CreateTemplate -> ShowS
Prelude.Show, (forall x. CreateTemplate -> Rep CreateTemplate x)
-> (forall x. Rep CreateTemplate x -> CreateTemplate)
-> Generic CreateTemplate
forall x. Rep CreateTemplate x -> CreateTemplate
forall x. CreateTemplate -> Rep CreateTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTemplate x -> CreateTemplate
$cfrom :: forall x. CreateTemplate -> Rep CreateTemplate x
Prelude.Generic)
newCreateTemplate ::
Template ->
CreateTemplate
newCreateTemplate :: Template -> CreateTemplate
newCreateTemplate Template
pTemplate_ =
CreateTemplate' :: Template -> CreateTemplate
CreateTemplate' {$sel:template:CreateTemplate' :: Template
template = Template
pTemplate_}
createTemplate_template :: Lens.Lens' CreateTemplate Template
createTemplate_template :: (Template -> f Template) -> CreateTemplate -> f CreateTemplate
createTemplate_template = (CreateTemplate -> Template)
-> (CreateTemplate -> Template -> CreateTemplate)
-> Lens CreateTemplate CreateTemplate Template Template
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplate' {Template
template :: Template
$sel:template:CreateTemplate' :: CreateTemplate -> Template
template} -> Template
template) (\s :: CreateTemplate
s@CreateTemplate' {} Template
a -> CreateTemplate
s {$sel:template:CreateTemplate' :: Template
template = Template
a} :: CreateTemplate)
instance Core.AWSRequest CreateTemplate where
type
AWSResponse CreateTemplate =
CreateTemplateResponse
request :: CreateTemplate -> Request CreateTemplate
request = Service -> CreateTemplate -> Request CreateTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTemplate)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateTemplate))
-> Logger
-> Service
-> Proxy CreateTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTemplate)))
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
"CreateTemplateResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> CreateTemplateResponse
CreateTemplateResponse'
(Int -> CreateTemplateResponse)
-> Either String Int -> Either String CreateTemplateResponse
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))
)
instance Prelude.Hashable CreateTemplate
instance Prelude.NFData CreateTemplate
instance Core.ToHeaders CreateTemplate where
toHeaders :: CreateTemplate -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateTemplate where
toPath :: CreateTemplate -> ByteString
toPath = ByteString -> CreateTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateTemplate where
toQuery :: CreateTemplate -> QueryString
toQuery CreateTemplate' {Template
template :: Template
$sel:template:CreateTemplate' :: CreateTemplate -> Template
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateTemplate" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"Template" ByteString -> Template -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Template
template
]
data CreateTemplateResponse = CreateTemplateResponse'
{
CreateTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTemplateResponse -> CreateTemplateResponse -> Bool
(CreateTemplateResponse -> CreateTemplateResponse -> Bool)
-> (CreateTemplateResponse -> CreateTemplateResponse -> Bool)
-> Eq CreateTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTemplateResponse -> CreateTemplateResponse -> Bool
$c/= :: CreateTemplateResponse -> CreateTemplateResponse -> Bool
== :: CreateTemplateResponse -> CreateTemplateResponse -> Bool
$c== :: CreateTemplateResponse -> CreateTemplateResponse -> Bool
Prelude.Eq, ReadPrec [CreateTemplateResponse]
ReadPrec CreateTemplateResponse
Int -> ReadS CreateTemplateResponse
ReadS [CreateTemplateResponse]
(Int -> ReadS CreateTemplateResponse)
-> ReadS [CreateTemplateResponse]
-> ReadPrec CreateTemplateResponse
-> ReadPrec [CreateTemplateResponse]
-> Read CreateTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTemplateResponse]
$creadListPrec :: ReadPrec [CreateTemplateResponse]
readPrec :: ReadPrec CreateTemplateResponse
$creadPrec :: ReadPrec CreateTemplateResponse
readList :: ReadS [CreateTemplateResponse]
$creadList :: ReadS [CreateTemplateResponse]
readsPrec :: Int -> ReadS CreateTemplateResponse
$creadsPrec :: Int -> ReadS CreateTemplateResponse
Prelude.Read, Int -> CreateTemplateResponse -> ShowS
[CreateTemplateResponse] -> ShowS
CreateTemplateResponse -> String
(Int -> CreateTemplateResponse -> ShowS)
-> (CreateTemplateResponse -> String)
-> ([CreateTemplateResponse] -> ShowS)
-> Show CreateTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTemplateResponse] -> ShowS
$cshowList :: [CreateTemplateResponse] -> ShowS
show :: CreateTemplateResponse -> String
$cshow :: CreateTemplateResponse -> String
showsPrec :: Int -> CreateTemplateResponse -> ShowS
$cshowsPrec :: Int -> CreateTemplateResponse -> ShowS
Prelude.Show, (forall x. CreateTemplateResponse -> Rep CreateTemplateResponse x)
-> (forall x.
Rep CreateTemplateResponse x -> CreateTemplateResponse)
-> Generic CreateTemplateResponse
forall x. Rep CreateTemplateResponse x -> CreateTemplateResponse
forall x. CreateTemplateResponse -> Rep CreateTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTemplateResponse x -> CreateTemplateResponse
$cfrom :: forall x. CreateTemplateResponse -> Rep CreateTemplateResponse x
Prelude.Generic)
newCreateTemplateResponse ::
Prelude.Int ->
CreateTemplateResponse
newCreateTemplateResponse :: Int -> CreateTemplateResponse
newCreateTemplateResponse Int
pHttpStatus_ =
CreateTemplateResponse' :: Int -> CreateTemplateResponse
CreateTemplateResponse' {$sel:httpStatus:CreateTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_}
createTemplateResponse_httpStatus :: Lens.Lens' CreateTemplateResponse Prelude.Int
createTemplateResponse_httpStatus :: (Int -> f Int)
-> CreateTemplateResponse -> f CreateTemplateResponse
createTemplateResponse_httpStatus = (CreateTemplateResponse -> Int)
-> (CreateTemplateResponse -> Int -> CreateTemplateResponse)
-> Lens CreateTemplateResponse CreateTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTemplateResponse' :: CreateTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTemplateResponse
s@CreateTemplateResponse' {} Int
a -> CreateTemplateResponse
s {$sel:httpStatus:CreateTemplateResponse' :: Int
httpStatus = Int
a} :: CreateTemplateResponse)
instance Prelude.NFData CreateTemplateResponse