{-# 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.UpdateEndpoint
(
UpdateEndpoint (..),
newUpdateEndpoint,
updateEndpoint_applicationId,
updateEndpoint_endpointId,
updateEndpoint_endpointRequest,
UpdateEndpointResponse (..),
newUpdateEndpointResponse,
updateEndpointResponse_httpStatus,
updateEndpointResponse_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 UpdateEndpoint = UpdateEndpoint'
{
UpdateEndpoint -> Text
applicationId :: Prelude.Text,
UpdateEndpoint -> Text
endpointId :: Prelude.Text,
UpdateEndpoint -> EndpointRequest
endpointRequest :: EndpointRequest
}
deriving (UpdateEndpoint -> UpdateEndpoint -> Bool
(UpdateEndpoint -> UpdateEndpoint -> Bool)
-> (UpdateEndpoint -> UpdateEndpoint -> Bool) -> Eq UpdateEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEndpoint -> UpdateEndpoint -> Bool
$c/= :: UpdateEndpoint -> UpdateEndpoint -> Bool
== :: UpdateEndpoint -> UpdateEndpoint -> Bool
$c== :: UpdateEndpoint -> UpdateEndpoint -> Bool
Prelude.Eq, ReadPrec [UpdateEndpoint]
ReadPrec UpdateEndpoint
Int -> ReadS UpdateEndpoint
ReadS [UpdateEndpoint]
(Int -> ReadS UpdateEndpoint)
-> ReadS [UpdateEndpoint]
-> ReadPrec UpdateEndpoint
-> ReadPrec [UpdateEndpoint]
-> Read UpdateEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEndpoint]
$creadListPrec :: ReadPrec [UpdateEndpoint]
readPrec :: ReadPrec UpdateEndpoint
$creadPrec :: ReadPrec UpdateEndpoint
readList :: ReadS [UpdateEndpoint]
$creadList :: ReadS [UpdateEndpoint]
readsPrec :: Int -> ReadS UpdateEndpoint
$creadsPrec :: Int -> ReadS UpdateEndpoint
Prelude.Read, Int -> UpdateEndpoint -> ShowS
[UpdateEndpoint] -> ShowS
UpdateEndpoint -> String
(Int -> UpdateEndpoint -> ShowS)
-> (UpdateEndpoint -> String)
-> ([UpdateEndpoint] -> ShowS)
-> Show UpdateEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEndpoint] -> ShowS
$cshowList :: [UpdateEndpoint] -> ShowS
show :: UpdateEndpoint -> String
$cshow :: UpdateEndpoint -> String
showsPrec :: Int -> UpdateEndpoint -> ShowS
$cshowsPrec :: Int -> UpdateEndpoint -> ShowS
Prelude.Show, (forall x. UpdateEndpoint -> Rep UpdateEndpoint x)
-> (forall x. Rep UpdateEndpoint x -> UpdateEndpoint)
-> Generic UpdateEndpoint
forall x. Rep UpdateEndpoint x -> UpdateEndpoint
forall x. UpdateEndpoint -> Rep UpdateEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEndpoint x -> UpdateEndpoint
$cfrom :: forall x. UpdateEndpoint -> Rep UpdateEndpoint x
Prelude.Generic)
newUpdateEndpoint ::
Prelude.Text ->
Prelude.Text ->
EndpointRequest ->
UpdateEndpoint
newUpdateEndpoint :: Text -> Text -> EndpointRequest -> UpdateEndpoint
newUpdateEndpoint
Text
pApplicationId_
Text
pEndpointId_
EndpointRequest
pEndpointRequest_ =
UpdateEndpoint' :: Text -> Text -> EndpointRequest -> UpdateEndpoint
UpdateEndpoint'
{ $sel:applicationId:UpdateEndpoint' :: Text
applicationId = Text
pApplicationId_,
$sel:endpointId:UpdateEndpoint' :: Text
endpointId = Text
pEndpointId_,
$sel:endpointRequest:UpdateEndpoint' :: EndpointRequest
endpointRequest = EndpointRequest
pEndpointRequest_
}
updateEndpoint_applicationId :: Lens.Lens' UpdateEndpoint Prelude.Text
updateEndpoint_applicationId :: (Text -> f Text) -> UpdateEndpoint -> f UpdateEndpoint
updateEndpoint_applicationId = (UpdateEndpoint -> Text)
-> (UpdateEndpoint -> Text -> UpdateEndpoint)
-> Lens UpdateEndpoint UpdateEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpoint' {Text
applicationId :: Text
$sel:applicationId:UpdateEndpoint' :: UpdateEndpoint -> Text
applicationId} -> Text
applicationId) (\s :: UpdateEndpoint
s@UpdateEndpoint' {} Text
a -> UpdateEndpoint
s {$sel:applicationId:UpdateEndpoint' :: Text
applicationId = Text
a} :: UpdateEndpoint)
updateEndpoint_endpointId :: Lens.Lens' UpdateEndpoint Prelude.Text
updateEndpoint_endpointId :: (Text -> f Text) -> UpdateEndpoint -> f UpdateEndpoint
updateEndpoint_endpointId = (UpdateEndpoint -> Text)
-> (UpdateEndpoint -> Text -> UpdateEndpoint)
-> Lens UpdateEndpoint UpdateEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpoint' {Text
endpointId :: Text
$sel:endpointId:UpdateEndpoint' :: UpdateEndpoint -> Text
endpointId} -> Text
endpointId) (\s :: UpdateEndpoint
s@UpdateEndpoint' {} Text
a -> UpdateEndpoint
s {$sel:endpointId:UpdateEndpoint' :: Text
endpointId = Text
a} :: UpdateEndpoint)
updateEndpoint_endpointRequest :: Lens.Lens' UpdateEndpoint EndpointRequest
updateEndpoint_endpointRequest :: (EndpointRequest -> f EndpointRequest)
-> UpdateEndpoint -> f UpdateEndpoint
updateEndpoint_endpointRequest = (UpdateEndpoint -> EndpointRequest)
-> (UpdateEndpoint -> EndpointRequest -> UpdateEndpoint)
-> Lens
UpdateEndpoint UpdateEndpoint EndpointRequest EndpointRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpoint' {EndpointRequest
endpointRequest :: EndpointRequest
$sel:endpointRequest:UpdateEndpoint' :: UpdateEndpoint -> EndpointRequest
endpointRequest} -> EndpointRequest
endpointRequest) (\s :: UpdateEndpoint
s@UpdateEndpoint' {} EndpointRequest
a -> UpdateEndpoint
s {$sel:endpointRequest:UpdateEndpoint' :: EndpointRequest
endpointRequest = EndpointRequest
a} :: UpdateEndpoint)
instance Core.AWSRequest UpdateEndpoint where
type
AWSResponse UpdateEndpoint =
UpdateEndpointResponse
request :: UpdateEndpoint -> Request UpdateEndpoint
request = Service -> UpdateEndpoint -> Request UpdateEndpoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateEndpoint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateEndpoint))
-> Logger
-> Service
-> Proxy UpdateEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateEndpoint)))
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 -> UpdateEndpointResponse
UpdateEndpointResponse'
(Int -> MessageBody -> UpdateEndpointResponse)
-> Either String Int
-> Either String (MessageBody -> UpdateEndpointResponse)
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 -> UpdateEndpointResponse)
-> Either String MessageBody
-> Either String UpdateEndpointResponse
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 UpdateEndpoint
instance Prelude.NFData UpdateEndpoint
instance Core.ToHeaders UpdateEndpoint where
toHeaders :: UpdateEndpoint -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateEndpoint -> 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 UpdateEndpoint where
toJSON :: UpdateEndpoint -> Value
toJSON UpdateEndpoint' {Text
EndpointRequest
endpointRequest :: EndpointRequest
endpointId :: Text
applicationId :: Text
$sel:endpointRequest:UpdateEndpoint' :: UpdateEndpoint -> EndpointRequest
$sel:endpointId:UpdateEndpoint' :: UpdateEndpoint -> Text
$sel:applicationId:UpdateEndpoint' :: UpdateEndpoint -> 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
"EndpointRequest" Text -> EndpointRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EndpointRequest
endpointRequest)
]
)
instance Core.ToPath UpdateEndpoint where
toPath :: UpdateEndpoint -> ByteString
toPath UpdateEndpoint' {Text
EndpointRequest
endpointRequest :: EndpointRequest
endpointId :: Text
applicationId :: Text
$sel:endpointRequest:UpdateEndpoint' :: UpdateEndpoint -> EndpointRequest
$sel:endpointId:UpdateEndpoint' :: UpdateEndpoint -> Text
$sel:applicationId:UpdateEndpoint' :: UpdateEndpoint -> 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
"/endpoints/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
endpointId
]
instance Core.ToQuery UpdateEndpoint where
toQuery :: UpdateEndpoint -> QueryString
toQuery = QueryString -> UpdateEndpoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateEndpointResponse = UpdateEndpointResponse'
{
UpdateEndpointResponse -> Int
httpStatus :: Prelude.Int,
UpdateEndpointResponse -> MessageBody
messageBody :: MessageBody
}
deriving (UpdateEndpointResponse -> UpdateEndpointResponse -> Bool
(UpdateEndpointResponse -> UpdateEndpointResponse -> Bool)
-> (UpdateEndpointResponse -> UpdateEndpointResponse -> Bool)
-> Eq UpdateEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEndpointResponse -> UpdateEndpointResponse -> Bool
$c/= :: UpdateEndpointResponse -> UpdateEndpointResponse -> Bool
== :: UpdateEndpointResponse -> UpdateEndpointResponse -> Bool
$c== :: UpdateEndpointResponse -> UpdateEndpointResponse -> Bool
Prelude.Eq, ReadPrec [UpdateEndpointResponse]
ReadPrec UpdateEndpointResponse
Int -> ReadS UpdateEndpointResponse
ReadS [UpdateEndpointResponse]
(Int -> ReadS UpdateEndpointResponse)
-> ReadS [UpdateEndpointResponse]
-> ReadPrec UpdateEndpointResponse
-> ReadPrec [UpdateEndpointResponse]
-> Read UpdateEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEndpointResponse]
$creadListPrec :: ReadPrec [UpdateEndpointResponse]
readPrec :: ReadPrec UpdateEndpointResponse
$creadPrec :: ReadPrec UpdateEndpointResponse
readList :: ReadS [UpdateEndpointResponse]
$creadList :: ReadS [UpdateEndpointResponse]
readsPrec :: Int -> ReadS UpdateEndpointResponse
$creadsPrec :: Int -> ReadS UpdateEndpointResponse
Prelude.Read, Int -> UpdateEndpointResponse -> ShowS
[UpdateEndpointResponse] -> ShowS
UpdateEndpointResponse -> String
(Int -> UpdateEndpointResponse -> ShowS)
-> (UpdateEndpointResponse -> String)
-> ([UpdateEndpointResponse] -> ShowS)
-> Show UpdateEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEndpointResponse] -> ShowS
$cshowList :: [UpdateEndpointResponse] -> ShowS
show :: UpdateEndpointResponse -> String
$cshow :: UpdateEndpointResponse -> String
showsPrec :: Int -> UpdateEndpointResponse -> ShowS
$cshowsPrec :: Int -> UpdateEndpointResponse -> ShowS
Prelude.Show, (forall x. UpdateEndpointResponse -> Rep UpdateEndpointResponse x)
-> (forall x.
Rep UpdateEndpointResponse x -> UpdateEndpointResponse)
-> Generic UpdateEndpointResponse
forall x. Rep UpdateEndpointResponse x -> UpdateEndpointResponse
forall x. UpdateEndpointResponse -> Rep UpdateEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEndpointResponse x -> UpdateEndpointResponse
$cfrom :: forall x. UpdateEndpointResponse -> Rep UpdateEndpointResponse x
Prelude.Generic)
newUpdateEndpointResponse ::
Prelude.Int ->
MessageBody ->
UpdateEndpointResponse
newUpdateEndpointResponse :: Int -> MessageBody -> UpdateEndpointResponse
newUpdateEndpointResponse Int
pHttpStatus_ MessageBody
pMessageBody_ =
UpdateEndpointResponse' :: Int -> MessageBody -> UpdateEndpointResponse
UpdateEndpointResponse'
{ $sel:httpStatus:UpdateEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:messageBody:UpdateEndpointResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
}
updateEndpointResponse_httpStatus :: Lens.Lens' UpdateEndpointResponse Prelude.Int
updateEndpointResponse_httpStatus :: (Int -> f Int)
-> UpdateEndpointResponse -> f UpdateEndpointResponse
updateEndpointResponse_httpStatus = (UpdateEndpointResponse -> Int)
-> (UpdateEndpointResponse -> Int -> UpdateEndpointResponse)
-> Lens UpdateEndpointResponse UpdateEndpointResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateEndpointResponse' :: UpdateEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateEndpointResponse
s@UpdateEndpointResponse' {} Int
a -> UpdateEndpointResponse
s {$sel:httpStatus:UpdateEndpointResponse' :: Int
httpStatus = Int
a} :: UpdateEndpointResponse)
updateEndpointResponse_messageBody :: Lens.Lens' UpdateEndpointResponse MessageBody
updateEndpointResponse_messageBody :: (MessageBody -> f MessageBody)
-> UpdateEndpointResponse -> f UpdateEndpointResponse
updateEndpointResponse_messageBody = (UpdateEndpointResponse -> MessageBody)
-> (UpdateEndpointResponse
-> MessageBody -> UpdateEndpointResponse)
-> Lens
UpdateEndpointResponse
UpdateEndpointResponse
MessageBody
MessageBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:UpdateEndpointResponse' :: UpdateEndpointResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: UpdateEndpointResponse
s@UpdateEndpointResponse' {} MessageBody
a -> UpdateEndpointResponse
s {$sel:messageBody:UpdateEndpointResponse' :: MessageBody
messageBody = MessageBody
a} :: UpdateEndpointResponse)
instance Prelude.NFData UpdateEndpointResponse