{-# 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.Transfer.DescribeExecution
(
DescribeExecution (..),
newDescribeExecution,
describeExecution_executionId,
describeExecution_workflowId,
DescribeExecutionResponse (..),
newDescribeExecutionResponse,
describeExecutionResponse_httpStatus,
describeExecutionResponse_workflowId,
describeExecutionResponse_execution,
)
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.Transfer.Types
data DescribeExecution = DescribeExecution'
{
DescribeExecution -> Text
executionId :: Prelude.Text,
DescribeExecution -> Text
workflowId :: Prelude.Text
}
deriving (DescribeExecution -> DescribeExecution -> Bool
(DescribeExecution -> DescribeExecution -> Bool)
-> (DescribeExecution -> DescribeExecution -> Bool)
-> Eq DescribeExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExecution -> DescribeExecution -> Bool
$c/= :: DescribeExecution -> DescribeExecution -> Bool
== :: DescribeExecution -> DescribeExecution -> Bool
$c== :: DescribeExecution -> DescribeExecution -> Bool
Prelude.Eq, ReadPrec [DescribeExecution]
ReadPrec DescribeExecution
Int -> ReadS DescribeExecution
ReadS [DescribeExecution]
(Int -> ReadS DescribeExecution)
-> ReadS [DescribeExecution]
-> ReadPrec DescribeExecution
-> ReadPrec [DescribeExecution]
-> Read DescribeExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExecution]
$creadListPrec :: ReadPrec [DescribeExecution]
readPrec :: ReadPrec DescribeExecution
$creadPrec :: ReadPrec DescribeExecution
readList :: ReadS [DescribeExecution]
$creadList :: ReadS [DescribeExecution]
readsPrec :: Int -> ReadS DescribeExecution
$creadsPrec :: Int -> ReadS DescribeExecution
Prelude.Read, Int -> DescribeExecution -> ShowS
[DescribeExecution] -> ShowS
DescribeExecution -> String
(Int -> DescribeExecution -> ShowS)
-> (DescribeExecution -> String)
-> ([DescribeExecution] -> ShowS)
-> Show DescribeExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExecution] -> ShowS
$cshowList :: [DescribeExecution] -> ShowS
show :: DescribeExecution -> String
$cshow :: DescribeExecution -> String
showsPrec :: Int -> DescribeExecution -> ShowS
$cshowsPrec :: Int -> DescribeExecution -> ShowS
Prelude.Show, (forall x. DescribeExecution -> Rep DescribeExecution x)
-> (forall x. Rep DescribeExecution x -> DescribeExecution)
-> Generic DescribeExecution
forall x. Rep DescribeExecution x -> DescribeExecution
forall x. DescribeExecution -> Rep DescribeExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeExecution x -> DescribeExecution
$cfrom :: forall x. DescribeExecution -> Rep DescribeExecution x
Prelude.Generic)
newDescribeExecution ::
Prelude.Text ->
Prelude.Text ->
DescribeExecution
newDescribeExecution :: Text -> Text -> DescribeExecution
newDescribeExecution Text
pExecutionId_ Text
pWorkflowId_ =
DescribeExecution' :: Text -> Text -> DescribeExecution
DescribeExecution'
{ $sel:executionId:DescribeExecution' :: Text
executionId = Text
pExecutionId_,
$sel:workflowId:DescribeExecution' :: Text
workflowId = Text
pWorkflowId_
}
describeExecution_executionId :: Lens.Lens' DescribeExecution Prelude.Text
describeExecution_executionId :: (Text -> f Text) -> DescribeExecution -> f DescribeExecution
describeExecution_executionId = (DescribeExecution -> Text)
-> (DescribeExecution -> Text -> DescribeExecution)
-> Lens DescribeExecution DescribeExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExecution' {Text
executionId :: Text
$sel:executionId:DescribeExecution' :: DescribeExecution -> Text
executionId} -> Text
executionId) (\s :: DescribeExecution
s@DescribeExecution' {} Text
a -> DescribeExecution
s {$sel:executionId:DescribeExecution' :: Text
executionId = Text
a} :: DescribeExecution)
describeExecution_workflowId :: Lens.Lens' DescribeExecution Prelude.Text
describeExecution_workflowId :: (Text -> f Text) -> DescribeExecution -> f DescribeExecution
describeExecution_workflowId = (DescribeExecution -> Text)
-> (DescribeExecution -> Text -> DescribeExecution)
-> Lens DescribeExecution DescribeExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExecution' {Text
workflowId :: Text
$sel:workflowId:DescribeExecution' :: DescribeExecution -> Text
workflowId} -> Text
workflowId) (\s :: DescribeExecution
s@DescribeExecution' {} Text
a -> DescribeExecution
s {$sel:workflowId:DescribeExecution' :: Text
workflowId = Text
a} :: DescribeExecution)
instance Core.AWSRequest DescribeExecution where
type
AWSResponse DescribeExecution =
DescribeExecutionResponse
request :: DescribeExecution -> Request DescribeExecution
request = Service -> DescribeExecution -> Request DescribeExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeExecution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeExecution))
-> Logger
-> Service
-> Proxy DescribeExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeExecution)))
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 -> DescribedExecution -> DescribeExecutionResponse
DescribeExecutionResponse'
(Int -> Text -> DescribedExecution -> DescribeExecutionResponse)
-> Either String Int
-> Either
String (Text -> DescribedExecution -> DescribeExecutionResponse)
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 -> DescribedExecution -> DescribeExecutionResponse)
-> Either String Text
-> Either String (DescribedExecution -> DescribeExecutionResponse)
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
"WorkflowId")
Either String (DescribedExecution -> DescribeExecutionResponse)
-> Either String DescribedExecution
-> Either String DescribeExecutionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DescribedExecution
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Execution")
)
instance Prelude.Hashable DescribeExecution
instance Prelude.NFData DescribeExecution
instance Core.ToHeaders DescribeExecution where
toHeaders :: DescribeExecution -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeExecution -> 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
"TransferService.DescribeExecution" ::
Prelude.ByteString
),
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 DescribeExecution where
toJSON :: DescribeExecution -> Value
toJSON DescribeExecution' {Text
workflowId :: Text
executionId :: Text
$sel:workflowId:DescribeExecution' :: DescribeExecution -> Text
$sel:executionId:DescribeExecution' :: DescribeExecution -> 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
"ExecutionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkflowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workflowId)
]
)
instance Core.ToPath DescribeExecution where
toPath :: DescribeExecution -> ByteString
toPath = ByteString -> DescribeExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeExecution where
toQuery :: DescribeExecution -> QueryString
toQuery = QueryString -> DescribeExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeExecutionResponse = DescribeExecutionResponse'
{
DescribeExecutionResponse -> Int
httpStatus :: Prelude.Int,
DescribeExecutionResponse -> Text
workflowId :: Prelude.Text,
DescribeExecutionResponse -> DescribedExecution
execution :: DescribedExecution
}
deriving (DescribeExecutionResponse -> DescribeExecutionResponse -> Bool
(DescribeExecutionResponse -> DescribeExecutionResponse -> Bool)
-> (DescribeExecutionResponse -> DescribeExecutionResponse -> Bool)
-> Eq DescribeExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExecutionResponse -> DescribeExecutionResponse -> Bool
$c/= :: DescribeExecutionResponse -> DescribeExecutionResponse -> Bool
== :: DescribeExecutionResponse -> DescribeExecutionResponse -> Bool
$c== :: DescribeExecutionResponse -> DescribeExecutionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeExecutionResponse]
ReadPrec DescribeExecutionResponse
Int -> ReadS DescribeExecutionResponse
ReadS [DescribeExecutionResponse]
(Int -> ReadS DescribeExecutionResponse)
-> ReadS [DescribeExecutionResponse]
-> ReadPrec DescribeExecutionResponse
-> ReadPrec [DescribeExecutionResponse]
-> Read DescribeExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExecutionResponse]
$creadListPrec :: ReadPrec [DescribeExecutionResponse]
readPrec :: ReadPrec DescribeExecutionResponse
$creadPrec :: ReadPrec DescribeExecutionResponse
readList :: ReadS [DescribeExecutionResponse]
$creadList :: ReadS [DescribeExecutionResponse]
readsPrec :: Int -> ReadS DescribeExecutionResponse
$creadsPrec :: Int -> ReadS DescribeExecutionResponse
Prelude.Read, Int -> DescribeExecutionResponse -> ShowS
[DescribeExecutionResponse] -> ShowS
DescribeExecutionResponse -> String
(Int -> DescribeExecutionResponse -> ShowS)
-> (DescribeExecutionResponse -> String)
-> ([DescribeExecutionResponse] -> ShowS)
-> Show DescribeExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExecutionResponse] -> ShowS
$cshowList :: [DescribeExecutionResponse] -> ShowS
show :: DescribeExecutionResponse -> String
$cshow :: DescribeExecutionResponse -> String
showsPrec :: Int -> DescribeExecutionResponse -> ShowS
$cshowsPrec :: Int -> DescribeExecutionResponse -> ShowS
Prelude.Show, (forall x.
DescribeExecutionResponse -> Rep DescribeExecutionResponse x)
-> (forall x.
Rep DescribeExecutionResponse x -> DescribeExecutionResponse)
-> Generic DescribeExecutionResponse
forall x.
Rep DescribeExecutionResponse x -> DescribeExecutionResponse
forall x.
DescribeExecutionResponse -> Rep DescribeExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeExecutionResponse x -> DescribeExecutionResponse
$cfrom :: forall x.
DescribeExecutionResponse -> Rep DescribeExecutionResponse x
Prelude.Generic)
newDescribeExecutionResponse ::
Prelude.Int ->
Prelude.Text ->
DescribedExecution ->
DescribeExecutionResponse
newDescribeExecutionResponse :: Int -> Text -> DescribedExecution -> DescribeExecutionResponse
newDescribeExecutionResponse
Int
pHttpStatus_
Text
pWorkflowId_
DescribedExecution
pExecution_ =
DescribeExecutionResponse' :: Int -> Text -> DescribedExecution -> DescribeExecutionResponse
DescribeExecutionResponse'
{ $sel:httpStatus:DescribeExecutionResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:workflowId:DescribeExecutionResponse' :: Text
workflowId = Text
pWorkflowId_,
$sel:execution:DescribeExecutionResponse' :: DescribedExecution
execution = DescribedExecution
pExecution_
}
describeExecutionResponse_httpStatus :: Lens.Lens' DescribeExecutionResponse Prelude.Int
describeExecutionResponse_httpStatus :: (Int -> f Int)
-> DescribeExecutionResponse -> f DescribeExecutionResponse
describeExecutionResponse_httpStatus = (DescribeExecutionResponse -> Int)
-> (DescribeExecutionResponse -> Int -> DescribeExecutionResponse)
-> Lens DescribeExecutionResponse DescribeExecutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeExecutionResponse' :: DescribeExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeExecutionResponse
s@DescribeExecutionResponse' {} Int
a -> DescribeExecutionResponse
s {$sel:httpStatus:DescribeExecutionResponse' :: Int
httpStatus = Int
a} :: DescribeExecutionResponse)
describeExecutionResponse_workflowId :: Lens.Lens' DescribeExecutionResponse Prelude.Text
describeExecutionResponse_workflowId :: (Text -> f Text)
-> DescribeExecutionResponse -> f DescribeExecutionResponse
describeExecutionResponse_workflowId = (DescribeExecutionResponse -> Text)
-> (DescribeExecutionResponse -> Text -> DescribeExecutionResponse)
-> Lens
DescribeExecutionResponse DescribeExecutionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExecutionResponse' {Text
workflowId :: Text
$sel:workflowId:DescribeExecutionResponse' :: DescribeExecutionResponse -> Text
workflowId} -> Text
workflowId) (\s :: DescribeExecutionResponse
s@DescribeExecutionResponse' {} Text
a -> DescribeExecutionResponse
s {$sel:workflowId:DescribeExecutionResponse' :: Text
workflowId = Text
a} :: DescribeExecutionResponse)
describeExecutionResponse_execution :: Lens.Lens' DescribeExecutionResponse DescribedExecution
describeExecutionResponse_execution :: (DescribedExecution -> f DescribedExecution)
-> DescribeExecutionResponse -> f DescribeExecutionResponse
describeExecutionResponse_execution = (DescribeExecutionResponse -> DescribedExecution)
-> (DescribeExecutionResponse
-> DescribedExecution -> DescribeExecutionResponse)
-> Lens
DescribeExecutionResponse
DescribeExecutionResponse
DescribedExecution
DescribedExecution
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExecutionResponse' {DescribedExecution
execution :: DescribedExecution
$sel:execution:DescribeExecutionResponse' :: DescribeExecutionResponse -> DescribedExecution
execution} -> DescribedExecution
execution) (\s :: DescribeExecutionResponse
s@DescribeExecutionResponse' {} DescribedExecution
a -> DescribeExecutionResponse
s {$sel:execution:DescribeExecutionResponse' :: DescribedExecution
execution = DescribedExecution
a} :: DescribeExecutionResponse)
instance Prelude.NFData DescribeExecutionResponse