{-# 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.DescribeWorkflow
(
DescribeWorkflow (..),
newDescribeWorkflow,
describeWorkflow_workflowId,
DescribeWorkflowResponse (..),
newDescribeWorkflowResponse,
describeWorkflowResponse_httpStatus,
describeWorkflowResponse_workflow,
)
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 DescribeWorkflow = DescribeWorkflow'
{
DescribeWorkflow -> Text
workflowId :: Prelude.Text
}
deriving (DescribeWorkflow -> DescribeWorkflow -> Bool
(DescribeWorkflow -> DescribeWorkflow -> Bool)
-> (DescribeWorkflow -> DescribeWorkflow -> Bool)
-> Eq DescribeWorkflow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkflow -> DescribeWorkflow -> Bool
$c/= :: DescribeWorkflow -> DescribeWorkflow -> Bool
== :: DescribeWorkflow -> DescribeWorkflow -> Bool
$c== :: DescribeWorkflow -> DescribeWorkflow -> Bool
Prelude.Eq, ReadPrec [DescribeWorkflow]
ReadPrec DescribeWorkflow
Int -> ReadS DescribeWorkflow
ReadS [DescribeWorkflow]
(Int -> ReadS DescribeWorkflow)
-> ReadS [DescribeWorkflow]
-> ReadPrec DescribeWorkflow
-> ReadPrec [DescribeWorkflow]
-> Read DescribeWorkflow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkflow]
$creadListPrec :: ReadPrec [DescribeWorkflow]
readPrec :: ReadPrec DescribeWorkflow
$creadPrec :: ReadPrec DescribeWorkflow
readList :: ReadS [DescribeWorkflow]
$creadList :: ReadS [DescribeWorkflow]
readsPrec :: Int -> ReadS DescribeWorkflow
$creadsPrec :: Int -> ReadS DescribeWorkflow
Prelude.Read, Int -> DescribeWorkflow -> ShowS
[DescribeWorkflow] -> ShowS
DescribeWorkflow -> String
(Int -> DescribeWorkflow -> ShowS)
-> (DescribeWorkflow -> String)
-> ([DescribeWorkflow] -> ShowS)
-> Show DescribeWorkflow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkflow] -> ShowS
$cshowList :: [DescribeWorkflow] -> ShowS
show :: DescribeWorkflow -> String
$cshow :: DescribeWorkflow -> String
showsPrec :: Int -> DescribeWorkflow -> ShowS
$cshowsPrec :: Int -> DescribeWorkflow -> ShowS
Prelude.Show, (forall x. DescribeWorkflow -> Rep DescribeWorkflow x)
-> (forall x. Rep DescribeWorkflow x -> DescribeWorkflow)
-> Generic DescribeWorkflow
forall x. Rep DescribeWorkflow x -> DescribeWorkflow
forall x. DescribeWorkflow -> Rep DescribeWorkflow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeWorkflow x -> DescribeWorkflow
$cfrom :: forall x. DescribeWorkflow -> Rep DescribeWorkflow x
Prelude.Generic)
newDescribeWorkflow ::
Prelude.Text ->
DescribeWorkflow
newDescribeWorkflow :: Text -> DescribeWorkflow
newDescribeWorkflow Text
pWorkflowId_ =
DescribeWorkflow' :: Text -> DescribeWorkflow
DescribeWorkflow' {$sel:workflowId:DescribeWorkflow' :: Text
workflowId = Text
pWorkflowId_}
describeWorkflow_workflowId :: Lens.Lens' DescribeWorkflow Prelude.Text
describeWorkflow_workflowId :: (Text -> f Text) -> DescribeWorkflow -> f DescribeWorkflow
describeWorkflow_workflowId = (DescribeWorkflow -> Text)
-> (DescribeWorkflow -> Text -> DescribeWorkflow)
-> Lens DescribeWorkflow DescribeWorkflow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkflow' {Text
workflowId :: Text
$sel:workflowId:DescribeWorkflow' :: DescribeWorkflow -> Text
workflowId} -> Text
workflowId) (\s :: DescribeWorkflow
s@DescribeWorkflow' {} Text
a -> DescribeWorkflow
s {$sel:workflowId:DescribeWorkflow' :: Text
workflowId = Text
a} :: DescribeWorkflow)
instance Core.AWSRequest DescribeWorkflow where
type
AWSResponse DescribeWorkflow =
DescribeWorkflowResponse
request :: DescribeWorkflow -> Request DescribeWorkflow
request = Service -> DescribeWorkflow -> Request DescribeWorkflow
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeWorkflow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeWorkflow)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeWorkflow))
-> Logger
-> Service
-> Proxy DescribeWorkflow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeWorkflow)))
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 -> DescribedWorkflow -> DescribeWorkflowResponse
DescribeWorkflowResponse'
(Int -> DescribedWorkflow -> DescribeWorkflowResponse)
-> Either String Int
-> Either String (DescribedWorkflow -> DescribeWorkflowResponse)
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 (DescribedWorkflow -> DescribeWorkflowResponse)
-> Either String DescribedWorkflow
-> Either String DescribeWorkflowResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DescribedWorkflow
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Workflow")
)
instance Prelude.Hashable DescribeWorkflow
instance Prelude.NFData DescribeWorkflow
instance Core.ToHeaders DescribeWorkflow where
toHeaders :: DescribeWorkflow -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeWorkflow -> 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.DescribeWorkflow" ::
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 DescribeWorkflow where
toJSON :: DescribeWorkflow -> Value
toJSON DescribeWorkflow' {Text
workflowId :: Text
$sel:workflowId:DescribeWorkflow' :: DescribeWorkflow -> 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
"WorkflowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workflowId)]
)
instance Core.ToPath DescribeWorkflow where
toPath :: DescribeWorkflow -> ByteString
toPath = ByteString -> DescribeWorkflow -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeWorkflow where
toQuery :: DescribeWorkflow -> QueryString
toQuery = QueryString -> DescribeWorkflow -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeWorkflowResponse = DescribeWorkflowResponse'
{
DescribeWorkflowResponse -> Int
httpStatus :: Prelude.Int,
DescribeWorkflowResponse -> DescribedWorkflow
workflow :: DescribedWorkflow
}
deriving (DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool
(DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool)
-> (DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool)
-> Eq DescribeWorkflowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool
$c/= :: DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool
== :: DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool
$c== :: DescribeWorkflowResponse -> DescribeWorkflowResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkflowResponse]
ReadPrec DescribeWorkflowResponse
Int -> ReadS DescribeWorkflowResponse
ReadS [DescribeWorkflowResponse]
(Int -> ReadS DescribeWorkflowResponse)
-> ReadS [DescribeWorkflowResponse]
-> ReadPrec DescribeWorkflowResponse
-> ReadPrec [DescribeWorkflowResponse]
-> Read DescribeWorkflowResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkflowResponse]
$creadListPrec :: ReadPrec [DescribeWorkflowResponse]
readPrec :: ReadPrec DescribeWorkflowResponse
$creadPrec :: ReadPrec DescribeWorkflowResponse
readList :: ReadS [DescribeWorkflowResponse]
$creadList :: ReadS [DescribeWorkflowResponse]
readsPrec :: Int -> ReadS DescribeWorkflowResponse
$creadsPrec :: Int -> ReadS DescribeWorkflowResponse
Prelude.Read, Int -> DescribeWorkflowResponse -> ShowS
[DescribeWorkflowResponse] -> ShowS
DescribeWorkflowResponse -> String
(Int -> DescribeWorkflowResponse -> ShowS)
-> (DescribeWorkflowResponse -> String)
-> ([DescribeWorkflowResponse] -> ShowS)
-> Show DescribeWorkflowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkflowResponse] -> ShowS
$cshowList :: [DescribeWorkflowResponse] -> ShowS
show :: DescribeWorkflowResponse -> String
$cshow :: DescribeWorkflowResponse -> String
showsPrec :: Int -> DescribeWorkflowResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkflowResponse -> ShowS
Prelude.Show, (forall x.
DescribeWorkflowResponse -> Rep DescribeWorkflowResponse x)
-> (forall x.
Rep DescribeWorkflowResponse x -> DescribeWorkflowResponse)
-> Generic DescribeWorkflowResponse
forall x.
Rep DescribeWorkflowResponse x -> DescribeWorkflowResponse
forall x.
DescribeWorkflowResponse -> Rep DescribeWorkflowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkflowResponse x -> DescribeWorkflowResponse
$cfrom :: forall x.
DescribeWorkflowResponse -> Rep DescribeWorkflowResponse x
Prelude.Generic)
newDescribeWorkflowResponse ::
Prelude.Int ->
DescribedWorkflow ->
DescribeWorkflowResponse
newDescribeWorkflowResponse :: Int -> DescribedWorkflow -> DescribeWorkflowResponse
newDescribeWorkflowResponse Int
pHttpStatus_ DescribedWorkflow
pWorkflow_ =
DescribeWorkflowResponse' :: Int -> DescribedWorkflow -> DescribeWorkflowResponse
DescribeWorkflowResponse'
{ $sel:httpStatus:DescribeWorkflowResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:workflow:DescribeWorkflowResponse' :: DescribedWorkflow
workflow = DescribedWorkflow
pWorkflow_
}
describeWorkflowResponse_httpStatus :: Lens.Lens' DescribeWorkflowResponse Prelude.Int
describeWorkflowResponse_httpStatus :: (Int -> f Int)
-> DescribeWorkflowResponse -> f DescribeWorkflowResponse
describeWorkflowResponse_httpStatus = (DescribeWorkflowResponse -> Int)
-> (DescribeWorkflowResponse -> Int -> DescribeWorkflowResponse)
-> Lens DescribeWorkflowResponse DescribeWorkflowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkflowResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeWorkflowResponse' :: DescribeWorkflowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeWorkflowResponse
s@DescribeWorkflowResponse' {} Int
a -> DescribeWorkflowResponse
s {$sel:httpStatus:DescribeWorkflowResponse' :: Int
httpStatus = Int
a} :: DescribeWorkflowResponse)
describeWorkflowResponse_workflow :: Lens.Lens' DescribeWorkflowResponse DescribedWorkflow
describeWorkflowResponse_workflow :: (DescribedWorkflow -> f DescribedWorkflow)
-> DescribeWorkflowResponse -> f DescribeWorkflowResponse
describeWorkflowResponse_workflow = (DescribeWorkflowResponse -> DescribedWorkflow)
-> (DescribeWorkflowResponse
-> DescribedWorkflow -> DescribeWorkflowResponse)
-> Lens
DescribeWorkflowResponse
DescribeWorkflowResponse
DescribedWorkflow
DescribedWorkflow
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkflowResponse' {DescribedWorkflow
workflow :: DescribedWorkflow
$sel:workflow:DescribeWorkflowResponse' :: DescribeWorkflowResponse -> DescribedWorkflow
workflow} -> DescribedWorkflow
workflow) (\s :: DescribeWorkflowResponse
s@DescribeWorkflowResponse' {} DescribedWorkflow
a -> DescribeWorkflowResponse
s {$sel:workflow:DescribeWorkflowResponse' :: DescribedWorkflow
workflow = DescribedWorkflow
a} :: DescribeWorkflowResponse)
instance Prelude.NFData DescribeWorkflowResponse