{-# 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.UpdatePushTemplate
(
UpdatePushTemplate (..),
newUpdatePushTemplate,
updatePushTemplate_createNewVersion,
updatePushTemplate_version,
updatePushTemplate_templateName,
updatePushTemplate_pushNotificationTemplateRequest,
UpdatePushTemplateResponse (..),
newUpdatePushTemplateResponse,
updatePushTemplateResponse_httpStatus,
updatePushTemplateResponse_messageBody,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdatePushTemplate = UpdatePushTemplate'
{
UpdatePushTemplate -> Maybe Bool
createNewVersion :: Prelude.Maybe Prelude.Bool,
UpdatePushTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
UpdatePushTemplate -> Text
templateName :: Prelude.Text,
UpdatePushTemplate -> PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
}
deriving (UpdatePushTemplate -> UpdatePushTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePushTemplate -> UpdatePushTemplate -> Bool
$c/= :: UpdatePushTemplate -> UpdatePushTemplate -> Bool
== :: UpdatePushTemplate -> UpdatePushTemplate -> Bool
$c== :: UpdatePushTemplate -> UpdatePushTemplate -> Bool
Prelude.Eq, ReadPrec [UpdatePushTemplate]
ReadPrec UpdatePushTemplate
Int -> ReadS UpdatePushTemplate
ReadS [UpdatePushTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePushTemplate]
$creadListPrec :: ReadPrec [UpdatePushTemplate]
readPrec :: ReadPrec UpdatePushTemplate
$creadPrec :: ReadPrec UpdatePushTemplate
readList :: ReadS [UpdatePushTemplate]
$creadList :: ReadS [UpdatePushTemplate]
readsPrec :: Int -> ReadS UpdatePushTemplate
$creadsPrec :: Int -> ReadS UpdatePushTemplate
Prelude.Read, Int -> UpdatePushTemplate -> ShowS
[UpdatePushTemplate] -> ShowS
UpdatePushTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePushTemplate] -> ShowS
$cshowList :: [UpdatePushTemplate] -> ShowS
show :: UpdatePushTemplate -> String
$cshow :: UpdatePushTemplate -> String
showsPrec :: Int -> UpdatePushTemplate -> ShowS
$cshowsPrec :: Int -> UpdatePushTemplate -> ShowS
Prelude.Show, forall x. Rep UpdatePushTemplate x -> UpdatePushTemplate
forall x. UpdatePushTemplate -> Rep UpdatePushTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePushTemplate x -> UpdatePushTemplate
$cfrom :: forall x. UpdatePushTemplate -> Rep UpdatePushTemplate x
Prelude.Generic)
newUpdatePushTemplate ::
Prelude.Text ->
PushNotificationTemplateRequest ->
UpdatePushTemplate
newUpdatePushTemplate :: Text -> PushNotificationTemplateRequest -> UpdatePushTemplate
newUpdatePushTemplate
Text
pTemplateName_
PushNotificationTemplateRequest
pPushNotificationTemplateRequest_ =
UpdatePushTemplate'
{ $sel:createNewVersion:UpdatePushTemplate' :: Maybe Bool
createNewVersion =
forall a. Maybe a
Prelude.Nothing,
$sel:version:UpdatePushTemplate' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
$sel:templateName:UpdatePushTemplate' :: Text
templateName = Text
pTemplateName_,
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: PushNotificationTemplateRequest
pushNotificationTemplateRequest =
PushNotificationTemplateRequest
pPushNotificationTemplateRequest_
}
updatePushTemplate_createNewVersion :: Lens.Lens' UpdatePushTemplate (Prelude.Maybe Prelude.Bool)
updatePushTemplate_createNewVersion :: Lens' UpdatePushTemplate (Maybe Bool)
updatePushTemplate_createNewVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplate' {Maybe Bool
createNewVersion :: Maybe Bool
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
createNewVersion} -> Maybe Bool
createNewVersion) (\s :: UpdatePushTemplate
s@UpdatePushTemplate' {} Maybe Bool
a -> UpdatePushTemplate
s {$sel:createNewVersion:UpdatePushTemplate' :: Maybe Bool
createNewVersion = Maybe Bool
a} :: UpdatePushTemplate)
updatePushTemplate_version :: Lens.Lens' UpdatePushTemplate (Prelude.Maybe Prelude.Text)
updatePushTemplate_version :: Lens' UpdatePushTemplate (Maybe Text)
updatePushTemplate_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplate' {Maybe Text
version :: Maybe Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: UpdatePushTemplate
s@UpdatePushTemplate' {} Maybe Text
a -> UpdatePushTemplate
s {$sel:version:UpdatePushTemplate' :: Maybe Text
version = Maybe Text
a} :: UpdatePushTemplate)
updatePushTemplate_templateName :: Lens.Lens' UpdatePushTemplate Prelude.Text
updatePushTemplate_templateName :: Lens' UpdatePushTemplate Text
updatePushTemplate_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplate' {Text
templateName :: Text
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
templateName} -> Text
templateName) (\s :: UpdatePushTemplate
s@UpdatePushTemplate' {} Text
a -> UpdatePushTemplate
s {$sel:templateName:UpdatePushTemplate' :: Text
templateName = Text
a} :: UpdatePushTemplate)
updatePushTemplate_pushNotificationTemplateRequest :: Lens.Lens' UpdatePushTemplate PushNotificationTemplateRequest
updatePushTemplate_pushNotificationTemplateRequest :: Lens' UpdatePushTemplate PushNotificationTemplateRequest
updatePushTemplate_pushNotificationTemplateRequest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplate' {PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
pushNotificationTemplateRequest} -> PushNotificationTemplateRequest
pushNotificationTemplateRequest) (\s :: UpdatePushTemplate
s@UpdatePushTemplate' {} PushNotificationTemplateRequest
a -> UpdatePushTemplate
s {$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: PushNotificationTemplateRequest
pushNotificationTemplateRequest = PushNotificationTemplateRequest
a} :: UpdatePushTemplate)
instance Core.AWSRequest UpdatePushTemplate where
type
AWSResponse UpdatePushTemplate =
UpdatePushTemplateResponse
request :: (Service -> Service)
-> UpdatePushTemplate -> Request UpdatePushTemplate
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdatePushTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdatePushTemplate)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> MessageBody -> UpdatePushTemplateResponse
UpdatePushTemplateResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
)
instance Prelude.Hashable UpdatePushTemplate where
hashWithSalt :: Int -> UpdatePushTemplate -> Int
hashWithSalt Int
_salt UpdatePushTemplate' {Maybe Bool
Maybe Text
Text
PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
templateName :: Text
version :: Maybe Text
createNewVersion :: Maybe Bool
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
createNewVersion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PushNotificationTemplateRequest
pushNotificationTemplateRequest
instance Prelude.NFData UpdatePushTemplate where
rnf :: UpdatePushTemplate -> ()
rnf UpdatePushTemplate' {Maybe Bool
Maybe Text
Text
PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
templateName :: Text
version :: Maybe Text
createNewVersion :: Maybe Bool
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
createNewVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PushNotificationTemplateRequest
pushNotificationTemplateRequest
instance Data.ToHeaders UpdatePushTemplate where
toHeaders :: UpdatePushTemplate -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdatePushTemplate where
toJSON :: UpdatePushTemplate -> Value
toJSON UpdatePushTemplate' {Maybe Bool
Maybe Text
Text
PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
templateName :: Text
version :: Maybe Text
createNewVersion :: Maybe Bool
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
..} =
forall a. ToJSON a => a -> Value
Data.toJSON PushNotificationTemplateRequest
pushNotificationTemplateRequest
instance Data.ToPath UpdatePushTemplate where
toPath :: UpdatePushTemplate -> ByteString
toPath UpdatePushTemplate' {Maybe Bool
Maybe Text
Text
PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
templateName :: Text
version :: Maybe Text
createNewVersion :: Maybe Bool
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/templates/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
templateName, ByteString
"/push"]
instance Data.ToQuery UpdatePushTemplate where
toQuery :: UpdatePushTemplate -> QueryString
toQuery UpdatePushTemplate' {Maybe Bool
Maybe Text
Text
PushNotificationTemplateRequest
pushNotificationTemplateRequest :: PushNotificationTemplateRequest
templateName :: Text
version :: Maybe Text
createNewVersion :: Maybe Bool
$sel:pushNotificationTemplateRequest:UpdatePushTemplate' :: UpdatePushTemplate -> PushNotificationTemplateRequest
$sel:templateName:UpdatePushTemplate' :: UpdatePushTemplate -> Text
$sel:version:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Text
$sel:createNewVersion:UpdatePushTemplate' :: UpdatePushTemplate -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"create-new-version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
createNewVersion,
ByteString
"version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
version
]
data UpdatePushTemplateResponse = UpdatePushTemplateResponse'
{
UpdatePushTemplateResponse -> Int
httpStatus :: Prelude.Int,
UpdatePushTemplateResponse -> MessageBody
messageBody :: MessageBody
}
deriving (UpdatePushTemplateResponse -> UpdatePushTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePushTemplateResponse -> UpdatePushTemplateResponse -> Bool
$c/= :: UpdatePushTemplateResponse -> UpdatePushTemplateResponse -> Bool
== :: UpdatePushTemplateResponse -> UpdatePushTemplateResponse -> Bool
$c== :: UpdatePushTemplateResponse -> UpdatePushTemplateResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePushTemplateResponse]
ReadPrec UpdatePushTemplateResponse
Int -> ReadS UpdatePushTemplateResponse
ReadS [UpdatePushTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePushTemplateResponse]
$creadListPrec :: ReadPrec [UpdatePushTemplateResponse]
readPrec :: ReadPrec UpdatePushTemplateResponse
$creadPrec :: ReadPrec UpdatePushTemplateResponse
readList :: ReadS [UpdatePushTemplateResponse]
$creadList :: ReadS [UpdatePushTemplateResponse]
readsPrec :: Int -> ReadS UpdatePushTemplateResponse
$creadsPrec :: Int -> ReadS UpdatePushTemplateResponse
Prelude.Read, Int -> UpdatePushTemplateResponse -> ShowS
[UpdatePushTemplateResponse] -> ShowS
UpdatePushTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePushTemplateResponse] -> ShowS
$cshowList :: [UpdatePushTemplateResponse] -> ShowS
show :: UpdatePushTemplateResponse -> String
$cshow :: UpdatePushTemplateResponse -> String
showsPrec :: Int -> UpdatePushTemplateResponse -> ShowS
$cshowsPrec :: Int -> UpdatePushTemplateResponse -> ShowS
Prelude.Show, forall x.
Rep UpdatePushTemplateResponse x -> UpdatePushTemplateResponse
forall x.
UpdatePushTemplateResponse -> Rep UpdatePushTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdatePushTemplateResponse x -> UpdatePushTemplateResponse
$cfrom :: forall x.
UpdatePushTemplateResponse -> Rep UpdatePushTemplateResponse x
Prelude.Generic)
newUpdatePushTemplateResponse ::
Prelude.Int ->
MessageBody ->
UpdatePushTemplateResponse
newUpdatePushTemplateResponse :: Int -> MessageBody -> UpdatePushTemplateResponse
newUpdatePushTemplateResponse
Int
pHttpStatus_
MessageBody
pMessageBody_ =
UpdatePushTemplateResponse'
{ $sel:httpStatus:UpdatePushTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:messageBody:UpdatePushTemplateResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
}
updatePushTemplateResponse_httpStatus :: Lens.Lens' UpdatePushTemplateResponse Prelude.Int
updatePushTemplateResponse_httpStatus :: Lens' UpdatePushTemplateResponse Int
updatePushTemplateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePushTemplateResponse' :: UpdatePushTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePushTemplateResponse
s@UpdatePushTemplateResponse' {} Int
a -> UpdatePushTemplateResponse
s {$sel:httpStatus:UpdatePushTemplateResponse' :: Int
httpStatus = Int
a} :: UpdatePushTemplateResponse)
updatePushTemplateResponse_messageBody :: Lens.Lens' UpdatePushTemplateResponse MessageBody
updatePushTemplateResponse_messageBody :: Lens' UpdatePushTemplateResponse MessageBody
updatePushTemplateResponse_messageBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePushTemplateResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:UpdatePushTemplateResponse' :: UpdatePushTemplateResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: UpdatePushTemplateResponse
s@UpdatePushTemplateResponse' {} MessageBody
a -> UpdatePushTemplateResponse
s {$sel:messageBody:UpdatePushTemplateResponse' :: MessageBody
messageBody = MessageBody
a} :: UpdatePushTemplateResponse)
instance Prelude.NFData UpdatePushTemplateResponse where
rnf :: UpdatePushTemplateResponse -> ()
rnf UpdatePushTemplateResponse' {Int
MessageBody
messageBody :: MessageBody
httpStatus :: Int
$sel:messageBody:UpdatePushTemplateResponse' :: UpdatePushTemplateResponse -> MessageBody
$sel:httpStatus:UpdatePushTemplateResponse' :: UpdatePushTemplateResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MessageBody
messageBody