{-# 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.Pinpoint.DeleteEmailTemplate
(
DeleteEmailTemplate (..),
newDeleteEmailTemplate,
deleteEmailTemplate_version,
deleteEmailTemplate_templateName,
DeleteEmailTemplateResponse (..),
newDeleteEmailTemplateResponse,
deleteEmailTemplateResponse_httpStatus,
deleteEmailTemplateResponse_messageBody,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteEmailTemplate = DeleteEmailTemplate'
{
DeleteEmailTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
DeleteEmailTemplate -> Text
templateName :: Prelude.Text
}
deriving (DeleteEmailTemplate -> DeleteEmailTemplate -> Bool
(DeleteEmailTemplate -> DeleteEmailTemplate -> Bool)
-> (DeleteEmailTemplate -> DeleteEmailTemplate -> Bool)
-> Eq DeleteEmailTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEmailTemplate -> DeleteEmailTemplate -> Bool
$c/= :: DeleteEmailTemplate -> DeleteEmailTemplate -> Bool
== :: DeleteEmailTemplate -> DeleteEmailTemplate -> Bool
$c== :: DeleteEmailTemplate -> DeleteEmailTemplate -> Bool
Prelude.Eq, ReadPrec [DeleteEmailTemplate]
ReadPrec DeleteEmailTemplate
Int -> ReadS DeleteEmailTemplate
ReadS [DeleteEmailTemplate]
(Int -> ReadS DeleteEmailTemplate)
-> ReadS [DeleteEmailTemplate]
-> ReadPrec DeleteEmailTemplate
-> ReadPrec [DeleteEmailTemplate]
-> Read DeleteEmailTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEmailTemplate]
$creadListPrec :: ReadPrec [DeleteEmailTemplate]
readPrec :: ReadPrec DeleteEmailTemplate
$creadPrec :: ReadPrec DeleteEmailTemplate
readList :: ReadS [DeleteEmailTemplate]
$creadList :: ReadS [DeleteEmailTemplate]
readsPrec :: Int -> ReadS DeleteEmailTemplate
$creadsPrec :: Int -> ReadS DeleteEmailTemplate
Prelude.Read, Int -> DeleteEmailTemplate -> ShowS
[DeleteEmailTemplate] -> ShowS
DeleteEmailTemplate -> String
(Int -> DeleteEmailTemplate -> ShowS)
-> (DeleteEmailTemplate -> String)
-> ([DeleteEmailTemplate] -> ShowS)
-> Show DeleteEmailTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEmailTemplate] -> ShowS
$cshowList :: [DeleteEmailTemplate] -> ShowS
show :: DeleteEmailTemplate -> String
$cshow :: DeleteEmailTemplate -> String
showsPrec :: Int -> DeleteEmailTemplate -> ShowS
$cshowsPrec :: Int -> DeleteEmailTemplate -> ShowS
Prelude.Show, (forall x. DeleteEmailTemplate -> Rep DeleteEmailTemplate x)
-> (forall x. Rep DeleteEmailTemplate x -> DeleteEmailTemplate)
-> Generic DeleteEmailTemplate
forall x. Rep DeleteEmailTemplate x -> DeleteEmailTemplate
forall x. DeleteEmailTemplate -> Rep DeleteEmailTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEmailTemplate x -> DeleteEmailTemplate
$cfrom :: forall x. DeleteEmailTemplate -> Rep DeleteEmailTemplate x
Prelude.Generic)
newDeleteEmailTemplate ::
Prelude.Text ->
DeleteEmailTemplate
newDeleteEmailTemplate :: Text -> DeleteEmailTemplate
newDeleteEmailTemplate Text
pTemplateName_ =
DeleteEmailTemplate' :: Maybe Text -> Text -> DeleteEmailTemplate
DeleteEmailTemplate'
{ $sel:version:DeleteEmailTemplate' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateName:DeleteEmailTemplate' :: Text
templateName = Text
pTemplateName_
}
deleteEmailTemplate_version :: Lens.Lens' DeleteEmailTemplate (Prelude.Maybe Prelude.Text)
deleteEmailTemplate_version :: (Maybe Text -> f (Maybe Text))
-> DeleteEmailTemplate -> f DeleteEmailTemplate
deleteEmailTemplate_version = (DeleteEmailTemplate -> Maybe Text)
-> (DeleteEmailTemplate -> Maybe Text -> DeleteEmailTemplate)
-> Lens
DeleteEmailTemplate DeleteEmailTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailTemplate' {Maybe Text
version :: Maybe Text
$sel:version:DeleteEmailTemplate' :: DeleteEmailTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: DeleteEmailTemplate
s@DeleteEmailTemplate' {} Maybe Text
a -> DeleteEmailTemplate
s {$sel:version:DeleteEmailTemplate' :: Maybe Text
version = Maybe Text
a} :: DeleteEmailTemplate)
deleteEmailTemplate_templateName :: Lens.Lens' DeleteEmailTemplate Prelude.Text
deleteEmailTemplate_templateName :: (Text -> f Text) -> DeleteEmailTemplate -> f DeleteEmailTemplate
deleteEmailTemplate_templateName = (DeleteEmailTemplate -> Text)
-> (DeleteEmailTemplate -> Text -> DeleteEmailTemplate)
-> Lens DeleteEmailTemplate DeleteEmailTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailTemplate' {Text
templateName :: Text
$sel:templateName:DeleteEmailTemplate' :: DeleteEmailTemplate -> Text
templateName} -> Text
templateName) (\s :: DeleteEmailTemplate
s@DeleteEmailTemplate' {} Text
a -> DeleteEmailTemplate
s {$sel:templateName:DeleteEmailTemplate' :: Text
templateName = Text
a} :: DeleteEmailTemplate)
instance Core.AWSRequest DeleteEmailTemplate where
type
AWSResponse DeleteEmailTemplate =
DeleteEmailTemplateResponse
request :: DeleteEmailTemplate -> Request DeleteEmailTemplate
request = Service -> DeleteEmailTemplate -> Request DeleteEmailTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteEmailTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteEmailTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteEmailTemplate))
-> Logger
-> Service
-> Proxy DeleteEmailTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteEmailTemplate)))
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 -> MessageBody -> DeleteEmailTemplateResponse
DeleteEmailTemplateResponse'
(Int -> MessageBody -> DeleteEmailTemplateResponse)
-> Either String Int
-> Either String (MessageBody -> DeleteEmailTemplateResponse)
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 (MessageBody -> DeleteEmailTemplateResponse)
-> Either String MessageBody
-> Either String DeleteEmailTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String MessageBody
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable DeleteEmailTemplate
instance Prelude.NFData DeleteEmailTemplate
instance Core.ToHeaders DeleteEmailTemplate where
toHeaders :: DeleteEmailTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteEmailTemplate -> 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 DeleteEmailTemplate where
toPath :: DeleteEmailTemplate -> ByteString
toPath DeleteEmailTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteEmailTemplate' :: DeleteEmailTemplate -> Text
$sel:version:DeleteEmailTemplate' :: DeleteEmailTemplate -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/templates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateName, ByteString
"/email"]
instance Core.ToQuery DeleteEmailTemplate where
toQuery :: DeleteEmailTemplate -> QueryString
toQuery DeleteEmailTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteEmailTemplate' :: DeleteEmailTemplate -> Text
$sel:version:DeleteEmailTemplate' :: DeleteEmailTemplate -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"version" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
version]
data DeleteEmailTemplateResponse = DeleteEmailTemplateResponse'
{
DeleteEmailTemplateResponse -> Int
httpStatus :: Prelude.Int,
DeleteEmailTemplateResponse -> MessageBody
messageBody :: MessageBody
}
deriving (DeleteEmailTemplateResponse -> DeleteEmailTemplateResponse -> Bool
(DeleteEmailTemplateResponse
-> DeleteEmailTemplateResponse -> Bool)
-> (DeleteEmailTemplateResponse
-> DeleteEmailTemplateResponse -> Bool)
-> Eq DeleteEmailTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEmailTemplateResponse -> DeleteEmailTemplateResponse -> Bool
$c/= :: DeleteEmailTemplateResponse -> DeleteEmailTemplateResponse -> Bool
== :: DeleteEmailTemplateResponse -> DeleteEmailTemplateResponse -> Bool
$c== :: DeleteEmailTemplateResponse -> DeleteEmailTemplateResponse -> Bool
Prelude.Eq, ReadPrec [DeleteEmailTemplateResponse]
ReadPrec DeleteEmailTemplateResponse
Int -> ReadS DeleteEmailTemplateResponse
ReadS [DeleteEmailTemplateResponse]
(Int -> ReadS DeleteEmailTemplateResponse)
-> ReadS [DeleteEmailTemplateResponse]
-> ReadPrec DeleteEmailTemplateResponse
-> ReadPrec [DeleteEmailTemplateResponse]
-> Read DeleteEmailTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEmailTemplateResponse]
$creadListPrec :: ReadPrec [DeleteEmailTemplateResponse]
readPrec :: ReadPrec DeleteEmailTemplateResponse
$creadPrec :: ReadPrec DeleteEmailTemplateResponse
readList :: ReadS [DeleteEmailTemplateResponse]
$creadList :: ReadS [DeleteEmailTemplateResponse]
readsPrec :: Int -> ReadS DeleteEmailTemplateResponse
$creadsPrec :: Int -> ReadS DeleteEmailTemplateResponse
Prelude.Read, Int -> DeleteEmailTemplateResponse -> ShowS
[DeleteEmailTemplateResponse] -> ShowS
DeleteEmailTemplateResponse -> String
(Int -> DeleteEmailTemplateResponse -> ShowS)
-> (DeleteEmailTemplateResponse -> String)
-> ([DeleteEmailTemplateResponse] -> ShowS)
-> Show DeleteEmailTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEmailTemplateResponse] -> ShowS
$cshowList :: [DeleteEmailTemplateResponse] -> ShowS
show :: DeleteEmailTemplateResponse -> String
$cshow :: DeleteEmailTemplateResponse -> String
showsPrec :: Int -> DeleteEmailTemplateResponse -> ShowS
$cshowsPrec :: Int -> DeleteEmailTemplateResponse -> ShowS
Prelude.Show, (forall x.
DeleteEmailTemplateResponse -> Rep DeleteEmailTemplateResponse x)
-> (forall x.
Rep DeleteEmailTemplateResponse x -> DeleteEmailTemplateResponse)
-> Generic DeleteEmailTemplateResponse
forall x.
Rep DeleteEmailTemplateResponse x -> DeleteEmailTemplateResponse
forall x.
DeleteEmailTemplateResponse -> Rep DeleteEmailTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEmailTemplateResponse x -> DeleteEmailTemplateResponse
$cfrom :: forall x.
DeleteEmailTemplateResponse -> Rep DeleteEmailTemplateResponse x
Prelude.Generic)
newDeleteEmailTemplateResponse ::
Prelude.Int ->
MessageBody ->
DeleteEmailTemplateResponse
newDeleteEmailTemplateResponse :: Int -> MessageBody -> DeleteEmailTemplateResponse
newDeleteEmailTemplateResponse
Int
pHttpStatus_
MessageBody
pMessageBody_ =
DeleteEmailTemplateResponse' :: Int -> MessageBody -> DeleteEmailTemplateResponse
DeleteEmailTemplateResponse'
{ $sel:httpStatus:DeleteEmailTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:messageBody:DeleteEmailTemplateResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
}
deleteEmailTemplateResponse_httpStatus :: Lens.Lens' DeleteEmailTemplateResponse Prelude.Int
deleteEmailTemplateResponse_httpStatus :: (Int -> f Int)
-> DeleteEmailTemplateResponse -> f DeleteEmailTemplateResponse
deleteEmailTemplateResponse_httpStatus = (DeleteEmailTemplateResponse -> Int)
-> (DeleteEmailTemplateResponse
-> Int -> DeleteEmailTemplateResponse)
-> Lens
DeleteEmailTemplateResponse DeleteEmailTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteEmailTemplateResponse' :: DeleteEmailTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteEmailTemplateResponse
s@DeleteEmailTemplateResponse' {} Int
a -> DeleteEmailTemplateResponse
s {$sel:httpStatus:DeleteEmailTemplateResponse' :: Int
httpStatus = Int
a} :: DeleteEmailTemplateResponse)
deleteEmailTemplateResponse_messageBody :: Lens.Lens' DeleteEmailTemplateResponse MessageBody
deleteEmailTemplateResponse_messageBody :: (MessageBody -> f MessageBody)
-> DeleteEmailTemplateResponse -> f DeleteEmailTemplateResponse
deleteEmailTemplateResponse_messageBody = (DeleteEmailTemplateResponse -> MessageBody)
-> (DeleteEmailTemplateResponse
-> MessageBody -> DeleteEmailTemplateResponse)
-> Lens
DeleteEmailTemplateResponse
DeleteEmailTemplateResponse
MessageBody
MessageBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailTemplateResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:DeleteEmailTemplateResponse' :: DeleteEmailTemplateResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: DeleteEmailTemplateResponse
s@DeleteEmailTemplateResponse' {} MessageBody
a -> DeleteEmailTemplateResponse
s {$sel:messageBody:DeleteEmailTemplateResponse' :: MessageBody
messageBody = MessageBody
a} :: DeleteEmailTemplateResponse)
instance Prelude.NFData DeleteEmailTemplateResponse