{-# 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.StepFunctions.StartExecution
(
StartExecution (..),
newStartExecution,
startExecution_input,
startExecution_name,
startExecution_traceHeader,
startExecution_stateMachineArn,
StartExecutionResponse (..),
newStartExecutionResponse,
startExecutionResponse_httpStatus,
startExecutionResponse_executionArn,
startExecutionResponse_startDate,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StepFunctions.Types
data StartExecution = StartExecution'
{
StartExecution -> Maybe (Sensitive Text)
input :: Prelude.Maybe (Core.Sensitive Prelude.Text),
StartExecution -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Text,
StartExecution -> Text
stateMachineArn :: Prelude.Text
}
deriving (StartExecution -> StartExecution -> Bool
(StartExecution -> StartExecution -> Bool)
-> (StartExecution -> StartExecution -> Bool) -> Eq StartExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartExecution -> StartExecution -> Bool
$c/= :: StartExecution -> StartExecution -> Bool
== :: StartExecution -> StartExecution -> Bool
$c== :: StartExecution -> StartExecution -> Bool
Prelude.Eq, Int -> StartExecution -> ShowS
[StartExecution] -> ShowS
StartExecution -> String
(Int -> StartExecution -> ShowS)
-> (StartExecution -> String)
-> ([StartExecution] -> ShowS)
-> Show StartExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartExecution] -> ShowS
$cshowList :: [StartExecution] -> ShowS
show :: StartExecution -> String
$cshow :: StartExecution -> String
showsPrec :: Int -> StartExecution -> ShowS
$cshowsPrec :: Int -> StartExecution -> ShowS
Prelude.Show, (forall x. StartExecution -> Rep StartExecution x)
-> (forall x. Rep StartExecution x -> StartExecution)
-> Generic StartExecution
forall x. Rep StartExecution x -> StartExecution
forall x. StartExecution -> Rep StartExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartExecution x -> StartExecution
$cfrom :: forall x. StartExecution -> Rep StartExecution x
Prelude.Generic)
newStartExecution ::
Prelude.Text ->
StartExecution
newStartExecution :: Text -> StartExecution
newStartExecution Text
pStateMachineArn_ =
StartExecution' :: Maybe (Sensitive Text)
-> Maybe Text -> Maybe Text -> Text -> StartExecution
StartExecution'
{ $sel:input:StartExecution' :: Maybe (Sensitive Text)
input = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:name:StartExecution' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:traceHeader:StartExecution' :: Maybe Text
traceHeader = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stateMachineArn:StartExecution' :: Text
stateMachineArn = Text
pStateMachineArn_
}
startExecution_input :: Lens.Lens' StartExecution (Prelude.Maybe Prelude.Text)
startExecution_input :: (Maybe Text -> f (Maybe Text))
-> StartExecution -> f StartExecution
startExecution_input = (StartExecution -> Maybe (Sensitive Text))
-> (StartExecution -> Maybe (Sensitive Text) -> StartExecution)
-> Lens
StartExecution
StartExecution
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecution' {Maybe (Sensitive Text)
input :: Maybe (Sensitive Text)
$sel:input:StartExecution' :: StartExecution -> Maybe (Sensitive Text)
input} -> Maybe (Sensitive Text)
input) (\s :: StartExecution
s@StartExecution' {} Maybe (Sensitive Text)
a -> StartExecution
s {$sel:input:StartExecution' :: Maybe (Sensitive Text)
input = Maybe (Sensitive Text)
a} :: StartExecution) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> StartExecution -> f StartExecution)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StartExecution
-> f StartExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
startExecution_name :: Lens.Lens' StartExecution (Prelude.Maybe Prelude.Text)
startExecution_name :: (Maybe Text -> f (Maybe Text))
-> StartExecution -> f StartExecution
startExecution_name = (StartExecution -> Maybe Text)
-> (StartExecution -> Maybe Text -> StartExecution)
-> Lens StartExecution StartExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecution' {Maybe Text
name :: Maybe Text
$sel:name:StartExecution' :: StartExecution -> Maybe Text
name} -> Maybe Text
name) (\s :: StartExecution
s@StartExecution' {} Maybe Text
a -> StartExecution
s {$sel:name:StartExecution' :: Maybe Text
name = Maybe Text
a} :: StartExecution)
startExecution_traceHeader :: Lens.Lens' StartExecution (Prelude.Maybe Prelude.Text)
= (StartExecution -> Maybe Text)
-> (StartExecution -> Maybe Text -> StartExecution)
-> Lens StartExecution StartExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecution' {Maybe Text
traceHeader :: Maybe Text
$sel:traceHeader:StartExecution' :: StartExecution -> Maybe Text
traceHeader} -> Maybe Text
traceHeader) (\s :: StartExecution
s@StartExecution' {} Maybe Text
a -> StartExecution
s {$sel:traceHeader:StartExecution' :: Maybe Text
traceHeader = Maybe Text
a} :: StartExecution)
startExecution_stateMachineArn :: Lens.Lens' StartExecution Prelude.Text
startExecution_stateMachineArn :: (Text -> f Text) -> StartExecution -> f StartExecution
startExecution_stateMachineArn = (StartExecution -> Text)
-> (StartExecution -> Text -> StartExecution)
-> Lens StartExecution StartExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecution' {Text
stateMachineArn :: Text
$sel:stateMachineArn:StartExecution' :: StartExecution -> Text
stateMachineArn} -> Text
stateMachineArn) (\s :: StartExecution
s@StartExecution' {} Text
a -> StartExecution
s {$sel:stateMachineArn:StartExecution' :: Text
stateMachineArn = Text
a} :: StartExecution)
instance Core.AWSRequest StartExecution where
type
AWSResponse StartExecution =
StartExecutionResponse
request :: StartExecution -> Request StartExecution
request = Service -> StartExecution -> Request StartExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartExecution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartExecution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartExecution))
-> Logger
-> Service
-> Proxy StartExecution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartExecution)))
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 -> Text -> POSIX -> StartExecutionResponse
StartExecutionResponse'
(Int -> Text -> POSIX -> StartExecutionResponse)
-> Either String Int
-> Either String (Text -> POSIX -> StartExecutionResponse)
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 (Text -> POSIX -> StartExecutionResponse)
-> Either String Text
-> Either String (POSIX -> StartExecutionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"executionArn")
Either String (POSIX -> StartExecutionResponse)
-> Either String POSIX -> Either String StartExecutionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String POSIX
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"startDate")
)
instance Prelude.Hashable StartExecution
instance Prelude.NFData StartExecution
instance Core.ToHeaders StartExecution where
toHeaders :: StartExecution -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartExecution -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSStepFunctions.StartExecution" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON StartExecution where
toJSON :: StartExecution -> Value
toJSON StartExecution' {Maybe Text
Maybe (Sensitive Text)
Text
stateMachineArn :: Text
traceHeader :: Maybe Text
name :: Maybe Text
input :: Maybe (Sensitive Text)
$sel:stateMachineArn:StartExecution' :: StartExecution -> Text
$sel:traceHeader:StartExecution' :: StartExecution -> Maybe Text
$sel:name:StartExecution' :: StartExecution -> Maybe Text
$sel:input:StartExecution' :: StartExecution -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"input" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
input,
(Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"traceHeader" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
traceHeader,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"stateMachineArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stateMachineArn)
]
)
instance Core.ToPath StartExecution where
toPath :: StartExecution -> ByteString
toPath = ByteString -> StartExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartExecution where
toQuery :: StartExecution -> QueryString
toQuery = QueryString -> StartExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartExecutionResponse = StartExecutionResponse'
{
StartExecutionResponse -> Int
httpStatus :: Prelude.Int,
StartExecutionResponse -> Text
executionArn :: Prelude.Text,
StartExecutionResponse -> POSIX
startDate :: Core.POSIX
}
deriving (StartExecutionResponse -> StartExecutionResponse -> Bool
(StartExecutionResponse -> StartExecutionResponse -> Bool)
-> (StartExecutionResponse -> StartExecutionResponse -> Bool)
-> Eq StartExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartExecutionResponse -> StartExecutionResponse -> Bool
$c/= :: StartExecutionResponse -> StartExecutionResponse -> Bool
== :: StartExecutionResponse -> StartExecutionResponse -> Bool
$c== :: StartExecutionResponse -> StartExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StartExecutionResponse]
ReadPrec StartExecutionResponse
Int -> ReadS StartExecutionResponse
ReadS [StartExecutionResponse]
(Int -> ReadS StartExecutionResponse)
-> ReadS [StartExecutionResponse]
-> ReadPrec StartExecutionResponse
-> ReadPrec [StartExecutionResponse]
-> Read StartExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartExecutionResponse]
$creadListPrec :: ReadPrec [StartExecutionResponse]
readPrec :: ReadPrec StartExecutionResponse
$creadPrec :: ReadPrec StartExecutionResponse
readList :: ReadS [StartExecutionResponse]
$creadList :: ReadS [StartExecutionResponse]
readsPrec :: Int -> ReadS StartExecutionResponse
$creadsPrec :: Int -> ReadS StartExecutionResponse
Prelude.Read, Int -> StartExecutionResponse -> ShowS
[StartExecutionResponse] -> ShowS
StartExecutionResponse -> String
(Int -> StartExecutionResponse -> ShowS)
-> (StartExecutionResponse -> String)
-> ([StartExecutionResponse] -> ShowS)
-> Show StartExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartExecutionResponse] -> ShowS
$cshowList :: [StartExecutionResponse] -> ShowS
show :: StartExecutionResponse -> String
$cshow :: StartExecutionResponse -> String
showsPrec :: Int -> StartExecutionResponse -> ShowS
$cshowsPrec :: Int -> StartExecutionResponse -> ShowS
Prelude.Show, (forall x. StartExecutionResponse -> Rep StartExecutionResponse x)
-> (forall x.
Rep StartExecutionResponse x -> StartExecutionResponse)
-> Generic StartExecutionResponse
forall x. Rep StartExecutionResponse x -> StartExecutionResponse
forall x. StartExecutionResponse -> Rep StartExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartExecutionResponse x -> StartExecutionResponse
$cfrom :: forall x. StartExecutionResponse -> Rep StartExecutionResponse x
Prelude.Generic)
newStartExecutionResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.UTCTime ->
StartExecutionResponse
newStartExecutionResponse :: Int -> Text -> UTCTime -> StartExecutionResponse
newStartExecutionResponse
Int
pHttpStatus_
Text
pExecutionArn_
UTCTime
pStartDate_ =
StartExecutionResponse' :: Int -> Text -> POSIX -> StartExecutionResponse
StartExecutionResponse'
{ $sel:httpStatus:StartExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:executionArn:StartExecutionResponse' :: Text
executionArn = Text
pExecutionArn_,
$sel:startDate:StartExecutionResponse' :: POSIX
startDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartDate_
}
startExecutionResponse_httpStatus :: Lens.Lens' StartExecutionResponse Prelude.Int
startExecutionResponse_httpStatus :: (Int -> f Int)
-> StartExecutionResponse -> f StartExecutionResponse
startExecutionResponse_httpStatus = (StartExecutionResponse -> Int)
-> (StartExecutionResponse -> Int -> StartExecutionResponse)
-> Lens StartExecutionResponse StartExecutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartExecutionResponse' :: StartExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartExecutionResponse
s@StartExecutionResponse' {} Int
a -> StartExecutionResponse
s {$sel:httpStatus:StartExecutionResponse' :: Int
httpStatus = Int
a} :: StartExecutionResponse)
startExecutionResponse_executionArn :: Lens.Lens' StartExecutionResponse Prelude.Text
startExecutionResponse_executionArn :: (Text -> f Text)
-> StartExecutionResponse -> f StartExecutionResponse
startExecutionResponse_executionArn = (StartExecutionResponse -> Text)
-> (StartExecutionResponse -> Text -> StartExecutionResponse)
-> Lens StartExecutionResponse StartExecutionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecutionResponse' {Text
executionArn :: Text
$sel:executionArn:StartExecutionResponse' :: StartExecutionResponse -> Text
executionArn} -> Text
executionArn) (\s :: StartExecutionResponse
s@StartExecutionResponse' {} Text
a -> StartExecutionResponse
s {$sel:executionArn:StartExecutionResponse' :: Text
executionArn = Text
a} :: StartExecutionResponse)
startExecutionResponse_startDate :: Lens.Lens' StartExecutionResponse Prelude.UTCTime
startExecutionResponse_startDate :: (UTCTime -> f UTCTime)
-> StartExecutionResponse -> f StartExecutionResponse
startExecutionResponse_startDate = (StartExecutionResponse -> POSIX)
-> (StartExecutionResponse -> POSIX -> StartExecutionResponse)
-> Lens StartExecutionResponse StartExecutionResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartExecutionResponse' {POSIX
startDate :: POSIX
$sel:startDate:StartExecutionResponse' :: StartExecutionResponse -> POSIX
startDate} -> POSIX
startDate) (\s :: StartExecutionResponse
s@StartExecutionResponse' {} POSIX
a -> StartExecutionResponse
s {$sel:startDate:StartExecutionResponse' :: POSIX
startDate = POSIX
a} :: StartExecutionResponse) ((POSIX -> f POSIX)
-> StartExecutionResponse -> f StartExecutionResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> StartExecutionResponse
-> f StartExecutionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.NFData StartExecutionResponse