{-# 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.UpdateEmailChannel
(
UpdateEmailChannel (..),
newUpdateEmailChannel,
updateEmailChannel_applicationId,
updateEmailChannel_emailChannelRequest,
UpdateEmailChannelResponse (..),
newUpdateEmailChannelResponse,
updateEmailChannelResponse_httpStatus,
updateEmailChannelResponse_emailChannelResponse,
)
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 UpdateEmailChannel = UpdateEmailChannel'
{
UpdateEmailChannel -> Text
applicationId :: Prelude.Text,
UpdateEmailChannel -> EmailChannelRequest
emailChannelRequest :: EmailChannelRequest
}
deriving (UpdateEmailChannel -> UpdateEmailChannel -> Bool
(UpdateEmailChannel -> UpdateEmailChannel -> Bool)
-> (UpdateEmailChannel -> UpdateEmailChannel -> Bool)
-> Eq UpdateEmailChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEmailChannel -> UpdateEmailChannel -> Bool
$c/= :: UpdateEmailChannel -> UpdateEmailChannel -> Bool
== :: UpdateEmailChannel -> UpdateEmailChannel -> Bool
$c== :: UpdateEmailChannel -> UpdateEmailChannel -> Bool
Prelude.Eq, ReadPrec [UpdateEmailChannel]
ReadPrec UpdateEmailChannel
Int -> ReadS UpdateEmailChannel
ReadS [UpdateEmailChannel]
(Int -> ReadS UpdateEmailChannel)
-> ReadS [UpdateEmailChannel]
-> ReadPrec UpdateEmailChannel
-> ReadPrec [UpdateEmailChannel]
-> Read UpdateEmailChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEmailChannel]
$creadListPrec :: ReadPrec [UpdateEmailChannel]
readPrec :: ReadPrec UpdateEmailChannel
$creadPrec :: ReadPrec UpdateEmailChannel
readList :: ReadS [UpdateEmailChannel]
$creadList :: ReadS [UpdateEmailChannel]
readsPrec :: Int -> ReadS UpdateEmailChannel
$creadsPrec :: Int -> ReadS UpdateEmailChannel
Prelude.Read, Int -> UpdateEmailChannel -> ShowS
[UpdateEmailChannel] -> ShowS
UpdateEmailChannel -> String
(Int -> UpdateEmailChannel -> ShowS)
-> (UpdateEmailChannel -> String)
-> ([UpdateEmailChannel] -> ShowS)
-> Show UpdateEmailChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEmailChannel] -> ShowS
$cshowList :: [UpdateEmailChannel] -> ShowS
show :: UpdateEmailChannel -> String
$cshow :: UpdateEmailChannel -> String
showsPrec :: Int -> UpdateEmailChannel -> ShowS
$cshowsPrec :: Int -> UpdateEmailChannel -> ShowS
Prelude.Show, (forall x. UpdateEmailChannel -> Rep UpdateEmailChannel x)
-> (forall x. Rep UpdateEmailChannel x -> UpdateEmailChannel)
-> Generic UpdateEmailChannel
forall x. Rep UpdateEmailChannel x -> UpdateEmailChannel
forall x. UpdateEmailChannel -> Rep UpdateEmailChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEmailChannel x -> UpdateEmailChannel
$cfrom :: forall x. UpdateEmailChannel -> Rep UpdateEmailChannel x
Prelude.Generic)
newUpdateEmailChannel ::
Prelude.Text ->
EmailChannelRequest ->
UpdateEmailChannel
newUpdateEmailChannel :: Text -> EmailChannelRequest -> UpdateEmailChannel
newUpdateEmailChannel
Text
pApplicationId_
EmailChannelRequest
pEmailChannelRequest_ =
UpdateEmailChannel' :: Text -> EmailChannelRequest -> UpdateEmailChannel
UpdateEmailChannel'
{ $sel:applicationId:UpdateEmailChannel' :: Text
applicationId =
Text
pApplicationId_,
$sel:emailChannelRequest:UpdateEmailChannel' :: EmailChannelRequest
emailChannelRequest = EmailChannelRequest
pEmailChannelRequest_
}
updateEmailChannel_applicationId :: Lens.Lens' UpdateEmailChannel Prelude.Text
updateEmailChannel_applicationId :: (Text -> f Text) -> UpdateEmailChannel -> f UpdateEmailChannel
updateEmailChannel_applicationId = (UpdateEmailChannel -> Text)
-> (UpdateEmailChannel -> Text -> UpdateEmailChannel)
-> Lens UpdateEmailChannel UpdateEmailChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailChannel' {Text
applicationId :: Text
$sel:applicationId:UpdateEmailChannel' :: UpdateEmailChannel -> Text
applicationId} -> Text
applicationId) (\s :: UpdateEmailChannel
s@UpdateEmailChannel' {} Text
a -> UpdateEmailChannel
s {$sel:applicationId:UpdateEmailChannel' :: Text
applicationId = Text
a} :: UpdateEmailChannel)
updateEmailChannel_emailChannelRequest :: Lens.Lens' UpdateEmailChannel EmailChannelRequest
updateEmailChannel_emailChannelRequest :: (EmailChannelRequest -> f EmailChannelRequest)
-> UpdateEmailChannel -> f UpdateEmailChannel
updateEmailChannel_emailChannelRequest = (UpdateEmailChannel -> EmailChannelRequest)
-> (UpdateEmailChannel
-> EmailChannelRequest -> UpdateEmailChannel)
-> Lens
UpdateEmailChannel
UpdateEmailChannel
EmailChannelRequest
EmailChannelRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailChannel' {EmailChannelRequest
emailChannelRequest :: EmailChannelRequest
$sel:emailChannelRequest:UpdateEmailChannel' :: UpdateEmailChannel -> EmailChannelRequest
emailChannelRequest} -> EmailChannelRequest
emailChannelRequest) (\s :: UpdateEmailChannel
s@UpdateEmailChannel' {} EmailChannelRequest
a -> UpdateEmailChannel
s {$sel:emailChannelRequest:UpdateEmailChannel' :: EmailChannelRequest
emailChannelRequest = EmailChannelRequest
a} :: UpdateEmailChannel)
instance Core.AWSRequest UpdateEmailChannel where
type
AWSResponse UpdateEmailChannel =
UpdateEmailChannelResponse
request :: UpdateEmailChannel -> Request UpdateEmailChannel
request = Service -> UpdateEmailChannel -> Request UpdateEmailChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateEmailChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateEmailChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateEmailChannel))
-> Logger
-> Service
-> Proxy UpdateEmailChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateEmailChannel)))
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 -> EmailChannelResponse -> UpdateEmailChannelResponse
UpdateEmailChannelResponse'
(Int -> EmailChannelResponse -> UpdateEmailChannelResponse)
-> Either String Int
-> Either
String (EmailChannelResponse -> UpdateEmailChannelResponse)
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 (EmailChannelResponse -> UpdateEmailChannelResponse)
-> Either String EmailChannelResponse
-> Either String UpdateEmailChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String EmailChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable UpdateEmailChannel
instance Prelude.NFData UpdateEmailChannel
instance Core.ToHeaders UpdateEmailChannel where
toHeaders :: UpdateEmailChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateEmailChannel -> 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 UpdateEmailChannel where
toJSON :: UpdateEmailChannel -> Value
toJSON UpdateEmailChannel' {Text
EmailChannelRequest
emailChannelRequest :: EmailChannelRequest
applicationId :: Text
$sel:emailChannelRequest:UpdateEmailChannel' :: UpdateEmailChannel -> EmailChannelRequest
$sel:applicationId:UpdateEmailChannel' :: UpdateEmailChannel -> 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
"EmailChannelRequest" Text -> EmailChannelRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EmailChannelRequest
emailChannelRequest)
]
)
instance Core.ToPath UpdateEmailChannel where
toPath :: UpdateEmailChannel -> ByteString
toPath UpdateEmailChannel' {Text
EmailChannelRequest
emailChannelRequest :: EmailChannelRequest
applicationId :: Text
$sel:emailChannelRequest:UpdateEmailChannel' :: UpdateEmailChannel -> EmailChannelRequest
$sel:applicationId:UpdateEmailChannel' :: UpdateEmailChannel -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/channels/email"
]
instance Core.ToQuery UpdateEmailChannel where
toQuery :: UpdateEmailChannel -> QueryString
toQuery = QueryString -> UpdateEmailChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateEmailChannelResponse = UpdateEmailChannelResponse'
{
UpdateEmailChannelResponse -> Int
httpStatus :: Prelude.Int,
UpdateEmailChannelResponse -> EmailChannelResponse
emailChannelResponse :: EmailChannelResponse
}
deriving (UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool
(UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool)
-> (UpdateEmailChannelResponse
-> UpdateEmailChannelResponse -> Bool)
-> Eq UpdateEmailChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool
$c/= :: UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool
== :: UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool
$c== :: UpdateEmailChannelResponse -> UpdateEmailChannelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateEmailChannelResponse]
ReadPrec UpdateEmailChannelResponse
Int -> ReadS UpdateEmailChannelResponse
ReadS [UpdateEmailChannelResponse]
(Int -> ReadS UpdateEmailChannelResponse)
-> ReadS [UpdateEmailChannelResponse]
-> ReadPrec UpdateEmailChannelResponse
-> ReadPrec [UpdateEmailChannelResponse]
-> Read UpdateEmailChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEmailChannelResponse]
$creadListPrec :: ReadPrec [UpdateEmailChannelResponse]
readPrec :: ReadPrec UpdateEmailChannelResponse
$creadPrec :: ReadPrec UpdateEmailChannelResponse
readList :: ReadS [UpdateEmailChannelResponse]
$creadList :: ReadS [UpdateEmailChannelResponse]
readsPrec :: Int -> ReadS UpdateEmailChannelResponse
$creadsPrec :: Int -> ReadS UpdateEmailChannelResponse
Prelude.Read, Int -> UpdateEmailChannelResponse -> ShowS
[UpdateEmailChannelResponse] -> ShowS
UpdateEmailChannelResponse -> String
(Int -> UpdateEmailChannelResponse -> ShowS)
-> (UpdateEmailChannelResponse -> String)
-> ([UpdateEmailChannelResponse] -> ShowS)
-> Show UpdateEmailChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEmailChannelResponse] -> ShowS
$cshowList :: [UpdateEmailChannelResponse] -> ShowS
show :: UpdateEmailChannelResponse -> String
$cshow :: UpdateEmailChannelResponse -> String
showsPrec :: Int -> UpdateEmailChannelResponse -> ShowS
$cshowsPrec :: Int -> UpdateEmailChannelResponse -> ShowS
Prelude.Show, (forall x.
UpdateEmailChannelResponse -> Rep UpdateEmailChannelResponse x)
-> (forall x.
Rep UpdateEmailChannelResponse x -> UpdateEmailChannelResponse)
-> Generic UpdateEmailChannelResponse
forall x.
Rep UpdateEmailChannelResponse x -> UpdateEmailChannelResponse
forall x.
UpdateEmailChannelResponse -> Rep UpdateEmailChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEmailChannelResponse x -> UpdateEmailChannelResponse
$cfrom :: forall x.
UpdateEmailChannelResponse -> Rep UpdateEmailChannelResponse x
Prelude.Generic)
newUpdateEmailChannelResponse ::
Prelude.Int ->
EmailChannelResponse ->
UpdateEmailChannelResponse
newUpdateEmailChannelResponse :: Int -> EmailChannelResponse -> UpdateEmailChannelResponse
newUpdateEmailChannelResponse
Int
pHttpStatus_
EmailChannelResponse
pEmailChannelResponse_ =
UpdateEmailChannelResponse' :: Int -> EmailChannelResponse -> UpdateEmailChannelResponse
UpdateEmailChannelResponse'
{ $sel:httpStatus:UpdateEmailChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:emailChannelResponse:UpdateEmailChannelResponse' :: EmailChannelResponse
emailChannelResponse = EmailChannelResponse
pEmailChannelResponse_
}
updateEmailChannelResponse_httpStatus :: Lens.Lens' UpdateEmailChannelResponse Prelude.Int
updateEmailChannelResponse_httpStatus :: (Int -> f Int)
-> UpdateEmailChannelResponse -> f UpdateEmailChannelResponse
updateEmailChannelResponse_httpStatus = (UpdateEmailChannelResponse -> Int)
-> (UpdateEmailChannelResponse
-> Int -> UpdateEmailChannelResponse)
-> Lens
UpdateEmailChannelResponse UpdateEmailChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateEmailChannelResponse' :: UpdateEmailChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateEmailChannelResponse
s@UpdateEmailChannelResponse' {} Int
a -> UpdateEmailChannelResponse
s {$sel:httpStatus:UpdateEmailChannelResponse' :: Int
httpStatus = Int
a} :: UpdateEmailChannelResponse)
updateEmailChannelResponse_emailChannelResponse :: Lens.Lens' UpdateEmailChannelResponse EmailChannelResponse
updateEmailChannelResponse_emailChannelResponse :: (EmailChannelResponse -> f EmailChannelResponse)
-> UpdateEmailChannelResponse -> f UpdateEmailChannelResponse
updateEmailChannelResponse_emailChannelResponse = (UpdateEmailChannelResponse -> EmailChannelResponse)
-> (UpdateEmailChannelResponse
-> EmailChannelResponse -> UpdateEmailChannelResponse)
-> Lens
UpdateEmailChannelResponse
UpdateEmailChannelResponse
EmailChannelResponse
EmailChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmailChannelResponse' {EmailChannelResponse
emailChannelResponse :: EmailChannelResponse
$sel:emailChannelResponse:UpdateEmailChannelResponse' :: UpdateEmailChannelResponse -> EmailChannelResponse
emailChannelResponse} -> EmailChannelResponse
emailChannelResponse) (\s :: UpdateEmailChannelResponse
s@UpdateEmailChannelResponse' {} EmailChannelResponse
a -> UpdateEmailChannelResponse
s {$sel:emailChannelResponse:UpdateEmailChannelResponse' :: EmailChannelResponse
emailChannelResponse = EmailChannelResponse
a} :: UpdateEmailChannelResponse)
instance Prelude.NFData UpdateEmailChannelResponse