{-# 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.StopExecution
(
StopExecution (..),
newStopExecution,
stopExecution_error,
stopExecution_cause,
stopExecution_executionArn,
StopExecutionResponse (..),
newStopExecutionResponse,
stopExecutionResponse_httpStatus,
stopExecutionResponse_stopDate,
)
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 StopExecution = StopExecution'
{
StopExecution -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Core.Sensitive Prelude.Text),
StopExecution -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Core.Sensitive Prelude.Text),
StopExecution -> Text
executionArn :: Prelude.Text
}
deriving (StopExecution -> StopExecution -> Bool
(StopExecution -> StopExecution -> Bool)
-> (StopExecution -> StopExecution -> Bool) -> Eq StopExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopExecution -> StopExecution -> Bool
$c/= :: StopExecution -> StopExecution -> Bool
== :: StopExecution -> StopExecution -> Bool
$c== :: StopExecution -> StopExecution -> Bool
Prelude.Eq, Int -> StopExecution -> ShowS
[StopExecution] -> ShowS
StopExecution -> String
(Int -> StopExecution -> ShowS)
-> (StopExecution -> String)
-> ([StopExecution] -> ShowS)
-> Show StopExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopExecution] -> ShowS
$cshowList :: [StopExecution] -> ShowS
show :: StopExecution -> String
$cshow :: StopExecution -> String
showsPrec :: Int -> StopExecution -> ShowS
$cshowsPrec :: Int -> StopExecution -> ShowS
Prelude.Show, (forall x. StopExecution -> Rep StopExecution x)
-> (forall x. Rep StopExecution x -> StopExecution)
-> Generic StopExecution
forall x. Rep StopExecution x -> StopExecution
forall x. StopExecution -> Rep StopExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopExecution x -> StopExecution
$cfrom :: forall x. StopExecution -> Rep StopExecution x
Prelude.Generic)
newStopExecution ::
Prelude.Text ->
StopExecution
newStopExecution :: Text -> StopExecution
newStopExecution Text
pExecutionArn_ =
StopExecution' :: Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> Text -> StopExecution
StopExecution'
{ $sel:error:StopExecution' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:cause:StopExecution' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:executionArn:StopExecution' :: Text
executionArn = Text
pExecutionArn_
}
stopExecution_error :: Lens.Lens' StopExecution (Prelude.Maybe Prelude.Text)
stopExecution_error :: (Maybe Text -> f (Maybe Text)) -> StopExecution -> f StopExecution
stopExecution_error = (StopExecution -> Maybe (Sensitive Text))
-> (StopExecution -> Maybe (Sensitive Text) -> StopExecution)
-> Lens
StopExecution
StopExecution
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecution' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:error:StopExecution' :: StopExecution -> Maybe (Sensitive Text)
error} -> Maybe (Sensitive Text)
error) (\s :: StopExecution
s@StopExecution' {} Maybe (Sensitive Text)
a -> StopExecution
s {$sel:error:StopExecution' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
a} :: StopExecution) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> StopExecution -> f StopExecution)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StopExecution
-> f StopExecution
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
stopExecution_cause :: Lens.Lens' StopExecution (Prelude.Maybe Prelude.Text)
stopExecution_cause :: (Maybe Text -> f (Maybe Text)) -> StopExecution -> f StopExecution
stopExecution_cause = (StopExecution -> Maybe (Sensitive Text))
-> (StopExecution -> Maybe (Sensitive Text) -> StopExecution)
-> Lens
StopExecution
StopExecution
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecution' {Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:cause:StopExecution' :: StopExecution -> Maybe (Sensitive Text)
cause} -> Maybe (Sensitive Text)
cause) (\s :: StopExecution
s@StopExecution' {} Maybe (Sensitive Text)
a -> StopExecution
s {$sel:cause:StopExecution' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
a} :: StopExecution) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> StopExecution -> f StopExecution)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StopExecution
-> f StopExecution
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
stopExecution_executionArn :: Lens.Lens' StopExecution Prelude.Text
stopExecution_executionArn :: (Text -> f Text) -> StopExecution -> f StopExecution
stopExecution_executionArn = (StopExecution -> Text)
-> (StopExecution -> Text -> StopExecution)
-> Lens StopExecution StopExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecution' {Text
executionArn :: Text
$sel:executionArn:StopExecution' :: StopExecution -> Text
executionArn} -> Text
executionArn) (\s :: StopExecution
s@StopExecution' {} Text
a -> StopExecution
s {$sel:executionArn:StopExecution' :: Text
executionArn = Text
a} :: StopExecution)
instance Core.AWSRequest StopExecution where
type
AWSResponse StopExecution =
StopExecutionResponse
request :: StopExecution -> Request StopExecution
request = Service -> StopExecution -> Request StopExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopExecution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopExecution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopExecution))
-> Logger
-> Service
-> Proxy StopExecution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopExecution)))
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 -> POSIX -> StopExecutionResponse
StopExecutionResponse'
(Int -> POSIX -> StopExecutionResponse)
-> Either String Int
-> Either String (POSIX -> StopExecutionResponse)
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 (POSIX -> StopExecutionResponse)
-> Either String POSIX -> Either String StopExecutionResponse
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
"stopDate")
)
instance Prelude.Hashable StopExecution
instance Prelude.NFData StopExecution
instance Core.ToHeaders StopExecution where
toHeaders :: StopExecution -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopExecution -> 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.StopExecution" ::
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 StopExecution where
toJSON :: StopExecution -> Value
toJSON StopExecution' {Maybe (Sensitive Text)
Text
executionArn :: Text
cause :: Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:executionArn:StopExecution' :: StopExecution -> Text
$sel:cause:StopExecution' :: StopExecution -> Maybe (Sensitive Text)
$sel:error:StopExecution' :: StopExecution -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"error" 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)
error,
(Text
"cause" 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)
cause,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"executionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionArn)
]
)
instance Core.ToPath StopExecution where
toPath :: StopExecution -> ByteString
toPath = ByteString -> StopExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopExecution where
toQuery :: StopExecution -> QueryString
toQuery = QueryString -> StopExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopExecutionResponse = StopExecutionResponse'
{
StopExecutionResponse -> Int
httpStatus :: Prelude.Int,
StopExecutionResponse -> POSIX
stopDate :: Core.POSIX
}
deriving (StopExecutionResponse -> StopExecutionResponse -> Bool
(StopExecutionResponse -> StopExecutionResponse -> Bool)
-> (StopExecutionResponse -> StopExecutionResponse -> Bool)
-> Eq StopExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopExecutionResponse -> StopExecutionResponse -> Bool
$c/= :: StopExecutionResponse -> StopExecutionResponse -> Bool
== :: StopExecutionResponse -> StopExecutionResponse -> Bool
$c== :: StopExecutionResponse -> StopExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StopExecutionResponse]
ReadPrec StopExecutionResponse
Int -> ReadS StopExecutionResponse
ReadS [StopExecutionResponse]
(Int -> ReadS StopExecutionResponse)
-> ReadS [StopExecutionResponse]
-> ReadPrec StopExecutionResponse
-> ReadPrec [StopExecutionResponse]
-> Read StopExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopExecutionResponse]
$creadListPrec :: ReadPrec [StopExecutionResponse]
readPrec :: ReadPrec StopExecutionResponse
$creadPrec :: ReadPrec StopExecutionResponse
readList :: ReadS [StopExecutionResponse]
$creadList :: ReadS [StopExecutionResponse]
readsPrec :: Int -> ReadS StopExecutionResponse
$creadsPrec :: Int -> ReadS StopExecutionResponse
Prelude.Read, Int -> StopExecutionResponse -> ShowS
[StopExecutionResponse] -> ShowS
StopExecutionResponse -> String
(Int -> StopExecutionResponse -> ShowS)
-> (StopExecutionResponse -> String)
-> ([StopExecutionResponse] -> ShowS)
-> Show StopExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopExecutionResponse] -> ShowS
$cshowList :: [StopExecutionResponse] -> ShowS
show :: StopExecutionResponse -> String
$cshow :: StopExecutionResponse -> String
showsPrec :: Int -> StopExecutionResponse -> ShowS
$cshowsPrec :: Int -> StopExecutionResponse -> ShowS
Prelude.Show, (forall x. StopExecutionResponse -> Rep StopExecutionResponse x)
-> (forall x. Rep StopExecutionResponse x -> StopExecutionResponse)
-> Generic StopExecutionResponse
forall x. Rep StopExecutionResponse x -> StopExecutionResponse
forall x. StopExecutionResponse -> Rep StopExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopExecutionResponse x -> StopExecutionResponse
$cfrom :: forall x. StopExecutionResponse -> Rep StopExecutionResponse x
Prelude.Generic)
newStopExecutionResponse ::
Prelude.Int ->
Prelude.UTCTime ->
StopExecutionResponse
newStopExecutionResponse :: Int -> UTCTime -> StopExecutionResponse
newStopExecutionResponse Int
pHttpStatus_ UTCTime
pStopDate_ =
StopExecutionResponse' :: Int -> POSIX -> StopExecutionResponse
StopExecutionResponse'
{ $sel:httpStatus:StopExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:stopDate:StopExecutionResponse' :: POSIX
stopDate = 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
pStopDate_
}
stopExecutionResponse_httpStatus :: Lens.Lens' StopExecutionResponse Prelude.Int
stopExecutionResponse_httpStatus :: (Int -> f Int) -> StopExecutionResponse -> f StopExecutionResponse
stopExecutionResponse_httpStatus = (StopExecutionResponse -> Int)
-> (StopExecutionResponse -> Int -> StopExecutionResponse)
-> Lens StopExecutionResponse StopExecutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopExecutionResponse' :: StopExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopExecutionResponse
s@StopExecutionResponse' {} Int
a -> StopExecutionResponse
s {$sel:httpStatus:StopExecutionResponse' :: Int
httpStatus = Int
a} :: StopExecutionResponse)
stopExecutionResponse_stopDate :: Lens.Lens' StopExecutionResponse Prelude.UTCTime
stopExecutionResponse_stopDate :: (UTCTime -> f UTCTime)
-> StopExecutionResponse -> f StopExecutionResponse
stopExecutionResponse_stopDate = (StopExecutionResponse -> POSIX)
-> (StopExecutionResponse -> POSIX -> StopExecutionResponse)
-> Lens StopExecutionResponse StopExecutionResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopExecutionResponse' {POSIX
stopDate :: POSIX
$sel:stopDate:StopExecutionResponse' :: StopExecutionResponse -> POSIX
stopDate} -> POSIX
stopDate) (\s :: StopExecutionResponse
s@StopExecutionResponse' {} POSIX
a -> StopExecutionResponse
s {$sel:stopDate:StopExecutionResponse' :: POSIX
stopDate = POSIX
a} :: StopExecutionResponse) ((POSIX -> f POSIX)
-> StopExecutionResponse -> f StopExecutionResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> StopExecutionResponse
-> f StopExecutionResponse
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 StopExecutionResponse