{-# 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.UpdateJourneyState
(
UpdateJourneyState (..),
newUpdateJourneyState,
updateJourneyState_journeyId,
updateJourneyState_applicationId,
updateJourneyState_journeyStateRequest,
UpdateJourneyStateResponse (..),
newUpdateJourneyStateResponse,
updateJourneyStateResponse_httpStatus,
updateJourneyStateResponse_journeyResponse,
)
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 UpdateJourneyState = UpdateJourneyState'
{
UpdateJourneyState -> Text
journeyId :: Prelude.Text,
UpdateJourneyState -> Text
applicationId :: Prelude.Text,
UpdateJourneyState -> JourneyStateRequest
journeyStateRequest :: JourneyStateRequest
}
deriving (UpdateJourneyState -> UpdateJourneyState -> Bool
(UpdateJourneyState -> UpdateJourneyState -> Bool)
-> (UpdateJourneyState -> UpdateJourneyState -> Bool)
-> Eq UpdateJourneyState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateJourneyState -> UpdateJourneyState -> Bool
$c/= :: UpdateJourneyState -> UpdateJourneyState -> Bool
== :: UpdateJourneyState -> UpdateJourneyState -> Bool
$c== :: UpdateJourneyState -> UpdateJourneyState -> Bool
Prelude.Eq, ReadPrec [UpdateJourneyState]
ReadPrec UpdateJourneyState
Int -> ReadS UpdateJourneyState
ReadS [UpdateJourneyState]
(Int -> ReadS UpdateJourneyState)
-> ReadS [UpdateJourneyState]
-> ReadPrec UpdateJourneyState
-> ReadPrec [UpdateJourneyState]
-> Read UpdateJourneyState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateJourneyState]
$creadListPrec :: ReadPrec [UpdateJourneyState]
readPrec :: ReadPrec UpdateJourneyState
$creadPrec :: ReadPrec UpdateJourneyState
readList :: ReadS [UpdateJourneyState]
$creadList :: ReadS [UpdateJourneyState]
readsPrec :: Int -> ReadS UpdateJourneyState
$creadsPrec :: Int -> ReadS UpdateJourneyState
Prelude.Read, Int -> UpdateJourneyState -> ShowS
[UpdateJourneyState] -> ShowS
UpdateJourneyState -> String
(Int -> UpdateJourneyState -> ShowS)
-> (UpdateJourneyState -> String)
-> ([UpdateJourneyState] -> ShowS)
-> Show UpdateJourneyState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateJourneyState] -> ShowS
$cshowList :: [UpdateJourneyState] -> ShowS
show :: UpdateJourneyState -> String
$cshow :: UpdateJourneyState -> String
showsPrec :: Int -> UpdateJourneyState -> ShowS
$cshowsPrec :: Int -> UpdateJourneyState -> ShowS
Prelude.Show, (forall x. UpdateJourneyState -> Rep UpdateJourneyState x)
-> (forall x. Rep UpdateJourneyState x -> UpdateJourneyState)
-> Generic UpdateJourneyState
forall x. Rep UpdateJourneyState x -> UpdateJourneyState
forall x. UpdateJourneyState -> Rep UpdateJourneyState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateJourneyState x -> UpdateJourneyState
$cfrom :: forall x. UpdateJourneyState -> Rep UpdateJourneyState x
Prelude.Generic)
newUpdateJourneyState ::
Prelude.Text ->
Prelude.Text ->
JourneyStateRequest ->
UpdateJourneyState
newUpdateJourneyState :: Text -> Text -> JourneyStateRequest -> UpdateJourneyState
newUpdateJourneyState
Text
pJourneyId_
Text
pApplicationId_
JourneyStateRequest
pJourneyStateRequest_ =
UpdateJourneyState' :: Text -> Text -> JourneyStateRequest -> UpdateJourneyState
UpdateJourneyState'
{ $sel:journeyId:UpdateJourneyState' :: Text
journeyId = Text
pJourneyId_,
$sel:applicationId:UpdateJourneyState' :: Text
applicationId = Text
pApplicationId_,
$sel:journeyStateRequest:UpdateJourneyState' :: JourneyStateRequest
journeyStateRequest = JourneyStateRequest
pJourneyStateRequest_
}
updateJourneyState_journeyId :: Lens.Lens' UpdateJourneyState Prelude.Text
updateJourneyState_journeyId :: (Text -> f Text) -> UpdateJourneyState -> f UpdateJourneyState
updateJourneyState_journeyId = (UpdateJourneyState -> Text)
-> (UpdateJourneyState -> Text -> UpdateJourneyState)
-> Lens UpdateJourneyState UpdateJourneyState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJourneyState' {Text
journeyId :: Text
$sel:journeyId:UpdateJourneyState' :: UpdateJourneyState -> Text
journeyId} -> Text
journeyId) (\s :: UpdateJourneyState
s@UpdateJourneyState' {} Text
a -> UpdateJourneyState
s {$sel:journeyId:UpdateJourneyState' :: Text
journeyId = Text
a} :: UpdateJourneyState)
updateJourneyState_applicationId :: Lens.Lens' UpdateJourneyState Prelude.Text
updateJourneyState_applicationId :: (Text -> f Text) -> UpdateJourneyState -> f UpdateJourneyState
updateJourneyState_applicationId = (UpdateJourneyState -> Text)
-> (UpdateJourneyState -> Text -> UpdateJourneyState)
-> Lens UpdateJourneyState UpdateJourneyState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJourneyState' {Text
applicationId :: Text
$sel:applicationId:UpdateJourneyState' :: UpdateJourneyState -> Text
applicationId} -> Text
applicationId) (\s :: UpdateJourneyState
s@UpdateJourneyState' {} Text
a -> UpdateJourneyState
s {$sel:applicationId:UpdateJourneyState' :: Text
applicationId = Text
a} :: UpdateJourneyState)
updateJourneyState_journeyStateRequest :: Lens.Lens' UpdateJourneyState JourneyStateRequest
updateJourneyState_journeyStateRequest :: (JourneyStateRequest -> f JourneyStateRequest)
-> UpdateJourneyState -> f UpdateJourneyState
updateJourneyState_journeyStateRequest = (UpdateJourneyState -> JourneyStateRequest)
-> (UpdateJourneyState
-> JourneyStateRequest -> UpdateJourneyState)
-> Lens
UpdateJourneyState
UpdateJourneyState
JourneyStateRequest
JourneyStateRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJourneyState' {JourneyStateRequest
journeyStateRequest :: JourneyStateRequest
$sel:journeyStateRequest:UpdateJourneyState' :: UpdateJourneyState -> JourneyStateRequest
journeyStateRequest} -> JourneyStateRequest
journeyStateRequest) (\s :: UpdateJourneyState
s@UpdateJourneyState' {} JourneyStateRequest
a -> UpdateJourneyState
s {$sel:journeyStateRequest:UpdateJourneyState' :: JourneyStateRequest
journeyStateRequest = JourneyStateRequest
a} :: UpdateJourneyState)
instance Core.AWSRequest UpdateJourneyState where
type
AWSResponse UpdateJourneyState =
UpdateJourneyStateResponse
request :: UpdateJourneyState -> Request UpdateJourneyState
request = Service -> UpdateJourneyState -> Request UpdateJourneyState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateJourneyState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateJourneyState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateJourneyState))
-> Logger
-> Service
-> Proxy UpdateJourneyState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateJourneyState)))
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 -> JourneyResponse -> UpdateJourneyStateResponse
UpdateJourneyStateResponse'
(Int -> JourneyResponse -> UpdateJourneyStateResponse)
-> Either String Int
-> Either String (JourneyResponse -> UpdateJourneyStateResponse)
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 (JourneyResponse -> UpdateJourneyStateResponse)
-> Either String JourneyResponse
-> Either String UpdateJourneyStateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String JourneyResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable UpdateJourneyState
instance Prelude.NFData UpdateJourneyState
instance Core.ToHeaders UpdateJourneyState where
toHeaders :: UpdateJourneyState -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateJourneyState -> 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 UpdateJourneyState where
toJSON :: UpdateJourneyState -> Value
toJSON UpdateJourneyState' {Text
JourneyStateRequest
journeyStateRequest :: JourneyStateRequest
applicationId :: Text
journeyId :: Text
$sel:journeyStateRequest:UpdateJourneyState' :: UpdateJourneyState -> JourneyStateRequest
$sel:applicationId:UpdateJourneyState' :: UpdateJourneyState -> Text
$sel:journeyId:UpdateJourneyState' :: UpdateJourneyState -> 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
"JourneyStateRequest" Text -> JourneyStateRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= JourneyStateRequest
journeyStateRequest)
]
)
instance Core.ToPath UpdateJourneyState where
toPath :: UpdateJourneyState -> ByteString
toPath UpdateJourneyState' {Text
JourneyStateRequest
journeyStateRequest :: JourneyStateRequest
applicationId :: Text
journeyId :: Text
$sel:journeyStateRequest:UpdateJourneyState' :: UpdateJourneyState -> JourneyStateRequest
$sel:applicationId:UpdateJourneyState' :: UpdateJourneyState -> Text
$sel:journeyId:UpdateJourneyState' :: UpdateJourneyState -> 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
"/journeys/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
journeyId,
ByteString
"/state"
]
instance Core.ToQuery UpdateJourneyState where
toQuery :: UpdateJourneyState -> QueryString
toQuery = QueryString -> UpdateJourneyState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateJourneyStateResponse = UpdateJourneyStateResponse'
{
UpdateJourneyStateResponse -> Int
httpStatus :: Prelude.Int,
UpdateJourneyStateResponse -> JourneyResponse
journeyResponse :: JourneyResponse
}
deriving (UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool
(UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool)
-> (UpdateJourneyStateResponse
-> UpdateJourneyStateResponse -> Bool)
-> Eq UpdateJourneyStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool
$c/= :: UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool
== :: UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool
$c== :: UpdateJourneyStateResponse -> UpdateJourneyStateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateJourneyStateResponse]
ReadPrec UpdateJourneyStateResponse
Int -> ReadS UpdateJourneyStateResponse
ReadS [UpdateJourneyStateResponse]
(Int -> ReadS UpdateJourneyStateResponse)
-> ReadS [UpdateJourneyStateResponse]
-> ReadPrec UpdateJourneyStateResponse
-> ReadPrec [UpdateJourneyStateResponse]
-> Read UpdateJourneyStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateJourneyStateResponse]
$creadListPrec :: ReadPrec [UpdateJourneyStateResponse]
readPrec :: ReadPrec UpdateJourneyStateResponse
$creadPrec :: ReadPrec UpdateJourneyStateResponse
readList :: ReadS [UpdateJourneyStateResponse]
$creadList :: ReadS [UpdateJourneyStateResponse]
readsPrec :: Int -> ReadS UpdateJourneyStateResponse
$creadsPrec :: Int -> ReadS UpdateJourneyStateResponse
Prelude.Read, Int -> UpdateJourneyStateResponse -> ShowS
[UpdateJourneyStateResponse] -> ShowS
UpdateJourneyStateResponse -> String
(Int -> UpdateJourneyStateResponse -> ShowS)
-> (UpdateJourneyStateResponse -> String)
-> ([UpdateJourneyStateResponse] -> ShowS)
-> Show UpdateJourneyStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateJourneyStateResponse] -> ShowS
$cshowList :: [UpdateJourneyStateResponse] -> ShowS
show :: UpdateJourneyStateResponse -> String
$cshow :: UpdateJourneyStateResponse -> String
showsPrec :: Int -> UpdateJourneyStateResponse -> ShowS
$cshowsPrec :: Int -> UpdateJourneyStateResponse -> ShowS
Prelude.Show, (forall x.
UpdateJourneyStateResponse -> Rep UpdateJourneyStateResponse x)
-> (forall x.
Rep UpdateJourneyStateResponse x -> UpdateJourneyStateResponse)
-> Generic UpdateJourneyStateResponse
forall x.
Rep UpdateJourneyStateResponse x -> UpdateJourneyStateResponse
forall x.
UpdateJourneyStateResponse -> Rep UpdateJourneyStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateJourneyStateResponse x -> UpdateJourneyStateResponse
$cfrom :: forall x.
UpdateJourneyStateResponse -> Rep UpdateJourneyStateResponse x
Prelude.Generic)
newUpdateJourneyStateResponse ::
Prelude.Int ->
JourneyResponse ->
UpdateJourneyStateResponse
newUpdateJourneyStateResponse :: Int -> JourneyResponse -> UpdateJourneyStateResponse
newUpdateJourneyStateResponse
Int
pHttpStatus_
JourneyResponse
pJourneyResponse_ =
UpdateJourneyStateResponse' :: Int -> JourneyResponse -> UpdateJourneyStateResponse
UpdateJourneyStateResponse'
{ $sel:httpStatus:UpdateJourneyStateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:journeyResponse:UpdateJourneyStateResponse' :: JourneyResponse
journeyResponse = JourneyResponse
pJourneyResponse_
}
updateJourneyStateResponse_httpStatus :: Lens.Lens' UpdateJourneyStateResponse Prelude.Int
updateJourneyStateResponse_httpStatus :: (Int -> f Int)
-> UpdateJourneyStateResponse -> f UpdateJourneyStateResponse
updateJourneyStateResponse_httpStatus = (UpdateJourneyStateResponse -> Int)
-> (UpdateJourneyStateResponse
-> Int -> UpdateJourneyStateResponse)
-> Lens
UpdateJourneyStateResponse UpdateJourneyStateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJourneyStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateJourneyStateResponse' :: UpdateJourneyStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateJourneyStateResponse
s@UpdateJourneyStateResponse' {} Int
a -> UpdateJourneyStateResponse
s {$sel:httpStatus:UpdateJourneyStateResponse' :: Int
httpStatus = Int
a} :: UpdateJourneyStateResponse)
updateJourneyStateResponse_journeyResponse :: Lens.Lens' UpdateJourneyStateResponse JourneyResponse
updateJourneyStateResponse_journeyResponse :: (JourneyResponse -> f JourneyResponse)
-> UpdateJourneyStateResponse -> f UpdateJourneyStateResponse
updateJourneyStateResponse_journeyResponse = (UpdateJourneyStateResponse -> JourneyResponse)
-> (UpdateJourneyStateResponse
-> JourneyResponse -> UpdateJourneyStateResponse)
-> Lens
UpdateJourneyStateResponse
UpdateJourneyStateResponse
JourneyResponse
JourneyResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJourneyStateResponse' {JourneyResponse
journeyResponse :: JourneyResponse
$sel:journeyResponse:UpdateJourneyStateResponse' :: UpdateJourneyStateResponse -> JourneyResponse
journeyResponse} -> JourneyResponse
journeyResponse) (\s :: UpdateJourneyStateResponse
s@UpdateJourneyStateResponse' {} JourneyResponse
a -> UpdateJourneyStateResponse
s {$sel:journeyResponse:UpdateJourneyStateResponse' :: JourneyResponse
journeyResponse = JourneyResponse
a} :: UpdateJourneyStateResponse)
instance Prelude.NFData UpdateJourneyStateResponse