{-# 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.UpdateTemplateActiveVersion
(
UpdateTemplateActiveVersion (..),
newUpdateTemplateActiveVersion,
updateTemplateActiveVersion_templateName,
updateTemplateActiveVersion_templateType,
updateTemplateActiveVersion_templateActiveVersionRequest,
UpdateTemplateActiveVersionResponse (..),
newUpdateTemplateActiveVersionResponse,
updateTemplateActiveVersionResponse_httpStatus,
updateTemplateActiveVersionResponse_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 UpdateTemplateActiveVersion = UpdateTemplateActiveVersion'
{
UpdateTemplateActiveVersion -> Text
templateName :: Prelude.Text,
UpdateTemplateActiveVersion -> Text
templateType :: Prelude.Text,
UpdateTemplateActiveVersion -> TemplateActiveVersionRequest
templateActiveVersionRequest :: TemplateActiveVersionRequest
}
deriving (UpdateTemplateActiveVersion -> UpdateTemplateActiveVersion -> Bool
(UpdateTemplateActiveVersion
-> UpdateTemplateActiveVersion -> Bool)
-> (UpdateTemplateActiveVersion
-> UpdateTemplateActiveVersion -> Bool)
-> Eq UpdateTemplateActiveVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTemplateActiveVersion -> UpdateTemplateActiveVersion -> Bool
$c/= :: UpdateTemplateActiveVersion -> UpdateTemplateActiveVersion -> Bool
== :: UpdateTemplateActiveVersion -> UpdateTemplateActiveVersion -> Bool
$c== :: UpdateTemplateActiveVersion -> UpdateTemplateActiveVersion -> Bool
Prelude.Eq, ReadPrec [UpdateTemplateActiveVersion]
ReadPrec UpdateTemplateActiveVersion
Int -> ReadS UpdateTemplateActiveVersion
ReadS [UpdateTemplateActiveVersion]
(Int -> ReadS UpdateTemplateActiveVersion)
-> ReadS [UpdateTemplateActiveVersion]
-> ReadPrec UpdateTemplateActiveVersion
-> ReadPrec [UpdateTemplateActiveVersion]
-> Read UpdateTemplateActiveVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTemplateActiveVersion]
$creadListPrec :: ReadPrec [UpdateTemplateActiveVersion]
readPrec :: ReadPrec UpdateTemplateActiveVersion
$creadPrec :: ReadPrec UpdateTemplateActiveVersion
readList :: ReadS [UpdateTemplateActiveVersion]
$creadList :: ReadS [UpdateTemplateActiveVersion]
readsPrec :: Int -> ReadS UpdateTemplateActiveVersion
$creadsPrec :: Int -> ReadS UpdateTemplateActiveVersion
Prelude.Read, Int -> UpdateTemplateActiveVersion -> ShowS
[UpdateTemplateActiveVersion] -> ShowS
UpdateTemplateActiveVersion -> String
(Int -> UpdateTemplateActiveVersion -> ShowS)
-> (UpdateTemplateActiveVersion -> String)
-> ([UpdateTemplateActiveVersion] -> ShowS)
-> Show UpdateTemplateActiveVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTemplateActiveVersion] -> ShowS
$cshowList :: [UpdateTemplateActiveVersion] -> ShowS
show :: UpdateTemplateActiveVersion -> String
$cshow :: UpdateTemplateActiveVersion -> String
showsPrec :: Int -> UpdateTemplateActiveVersion -> ShowS
$cshowsPrec :: Int -> UpdateTemplateActiveVersion -> ShowS
Prelude.Show, (forall x.
UpdateTemplateActiveVersion -> Rep UpdateTemplateActiveVersion x)
-> (forall x.
Rep UpdateTemplateActiveVersion x -> UpdateTemplateActiveVersion)
-> Generic UpdateTemplateActiveVersion
forall x.
Rep UpdateTemplateActiveVersion x -> UpdateTemplateActiveVersion
forall x.
UpdateTemplateActiveVersion -> Rep UpdateTemplateActiveVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTemplateActiveVersion x -> UpdateTemplateActiveVersion
$cfrom :: forall x.
UpdateTemplateActiveVersion -> Rep UpdateTemplateActiveVersion x
Prelude.Generic)
newUpdateTemplateActiveVersion ::
Prelude.Text ->
Prelude.Text ->
TemplateActiveVersionRequest ->
UpdateTemplateActiveVersion
newUpdateTemplateActiveVersion :: Text
-> Text
-> TemplateActiveVersionRequest
-> UpdateTemplateActiveVersion
newUpdateTemplateActiveVersion
Text
pTemplateName_
Text
pTemplateType_
TemplateActiveVersionRequest
pTemplateActiveVersionRequest_ =
UpdateTemplateActiveVersion' :: Text
-> Text
-> TemplateActiveVersionRequest
-> UpdateTemplateActiveVersion
UpdateTemplateActiveVersion'
{ $sel:templateName:UpdateTemplateActiveVersion' :: Text
templateName =
Text
pTemplateName_,
$sel:templateType:UpdateTemplateActiveVersion' :: Text
templateType = Text
pTemplateType_,
$sel:templateActiveVersionRequest:UpdateTemplateActiveVersion' :: TemplateActiveVersionRequest
templateActiveVersionRequest =
TemplateActiveVersionRequest
pTemplateActiveVersionRequest_
}
updateTemplateActiveVersion_templateName :: Lens.Lens' UpdateTemplateActiveVersion Prelude.Text
updateTemplateActiveVersion_templateName :: (Text -> f Text)
-> UpdateTemplateActiveVersion -> f UpdateTemplateActiveVersion
updateTemplateActiveVersion_templateName = (UpdateTemplateActiveVersion -> Text)
-> (UpdateTemplateActiveVersion
-> Text -> UpdateTemplateActiveVersion)
-> Lens
UpdateTemplateActiveVersion UpdateTemplateActiveVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplateActiveVersion' {Text
templateName :: Text
$sel:templateName:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> Text
templateName} -> Text
templateName) (\s :: UpdateTemplateActiveVersion
s@UpdateTemplateActiveVersion' {} Text
a -> UpdateTemplateActiveVersion
s {$sel:templateName:UpdateTemplateActiveVersion' :: Text
templateName = Text
a} :: UpdateTemplateActiveVersion)
updateTemplateActiveVersion_templateType :: Lens.Lens' UpdateTemplateActiveVersion Prelude.Text
updateTemplateActiveVersion_templateType :: (Text -> f Text)
-> UpdateTemplateActiveVersion -> f UpdateTemplateActiveVersion
updateTemplateActiveVersion_templateType = (UpdateTemplateActiveVersion -> Text)
-> (UpdateTemplateActiveVersion
-> Text -> UpdateTemplateActiveVersion)
-> Lens
UpdateTemplateActiveVersion UpdateTemplateActiveVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplateActiveVersion' {Text
templateType :: Text
$sel:templateType:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> Text
templateType} -> Text
templateType) (\s :: UpdateTemplateActiveVersion
s@UpdateTemplateActiveVersion' {} Text
a -> UpdateTemplateActiveVersion
s {$sel:templateType:UpdateTemplateActiveVersion' :: Text
templateType = Text
a} :: UpdateTemplateActiveVersion)
updateTemplateActiveVersion_templateActiveVersionRequest :: Lens.Lens' UpdateTemplateActiveVersion TemplateActiveVersionRequest
updateTemplateActiveVersion_templateActiveVersionRequest :: (TemplateActiveVersionRequest -> f TemplateActiveVersionRequest)
-> UpdateTemplateActiveVersion -> f UpdateTemplateActiveVersion
updateTemplateActiveVersion_templateActiveVersionRequest = (UpdateTemplateActiveVersion -> TemplateActiveVersionRequest)
-> (UpdateTemplateActiveVersion
-> TemplateActiveVersionRequest -> UpdateTemplateActiveVersion)
-> Lens
UpdateTemplateActiveVersion
UpdateTemplateActiveVersion
TemplateActiveVersionRequest
TemplateActiveVersionRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplateActiveVersion' {TemplateActiveVersionRequest
templateActiveVersionRequest :: TemplateActiveVersionRequest
$sel:templateActiveVersionRequest:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> TemplateActiveVersionRequest
templateActiveVersionRequest} -> TemplateActiveVersionRequest
templateActiveVersionRequest) (\s :: UpdateTemplateActiveVersion
s@UpdateTemplateActiveVersion' {} TemplateActiveVersionRequest
a -> UpdateTemplateActiveVersion
s {$sel:templateActiveVersionRequest:UpdateTemplateActiveVersion' :: TemplateActiveVersionRequest
templateActiveVersionRequest = TemplateActiveVersionRequest
a} :: UpdateTemplateActiveVersion)
instance Core.AWSRequest UpdateTemplateActiveVersion where
type
AWSResponse UpdateTemplateActiveVersion =
UpdateTemplateActiveVersionResponse
request :: UpdateTemplateActiveVersion -> Request UpdateTemplateActiveVersion
request = Service
-> UpdateTemplateActiveVersion
-> Request UpdateTemplateActiveVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateTemplateActiveVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateTemplateActiveVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateTemplateActiveVersion))
-> Logger
-> Service
-> Proxy UpdateTemplateActiveVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateTemplateActiveVersion)))
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 -> UpdateTemplateActiveVersionResponse
UpdateTemplateActiveVersionResponse'
(Int -> MessageBody -> UpdateTemplateActiveVersionResponse)
-> Either String Int
-> Either
String (MessageBody -> UpdateTemplateActiveVersionResponse)
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 -> UpdateTemplateActiveVersionResponse)
-> Either String MessageBody
-> Either String UpdateTemplateActiveVersionResponse
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 UpdateTemplateActiveVersion
instance Prelude.NFData UpdateTemplateActiveVersion
instance Core.ToHeaders UpdateTemplateActiveVersion where
toHeaders :: UpdateTemplateActiveVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateTemplateActiveVersion -> 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 UpdateTemplateActiveVersion where
toJSON :: UpdateTemplateActiveVersion -> Value
toJSON UpdateTemplateActiveVersion' {Text
TemplateActiveVersionRequest
templateActiveVersionRequest :: TemplateActiveVersionRequest
templateType :: Text
templateName :: Text
$sel:templateActiveVersionRequest:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> TemplateActiveVersionRequest
$sel:templateType:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> Text
$sel:templateName:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> 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
"TemplateActiveVersionRequest"
Text -> TemplateActiveVersionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TemplateActiveVersionRequest
templateActiveVersionRequest
)
]
)
instance Core.ToPath UpdateTemplateActiveVersion where
toPath :: UpdateTemplateActiveVersion -> ByteString
toPath UpdateTemplateActiveVersion' {Text
TemplateActiveVersionRequest
templateActiveVersionRequest :: TemplateActiveVersionRequest
templateType :: Text
templateName :: Text
$sel:templateActiveVersionRequest:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> TemplateActiveVersionRequest
$sel:templateType:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> Text
$sel:templateName:UpdateTemplateActiveVersion' :: UpdateTemplateActiveVersion -> 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
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateType,
ByteString
"/active-version"
]
instance Core.ToQuery UpdateTemplateActiveVersion where
toQuery :: UpdateTemplateActiveVersion -> QueryString
toQuery = QueryString -> UpdateTemplateActiveVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateTemplateActiveVersionResponse = UpdateTemplateActiveVersionResponse'
{
UpdateTemplateActiveVersionResponse -> Int
httpStatus :: Prelude.Int,
UpdateTemplateActiveVersionResponse -> MessageBody
messageBody :: MessageBody
}
deriving (UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool
(UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool)
-> (UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool)
-> Eq UpdateTemplateActiveVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool
$c/= :: UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool
== :: UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool
$c== :: UpdateTemplateActiveVersionResponse
-> UpdateTemplateActiveVersionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTemplateActiveVersionResponse]
ReadPrec UpdateTemplateActiveVersionResponse
Int -> ReadS UpdateTemplateActiveVersionResponse
ReadS [UpdateTemplateActiveVersionResponse]
(Int -> ReadS UpdateTemplateActiveVersionResponse)
-> ReadS [UpdateTemplateActiveVersionResponse]
-> ReadPrec UpdateTemplateActiveVersionResponse
-> ReadPrec [UpdateTemplateActiveVersionResponse]
-> Read UpdateTemplateActiveVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTemplateActiveVersionResponse]
$creadListPrec :: ReadPrec [UpdateTemplateActiveVersionResponse]
readPrec :: ReadPrec UpdateTemplateActiveVersionResponse
$creadPrec :: ReadPrec UpdateTemplateActiveVersionResponse
readList :: ReadS [UpdateTemplateActiveVersionResponse]
$creadList :: ReadS [UpdateTemplateActiveVersionResponse]
readsPrec :: Int -> ReadS UpdateTemplateActiveVersionResponse
$creadsPrec :: Int -> ReadS UpdateTemplateActiveVersionResponse
Prelude.Read, Int -> UpdateTemplateActiveVersionResponse -> ShowS
[UpdateTemplateActiveVersionResponse] -> ShowS
UpdateTemplateActiveVersionResponse -> String
(Int -> UpdateTemplateActiveVersionResponse -> ShowS)
-> (UpdateTemplateActiveVersionResponse -> String)
-> ([UpdateTemplateActiveVersionResponse] -> ShowS)
-> Show UpdateTemplateActiveVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTemplateActiveVersionResponse] -> ShowS
$cshowList :: [UpdateTemplateActiveVersionResponse] -> ShowS
show :: UpdateTemplateActiveVersionResponse -> String
$cshow :: UpdateTemplateActiveVersionResponse -> String
showsPrec :: Int -> UpdateTemplateActiveVersionResponse -> ShowS
$cshowsPrec :: Int -> UpdateTemplateActiveVersionResponse -> ShowS
Prelude.Show, (forall x.
UpdateTemplateActiveVersionResponse
-> Rep UpdateTemplateActiveVersionResponse x)
-> (forall x.
Rep UpdateTemplateActiveVersionResponse x
-> UpdateTemplateActiveVersionResponse)
-> Generic UpdateTemplateActiveVersionResponse
forall x.
Rep UpdateTemplateActiveVersionResponse x
-> UpdateTemplateActiveVersionResponse
forall x.
UpdateTemplateActiveVersionResponse
-> Rep UpdateTemplateActiveVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTemplateActiveVersionResponse x
-> UpdateTemplateActiveVersionResponse
$cfrom :: forall x.
UpdateTemplateActiveVersionResponse
-> Rep UpdateTemplateActiveVersionResponse x
Prelude.Generic)
newUpdateTemplateActiveVersionResponse ::
Prelude.Int ->
MessageBody ->
UpdateTemplateActiveVersionResponse
newUpdateTemplateActiveVersionResponse :: Int -> MessageBody -> UpdateTemplateActiveVersionResponse
newUpdateTemplateActiveVersionResponse
Int
pHttpStatus_
MessageBody
pMessageBody_ =
UpdateTemplateActiveVersionResponse' :: Int -> MessageBody -> UpdateTemplateActiveVersionResponse
UpdateTemplateActiveVersionResponse'
{ $sel:httpStatus:UpdateTemplateActiveVersionResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:messageBody:UpdateTemplateActiveVersionResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
}
updateTemplateActiveVersionResponse_httpStatus :: Lens.Lens' UpdateTemplateActiveVersionResponse Prelude.Int
updateTemplateActiveVersionResponse_httpStatus :: (Int -> f Int)
-> UpdateTemplateActiveVersionResponse
-> f UpdateTemplateActiveVersionResponse
updateTemplateActiveVersionResponse_httpStatus = (UpdateTemplateActiveVersionResponse -> Int)
-> (UpdateTemplateActiveVersionResponse
-> Int -> UpdateTemplateActiveVersionResponse)
-> Lens
UpdateTemplateActiveVersionResponse
UpdateTemplateActiveVersionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplateActiveVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTemplateActiveVersionResponse' :: UpdateTemplateActiveVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTemplateActiveVersionResponse
s@UpdateTemplateActiveVersionResponse' {} Int
a -> UpdateTemplateActiveVersionResponse
s {$sel:httpStatus:UpdateTemplateActiveVersionResponse' :: Int
httpStatus = Int
a} :: UpdateTemplateActiveVersionResponse)
updateTemplateActiveVersionResponse_messageBody :: Lens.Lens' UpdateTemplateActiveVersionResponse MessageBody
updateTemplateActiveVersionResponse_messageBody :: (MessageBody -> f MessageBody)
-> UpdateTemplateActiveVersionResponse
-> f UpdateTemplateActiveVersionResponse
updateTemplateActiveVersionResponse_messageBody = (UpdateTemplateActiveVersionResponse -> MessageBody)
-> (UpdateTemplateActiveVersionResponse
-> MessageBody -> UpdateTemplateActiveVersionResponse)
-> Lens
UpdateTemplateActiveVersionResponse
UpdateTemplateActiveVersionResponse
MessageBody
MessageBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplateActiveVersionResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:UpdateTemplateActiveVersionResponse' :: UpdateTemplateActiveVersionResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: UpdateTemplateActiveVersionResponse
s@UpdateTemplateActiveVersionResponse' {} MessageBody
a -> UpdateTemplateActiveVersionResponse
s {$sel:messageBody:UpdateTemplateActiveVersionResponse' :: MessageBody
messageBody = MessageBody
a} :: UpdateTemplateActiveVersionResponse)
instance
Prelude.NFData
UpdateTemplateActiveVersionResponse