{-# 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.DeletePushTemplate
(
DeletePushTemplate (..),
newDeletePushTemplate,
deletePushTemplate_version,
deletePushTemplate_templateName,
DeletePushTemplateResponse (..),
newDeletePushTemplateResponse,
deletePushTemplateResponse_httpStatus,
deletePushTemplateResponse_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 DeletePushTemplate = DeletePushTemplate'
{
DeletePushTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
DeletePushTemplate -> Text
templateName :: Prelude.Text
}
deriving (DeletePushTemplate -> DeletePushTemplate -> Bool
(DeletePushTemplate -> DeletePushTemplate -> Bool)
-> (DeletePushTemplate -> DeletePushTemplate -> Bool)
-> Eq DeletePushTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePushTemplate -> DeletePushTemplate -> Bool
$c/= :: DeletePushTemplate -> DeletePushTemplate -> Bool
== :: DeletePushTemplate -> DeletePushTemplate -> Bool
$c== :: DeletePushTemplate -> DeletePushTemplate -> Bool
Prelude.Eq, ReadPrec [DeletePushTemplate]
ReadPrec DeletePushTemplate
Int -> ReadS DeletePushTemplate
ReadS [DeletePushTemplate]
(Int -> ReadS DeletePushTemplate)
-> ReadS [DeletePushTemplate]
-> ReadPrec DeletePushTemplate
-> ReadPrec [DeletePushTemplate]
-> Read DeletePushTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePushTemplate]
$creadListPrec :: ReadPrec [DeletePushTemplate]
readPrec :: ReadPrec DeletePushTemplate
$creadPrec :: ReadPrec DeletePushTemplate
readList :: ReadS [DeletePushTemplate]
$creadList :: ReadS [DeletePushTemplate]
readsPrec :: Int -> ReadS DeletePushTemplate
$creadsPrec :: Int -> ReadS DeletePushTemplate
Prelude.Read, Int -> DeletePushTemplate -> ShowS
[DeletePushTemplate] -> ShowS
DeletePushTemplate -> String
(Int -> DeletePushTemplate -> ShowS)
-> (DeletePushTemplate -> String)
-> ([DeletePushTemplate] -> ShowS)
-> Show DeletePushTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePushTemplate] -> ShowS
$cshowList :: [DeletePushTemplate] -> ShowS
show :: DeletePushTemplate -> String
$cshow :: DeletePushTemplate -> String
showsPrec :: Int -> DeletePushTemplate -> ShowS
$cshowsPrec :: Int -> DeletePushTemplate -> ShowS
Prelude.Show, (forall x. DeletePushTemplate -> Rep DeletePushTemplate x)
-> (forall x. Rep DeletePushTemplate x -> DeletePushTemplate)
-> Generic DeletePushTemplate
forall x. Rep DeletePushTemplate x -> DeletePushTemplate
forall x. DeletePushTemplate -> Rep DeletePushTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePushTemplate x -> DeletePushTemplate
$cfrom :: forall x. DeletePushTemplate -> Rep DeletePushTemplate x
Prelude.Generic)
newDeletePushTemplate ::
Prelude.Text ->
DeletePushTemplate
newDeletePushTemplate :: Text -> DeletePushTemplate
newDeletePushTemplate Text
pTemplateName_ =
DeletePushTemplate' :: Maybe Text -> Text -> DeletePushTemplate
DeletePushTemplate'
{ $sel:version:DeletePushTemplate' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateName:DeletePushTemplate' :: Text
templateName = Text
pTemplateName_
}
deletePushTemplate_version :: Lens.Lens' DeletePushTemplate (Prelude.Maybe Prelude.Text)
deletePushTemplate_version :: (Maybe Text -> f (Maybe Text))
-> DeletePushTemplate -> f DeletePushTemplate
deletePushTemplate_version = (DeletePushTemplate -> Maybe Text)
-> (DeletePushTemplate -> Maybe Text -> DeletePushTemplate)
-> Lens
DeletePushTemplate DeletePushTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePushTemplate' {Maybe Text
version :: Maybe Text
$sel:version:DeletePushTemplate' :: DeletePushTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: DeletePushTemplate
s@DeletePushTemplate' {} Maybe Text
a -> DeletePushTemplate
s {$sel:version:DeletePushTemplate' :: Maybe Text
version = Maybe Text
a} :: DeletePushTemplate)
deletePushTemplate_templateName :: Lens.Lens' DeletePushTemplate Prelude.Text
deletePushTemplate_templateName :: (Text -> f Text) -> DeletePushTemplate -> f DeletePushTemplate
deletePushTemplate_templateName = (DeletePushTemplate -> Text)
-> (DeletePushTemplate -> Text -> DeletePushTemplate)
-> Lens DeletePushTemplate DeletePushTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePushTemplate' {Text
templateName :: Text
$sel:templateName:DeletePushTemplate' :: DeletePushTemplate -> Text
templateName} -> Text
templateName) (\s :: DeletePushTemplate
s@DeletePushTemplate' {} Text
a -> DeletePushTemplate
s {$sel:templateName:DeletePushTemplate' :: Text
templateName = Text
a} :: DeletePushTemplate)
instance Core.AWSRequest DeletePushTemplate where
type
AWSResponse DeletePushTemplate =
DeletePushTemplateResponse
request :: DeletePushTemplate -> Request DeletePushTemplate
request = Service -> DeletePushTemplate -> Request DeletePushTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeletePushTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeletePushTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeletePushTemplate))
-> Logger
-> Service
-> Proxy DeletePushTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeletePushTemplate)))
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 -> DeletePushTemplateResponse
DeletePushTemplateResponse'
(Int -> MessageBody -> DeletePushTemplateResponse)
-> Either String Int
-> Either String (MessageBody -> DeletePushTemplateResponse)
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 -> DeletePushTemplateResponse)
-> Either String MessageBody
-> Either String DeletePushTemplateResponse
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 DeletePushTemplate
instance Prelude.NFData DeletePushTemplate
instance Core.ToHeaders DeletePushTemplate where
toHeaders :: DeletePushTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeletePushTemplate -> 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 DeletePushTemplate where
toPath :: DeletePushTemplate -> ByteString
toPath DeletePushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeletePushTemplate' :: DeletePushTemplate -> Text
$sel:version:DeletePushTemplate' :: DeletePushTemplate -> 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
"/push"]
instance Core.ToQuery DeletePushTemplate where
toQuery :: DeletePushTemplate -> QueryString
toQuery DeletePushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeletePushTemplate' :: DeletePushTemplate -> Text
$sel:version:DeletePushTemplate' :: DeletePushTemplate -> 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 DeletePushTemplateResponse = DeletePushTemplateResponse'
{
DeletePushTemplateResponse -> Int
httpStatus :: Prelude.Int,
DeletePushTemplateResponse -> MessageBody
messageBody :: MessageBody
}
deriving (DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool
(DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool)
-> (DeletePushTemplateResponse
-> DeletePushTemplateResponse -> Bool)
-> Eq DeletePushTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool
$c/= :: DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool
== :: DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool
$c== :: DeletePushTemplateResponse -> DeletePushTemplateResponse -> Bool
Prelude.Eq, ReadPrec [DeletePushTemplateResponse]
ReadPrec DeletePushTemplateResponse
Int -> ReadS DeletePushTemplateResponse
ReadS [DeletePushTemplateResponse]
(Int -> ReadS DeletePushTemplateResponse)
-> ReadS [DeletePushTemplateResponse]
-> ReadPrec DeletePushTemplateResponse
-> ReadPrec [DeletePushTemplateResponse]
-> Read DeletePushTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePushTemplateResponse]
$creadListPrec :: ReadPrec [DeletePushTemplateResponse]
readPrec :: ReadPrec DeletePushTemplateResponse
$creadPrec :: ReadPrec DeletePushTemplateResponse
readList :: ReadS [DeletePushTemplateResponse]
$creadList :: ReadS [DeletePushTemplateResponse]
readsPrec :: Int -> ReadS DeletePushTemplateResponse
$creadsPrec :: Int -> ReadS DeletePushTemplateResponse
Prelude.Read, Int -> DeletePushTemplateResponse -> ShowS
[DeletePushTemplateResponse] -> ShowS
DeletePushTemplateResponse -> String
(Int -> DeletePushTemplateResponse -> ShowS)
-> (DeletePushTemplateResponse -> String)
-> ([DeletePushTemplateResponse] -> ShowS)
-> Show DeletePushTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePushTemplateResponse] -> ShowS
$cshowList :: [DeletePushTemplateResponse] -> ShowS
show :: DeletePushTemplateResponse -> String
$cshow :: DeletePushTemplateResponse -> String
showsPrec :: Int -> DeletePushTemplateResponse -> ShowS
$cshowsPrec :: Int -> DeletePushTemplateResponse -> ShowS
Prelude.Show, (forall x.
DeletePushTemplateResponse -> Rep DeletePushTemplateResponse x)
-> (forall x.
Rep DeletePushTemplateResponse x -> DeletePushTemplateResponse)
-> Generic DeletePushTemplateResponse
forall x.
Rep DeletePushTemplateResponse x -> DeletePushTemplateResponse
forall x.
DeletePushTemplateResponse -> Rep DeletePushTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePushTemplateResponse x -> DeletePushTemplateResponse
$cfrom :: forall x.
DeletePushTemplateResponse -> Rep DeletePushTemplateResponse x
Prelude.Generic)
newDeletePushTemplateResponse ::
Prelude.Int ->
MessageBody ->
DeletePushTemplateResponse
newDeletePushTemplateResponse :: Int -> MessageBody -> DeletePushTemplateResponse
newDeletePushTemplateResponse
Int
pHttpStatus_
MessageBody
pMessageBody_ =
DeletePushTemplateResponse' :: Int -> MessageBody -> DeletePushTemplateResponse
DeletePushTemplateResponse'
{ $sel:httpStatus:DeletePushTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:messageBody:DeletePushTemplateResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
}
deletePushTemplateResponse_httpStatus :: Lens.Lens' DeletePushTemplateResponse Prelude.Int
deletePushTemplateResponse_httpStatus :: (Int -> f Int)
-> DeletePushTemplateResponse -> f DeletePushTemplateResponse
deletePushTemplateResponse_httpStatus = (DeletePushTemplateResponse -> Int)
-> (DeletePushTemplateResponse
-> Int -> DeletePushTemplateResponse)
-> Lens
DeletePushTemplateResponse DeletePushTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePushTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePushTemplateResponse' :: DeletePushTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeletePushTemplateResponse
s@DeletePushTemplateResponse' {} Int
a -> DeletePushTemplateResponse
s {$sel:httpStatus:DeletePushTemplateResponse' :: Int
httpStatus = Int
a} :: DeletePushTemplateResponse)
deletePushTemplateResponse_messageBody :: Lens.Lens' DeletePushTemplateResponse MessageBody
deletePushTemplateResponse_messageBody :: (MessageBody -> f MessageBody)
-> DeletePushTemplateResponse -> f DeletePushTemplateResponse
deletePushTemplateResponse_messageBody = (DeletePushTemplateResponse -> MessageBody)
-> (DeletePushTemplateResponse
-> MessageBody -> DeletePushTemplateResponse)
-> Lens
DeletePushTemplateResponse
DeletePushTemplateResponse
MessageBody
MessageBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePushTemplateResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:DeletePushTemplateResponse' :: DeletePushTemplateResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: DeletePushTemplateResponse
s@DeletePushTemplateResponse' {} MessageBody
a -> DeletePushTemplateResponse
s {$sel:messageBody:DeletePushTemplateResponse' :: MessageBody
messageBody = MessageBody
a} :: DeletePushTemplateResponse)
instance Prelude.NFData DeletePushTemplateResponse