{-# 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.UpdateSmsChannel
(
UpdateSmsChannel (..),
newUpdateSmsChannel,
updateSmsChannel_applicationId,
updateSmsChannel_sMSChannelRequest,
UpdateSmsChannelResponse (..),
newUpdateSmsChannelResponse,
updateSmsChannelResponse_httpStatus,
updateSmsChannelResponse_sMSChannelResponse,
)
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 UpdateSmsChannel = UpdateSmsChannel'
{
UpdateSmsChannel -> Text
applicationId :: Prelude.Text,
UpdateSmsChannel -> SMSChannelRequest
sMSChannelRequest :: SMSChannelRequest
}
deriving (UpdateSmsChannel -> UpdateSmsChannel -> Bool
(UpdateSmsChannel -> UpdateSmsChannel -> Bool)
-> (UpdateSmsChannel -> UpdateSmsChannel -> Bool)
-> Eq UpdateSmsChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSmsChannel -> UpdateSmsChannel -> Bool
$c/= :: UpdateSmsChannel -> UpdateSmsChannel -> Bool
== :: UpdateSmsChannel -> UpdateSmsChannel -> Bool
$c== :: UpdateSmsChannel -> UpdateSmsChannel -> Bool
Prelude.Eq, ReadPrec [UpdateSmsChannel]
ReadPrec UpdateSmsChannel
Int -> ReadS UpdateSmsChannel
ReadS [UpdateSmsChannel]
(Int -> ReadS UpdateSmsChannel)
-> ReadS [UpdateSmsChannel]
-> ReadPrec UpdateSmsChannel
-> ReadPrec [UpdateSmsChannel]
-> Read UpdateSmsChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSmsChannel]
$creadListPrec :: ReadPrec [UpdateSmsChannel]
readPrec :: ReadPrec UpdateSmsChannel
$creadPrec :: ReadPrec UpdateSmsChannel
readList :: ReadS [UpdateSmsChannel]
$creadList :: ReadS [UpdateSmsChannel]
readsPrec :: Int -> ReadS UpdateSmsChannel
$creadsPrec :: Int -> ReadS UpdateSmsChannel
Prelude.Read, Int -> UpdateSmsChannel -> ShowS
[UpdateSmsChannel] -> ShowS
UpdateSmsChannel -> String
(Int -> UpdateSmsChannel -> ShowS)
-> (UpdateSmsChannel -> String)
-> ([UpdateSmsChannel] -> ShowS)
-> Show UpdateSmsChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSmsChannel] -> ShowS
$cshowList :: [UpdateSmsChannel] -> ShowS
show :: UpdateSmsChannel -> String
$cshow :: UpdateSmsChannel -> String
showsPrec :: Int -> UpdateSmsChannel -> ShowS
$cshowsPrec :: Int -> UpdateSmsChannel -> ShowS
Prelude.Show, (forall x. UpdateSmsChannel -> Rep UpdateSmsChannel x)
-> (forall x. Rep UpdateSmsChannel x -> UpdateSmsChannel)
-> Generic UpdateSmsChannel
forall x. Rep UpdateSmsChannel x -> UpdateSmsChannel
forall x. UpdateSmsChannel -> Rep UpdateSmsChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSmsChannel x -> UpdateSmsChannel
$cfrom :: forall x. UpdateSmsChannel -> Rep UpdateSmsChannel x
Prelude.Generic)
newUpdateSmsChannel ::
Prelude.Text ->
SMSChannelRequest ->
UpdateSmsChannel
newUpdateSmsChannel :: Text -> SMSChannelRequest -> UpdateSmsChannel
newUpdateSmsChannel
Text
pApplicationId_
SMSChannelRequest
pSMSChannelRequest_ =
UpdateSmsChannel' :: Text -> SMSChannelRequest -> UpdateSmsChannel
UpdateSmsChannel'
{ $sel:applicationId:UpdateSmsChannel' :: Text
applicationId = Text
pApplicationId_,
$sel:sMSChannelRequest:UpdateSmsChannel' :: SMSChannelRequest
sMSChannelRequest = SMSChannelRequest
pSMSChannelRequest_
}
updateSmsChannel_applicationId :: Lens.Lens' UpdateSmsChannel Prelude.Text
updateSmsChannel_applicationId :: (Text -> f Text) -> UpdateSmsChannel -> f UpdateSmsChannel
updateSmsChannel_applicationId = (UpdateSmsChannel -> Text)
-> (UpdateSmsChannel -> Text -> UpdateSmsChannel)
-> Lens UpdateSmsChannel UpdateSmsChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSmsChannel' {Text
applicationId :: Text
$sel:applicationId:UpdateSmsChannel' :: UpdateSmsChannel -> Text
applicationId} -> Text
applicationId) (\s :: UpdateSmsChannel
s@UpdateSmsChannel' {} Text
a -> UpdateSmsChannel
s {$sel:applicationId:UpdateSmsChannel' :: Text
applicationId = Text
a} :: UpdateSmsChannel)
updateSmsChannel_sMSChannelRequest :: Lens.Lens' UpdateSmsChannel SMSChannelRequest
updateSmsChannel_sMSChannelRequest :: (SMSChannelRequest -> f SMSChannelRequest)
-> UpdateSmsChannel -> f UpdateSmsChannel
updateSmsChannel_sMSChannelRequest = (UpdateSmsChannel -> SMSChannelRequest)
-> (UpdateSmsChannel -> SMSChannelRequest -> UpdateSmsChannel)
-> Lens
UpdateSmsChannel
UpdateSmsChannel
SMSChannelRequest
SMSChannelRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSmsChannel' {SMSChannelRequest
sMSChannelRequest :: SMSChannelRequest
$sel:sMSChannelRequest:UpdateSmsChannel' :: UpdateSmsChannel -> SMSChannelRequest
sMSChannelRequest} -> SMSChannelRequest
sMSChannelRequest) (\s :: UpdateSmsChannel
s@UpdateSmsChannel' {} SMSChannelRequest
a -> UpdateSmsChannel
s {$sel:sMSChannelRequest:UpdateSmsChannel' :: SMSChannelRequest
sMSChannelRequest = SMSChannelRequest
a} :: UpdateSmsChannel)
instance Core.AWSRequest UpdateSmsChannel where
type
AWSResponse UpdateSmsChannel =
UpdateSmsChannelResponse
request :: UpdateSmsChannel -> Request UpdateSmsChannel
request = Service -> UpdateSmsChannel -> Request UpdateSmsChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSmsChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSmsChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSmsChannel))
-> Logger
-> Service
-> Proxy UpdateSmsChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSmsChannel)))
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 -> SMSChannelResponse -> UpdateSmsChannelResponse
UpdateSmsChannelResponse'
(Int -> SMSChannelResponse -> UpdateSmsChannelResponse)
-> Either String Int
-> Either String (SMSChannelResponse -> UpdateSmsChannelResponse)
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 (SMSChannelResponse -> UpdateSmsChannelResponse)
-> Either String SMSChannelResponse
-> Either String UpdateSmsChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String SMSChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable UpdateSmsChannel
instance Prelude.NFData UpdateSmsChannel
instance Core.ToHeaders UpdateSmsChannel where
toHeaders :: UpdateSmsChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSmsChannel -> 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 UpdateSmsChannel where
toJSON :: UpdateSmsChannel -> Value
toJSON UpdateSmsChannel' {Text
SMSChannelRequest
sMSChannelRequest :: SMSChannelRequest
applicationId :: Text
$sel:sMSChannelRequest:UpdateSmsChannel' :: UpdateSmsChannel -> SMSChannelRequest
$sel:applicationId:UpdateSmsChannel' :: UpdateSmsChannel -> 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
"SMSChannelRequest" Text -> SMSChannelRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SMSChannelRequest
sMSChannelRequest)
]
)
instance Core.ToPath UpdateSmsChannel where
toPath :: UpdateSmsChannel -> ByteString
toPath UpdateSmsChannel' {Text
SMSChannelRequest
sMSChannelRequest :: SMSChannelRequest
applicationId :: Text
$sel:sMSChannelRequest:UpdateSmsChannel' :: UpdateSmsChannel -> SMSChannelRequest
$sel:applicationId:UpdateSmsChannel' :: UpdateSmsChannel -> 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/sms"
]
instance Core.ToQuery UpdateSmsChannel where
toQuery :: UpdateSmsChannel -> QueryString
toQuery = QueryString -> UpdateSmsChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSmsChannelResponse = UpdateSmsChannelResponse'
{
UpdateSmsChannelResponse -> Int
httpStatus :: Prelude.Int,
UpdateSmsChannelResponse -> SMSChannelResponse
sMSChannelResponse :: SMSChannelResponse
}
deriving (UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool
(UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool)
-> (UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool)
-> Eq UpdateSmsChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool
$c/= :: UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool
== :: UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool
$c== :: UpdateSmsChannelResponse -> UpdateSmsChannelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSmsChannelResponse]
ReadPrec UpdateSmsChannelResponse
Int -> ReadS UpdateSmsChannelResponse
ReadS [UpdateSmsChannelResponse]
(Int -> ReadS UpdateSmsChannelResponse)
-> ReadS [UpdateSmsChannelResponse]
-> ReadPrec UpdateSmsChannelResponse
-> ReadPrec [UpdateSmsChannelResponse]
-> Read UpdateSmsChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSmsChannelResponse]
$creadListPrec :: ReadPrec [UpdateSmsChannelResponse]
readPrec :: ReadPrec UpdateSmsChannelResponse
$creadPrec :: ReadPrec UpdateSmsChannelResponse
readList :: ReadS [UpdateSmsChannelResponse]
$creadList :: ReadS [UpdateSmsChannelResponse]
readsPrec :: Int -> ReadS UpdateSmsChannelResponse
$creadsPrec :: Int -> ReadS UpdateSmsChannelResponse
Prelude.Read, Int -> UpdateSmsChannelResponse -> ShowS
[UpdateSmsChannelResponse] -> ShowS
UpdateSmsChannelResponse -> String
(Int -> UpdateSmsChannelResponse -> ShowS)
-> (UpdateSmsChannelResponse -> String)
-> ([UpdateSmsChannelResponse] -> ShowS)
-> Show UpdateSmsChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSmsChannelResponse] -> ShowS
$cshowList :: [UpdateSmsChannelResponse] -> ShowS
show :: UpdateSmsChannelResponse -> String
$cshow :: UpdateSmsChannelResponse -> String
showsPrec :: Int -> UpdateSmsChannelResponse -> ShowS
$cshowsPrec :: Int -> UpdateSmsChannelResponse -> ShowS
Prelude.Show, (forall x.
UpdateSmsChannelResponse -> Rep UpdateSmsChannelResponse x)
-> (forall x.
Rep UpdateSmsChannelResponse x -> UpdateSmsChannelResponse)
-> Generic UpdateSmsChannelResponse
forall x.
Rep UpdateSmsChannelResponse x -> UpdateSmsChannelResponse
forall x.
UpdateSmsChannelResponse -> Rep UpdateSmsChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSmsChannelResponse x -> UpdateSmsChannelResponse
$cfrom :: forall x.
UpdateSmsChannelResponse -> Rep UpdateSmsChannelResponse x
Prelude.Generic)
newUpdateSmsChannelResponse ::
Prelude.Int ->
SMSChannelResponse ->
UpdateSmsChannelResponse
newUpdateSmsChannelResponse :: Int -> SMSChannelResponse -> UpdateSmsChannelResponse
newUpdateSmsChannelResponse
Int
pHttpStatus_
SMSChannelResponse
pSMSChannelResponse_ =
UpdateSmsChannelResponse' :: Int -> SMSChannelResponse -> UpdateSmsChannelResponse
UpdateSmsChannelResponse'
{ $sel:httpStatus:UpdateSmsChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:sMSChannelResponse:UpdateSmsChannelResponse' :: SMSChannelResponse
sMSChannelResponse = SMSChannelResponse
pSMSChannelResponse_
}
updateSmsChannelResponse_httpStatus :: Lens.Lens' UpdateSmsChannelResponse Prelude.Int
updateSmsChannelResponse_httpStatus :: (Int -> f Int)
-> UpdateSmsChannelResponse -> f UpdateSmsChannelResponse
updateSmsChannelResponse_httpStatus = (UpdateSmsChannelResponse -> Int)
-> (UpdateSmsChannelResponse -> Int -> UpdateSmsChannelResponse)
-> Lens UpdateSmsChannelResponse UpdateSmsChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSmsChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSmsChannelResponse' :: UpdateSmsChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSmsChannelResponse
s@UpdateSmsChannelResponse' {} Int
a -> UpdateSmsChannelResponse
s {$sel:httpStatus:UpdateSmsChannelResponse' :: Int
httpStatus = Int
a} :: UpdateSmsChannelResponse)
updateSmsChannelResponse_sMSChannelResponse :: Lens.Lens' UpdateSmsChannelResponse SMSChannelResponse
updateSmsChannelResponse_sMSChannelResponse :: (SMSChannelResponse -> f SMSChannelResponse)
-> UpdateSmsChannelResponse -> f UpdateSmsChannelResponse
updateSmsChannelResponse_sMSChannelResponse = (UpdateSmsChannelResponse -> SMSChannelResponse)
-> (UpdateSmsChannelResponse
-> SMSChannelResponse -> UpdateSmsChannelResponse)
-> Lens
UpdateSmsChannelResponse
UpdateSmsChannelResponse
SMSChannelResponse
SMSChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSmsChannelResponse' {SMSChannelResponse
sMSChannelResponse :: SMSChannelResponse
$sel:sMSChannelResponse:UpdateSmsChannelResponse' :: UpdateSmsChannelResponse -> SMSChannelResponse
sMSChannelResponse} -> SMSChannelResponse
sMSChannelResponse) (\s :: UpdateSmsChannelResponse
s@UpdateSmsChannelResponse' {} SMSChannelResponse
a -> UpdateSmsChannelResponse
s {$sel:sMSChannelResponse:UpdateSmsChannelResponse' :: SMSChannelResponse
sMSChannelResponse = SMSChannelResponse
a} :: UpdateSmsChannelResponse)
instance Prelude.NFData UpdateSmsChannelResponse