{-# 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.Glue.GetWorkflow
(
GetWorkflow (..),
newGetWorkflow,
getWorkflow_includeGraph,
getWorkflow_name,
GetWorkflowResponse (..),
newGetWorkflowResponse,
getWorkflowResponse_workflow,
getWorkflowResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetWorkflow = GetWorkflow'
{
GetWorkflow -> Maybe Bool
includeGraph :: Prelude.Maybe Prelude.Bool,
GetWorkflow -> Text
name :: Prelude.Text
}
deriving (GetWorkflow -> GetWorkflow -> Bool
(GetWorkflow -> GetWorkflow -> Bool)
-> (GetWorkflow -> GetWorkflow -> Bool) -> Eq GetWorkflow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWorkflow -> GetWorkflow -> Bool
$c/= :: GetWorkflow -> GetWorkflow -> Bool
== :: GetWorkflow -> GetWorkflow -> Bool
$c== :: GetWorkflow -> GetWorkflow -> Bool
Prelude.Eq, ReadPrec [GetWorkflow]
ReadPrec GetWorkflow
Int -> ReadS GetWorkflow
ReadS [GetWorkflow]
(Int -> ReadS GetWorkflow)
-> ReadS [GetWorkflow]
-> ReadPrec GetWorkflow
-> ReadPrec [GetWorkflow]
-> Read GetWorkflow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWorkflow]
$creadListPrec :: ReadPrec [GetWorkflow]
readPrec :: ReadPrec GetWorkflow
$creadPrec :: ReadPrec GetWorkflow
readList :: ReadS [GetWorkflow]
$creadList :: ReadS [GetWorkflow]
readsPrec :: Int -> ReadS GetWorkflow
$creadsPrec :: Int -> ReadS GetWorkflow
Prelude.Read, Int -> GetWorkflow -> ShowS
[GetWorkflow] -> ShowS
GetWorkflow -> String
(Int -> GetWorkflow -> ShowS)
-> (GetWorkflow -> String)
-> ([GetWorkflow] -> ShowS)
-> Show GetWorkflow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWorkflow] -> ShowS
$cshowList :: [GetWorkflow] -> ShowS
show :: GetWorkflow -> String
$cshow :: GetWorkflow -> String
showsPrec :: Int -> GetWorkflow -> ShowS
$cshowsPrec :: Int -> GetWorkflow -> ShowS
Prelude.Show, (forall x. GetWorkflow -> Rep GetWorkflow x)
-> (forall x. Rep GetWorkflow x -> GetWorkflow)
-> Generic GetWorkflow
forall x. Rep GetWorkflow x -> GetWorkflow
forall x. GetWorkflow -> Rep GetWorkflow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWorkflow x -> GetWorkflow
$cfrom :: forall x. GetWorkflow -> Rep GetWorkflow x
Prelude.Generic)
newGetWorkflow ::
Prelude.Text ->
GetWorkflow
newGetWorkflow :: Text -> GetWorkflow
newGetWorkflow Text
pName_ =
GetWorkflow' :: Maybe Bool -> Text -> GetWorkflow
GetWorkflow'
{ $sel:includeGraph:GetWorkflow' :: Maybe Bool
includeGraph = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:GetWorkflow' :: Text
name = Text
pName_
}
getWorkflow_includeGraph :: Lens.Lens' GetWorkflow (Prelude.Maybe Prelude.Bool)
getWorkflow_includeGraph :: (Maybe Bool -> f (Maybe Bool)) -> GetWorkflow -> f GetWorkflow
getWorkflow_includeGraph = (GetWorkflow -> Maybe Bool)
-> (GetWorkflow -> Maybe Bool -> GetWorkflow)
-> Lens GetWorkflow GetWorkflow (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorkflow' {Maybe Bool
includeGraph :: Maybe Bool
$sel:includeGraph:GetWorkflow' :: GetWorkflow -> Maybe Bool
includeGraph} -> Maybe Bool
includeGraph) (\s :: GetWorkflow
s@GetWorkflow' {} Maybe Bool
a -> GetWorkflow
s {$sel:includeGraph:GetWorkflow' :: Maybe Bool
includeGraph = Maybe Bool
a} :: GetWorkflow)
getWorkflow_name :: Lens.Lens' GetWorkflow Prelude.Text
getWorkflow_name :: (Text -> f Text) -> GetWorkflow -> f GetWorkflow
getWorkflow_name = (GetWorkflow -> Text)
-> (GetWorkflow -> Text -> GetWorkflow)
-> Lens GetWorkflow GetWorkflow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorkflow' {Text
name :: Text
$sel:name:GetWorkflow' :: GetWorkflow -> Text
name} -> Text
name) (\s :: GetWorkflow
s@GetWorkflow' {} Text
a -> GetWorkflow
s {$sel:name:GetWorkflow' :: Text
name = Text
a} :: GetWorkflow)
instance Core.AWSRequest GetWorkflow where
type AWSResponse GetWorkflow = GetWorkflowResponse
request :: GetWorkflow -> Request GetWorkflow
request = Service -> GetWorkflow -> Request GetWorkflow
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetWorkflow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetWorkflow)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetWorkflow))
-> Logger
-> Service
-> Proxy GetWorkflow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetWorkflow)))
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 ->
Maybe Workflow -> Int -> GetWorkflowResponse
GetWorkflowResponse'
(Maybe Workflow -> Int -> GetWorkflowResponse)
-> Either String (Maybe Workflow)
-> Either String (Int -> GetWorkflowResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Workflow)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Workflow")
Either String (Int -> GetWorkflowResponse)
-> Either String Int -> Either String GetWorkflowResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetWorkflow
instance Prelude.NFData GetWorkflow
instance Core.ToHeaders GetWorkflow where
toHeaders :: GetWorkflow -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetWorkflow -> 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
"AWSGlue.GetWorkflow" :: 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 GetWorkflow where
toJSON :: GetWorkflow -> Value
toJSON GetWorkflow' {Maybe Bool
Text
name :: Text
includeGraph :: Maybe Bool
$sel:name:GetWorkflow' :: GetWorkflow -> Text
$sel:includeGraph:GetWorkflow' :: GetWorkflow -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IncludeGraph" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeGraph,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath GetWorkflow where
toPath :: GetWorkflow -> ByteString
toPath = ByteString -> GetWorkflow -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetWorkflow where
toQuery :: GetWorkflow -> QueryString
toQuery = QueryString -> GetWorkflow -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetWorkflowResponse = GetWorkflowResponse'
{
GetWorkflowResponse -> Maybe Workflow
workflow :: Prelude.Maybe Workflow,
GetWorkflowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetWorkflowResponse -> GetWorkflowResponse -> Bool
(GetWorkflowResponse -> GetWorkflowResponse -> Bool)
-> (GetWorkflowResponse -> GetWorkflowResponse -> Bool)
-> Eq GetWorkflowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWorkflowResponse -> GetWorkflowResponse -> Bool
$c/= :: GetWorkflowResponse -> GetWorkflowResponse -> Bool
== :: GetWorkflowResponse -> GetWorkflowResponse -> Bool
$c== :: GetWorkflowResponse -> GetWorkflowResponse -> Bool
Prelude.Eq, ReadPrec [GetWorkflowResponse]
ReadPrec GetWorkflowResponse
Int -> ReadS GetWorkflowResponse
ReadS [GetWorkflowResponse]
(Int -> ReadS GetWorkflowResponse)
-> ReadS [GetWorkflowResponse]
-> ReadPrec GetWorkflowResponse
-> ReadPrec [GetWorkflowResponse]
-> Read GetWorkflowResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWorkflowResponse]
$creadListPrec :: ReadPrec [GetWorkflowResponse]
readPrec :: ReadPrec GetWorkflowResponse
$creadPrec :: ReadPrec GetWorkflowResponse
readList :: ReadS [GetWorkflowResponse]
$creadList :: ReadS [GetWorkflowResponse]
readsPrec :: Int -> ReadS GetWorkflowResponse
$creadsPrec :: Int -> ReadS GetWorkflowResponse
Prelude.Read, Int -> GetWorkflowResponse -> ShowS
[GetWorkflowResponse] -> ShowS
GetWorkflowResponse -> String
(Int -> GetWorkflowResponse -> ShowS)
-> (GetWorkflowResponse -> String)
-> ([GetWorkflowResponse] -> ShowS)
-> Show GetWorkflowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWorkflowResponse] -> ShowS
$cshowList :: [GetWorkflowResponse] -> ShowS
show :: GetWorkflowResponse -> String
$cshow :: GetWorkflowResponse -> String
showsPrec :: Int -> GetWorkflowResponse -> ShowS
$cshowsPrec :: Int -> GetWorkflowResponse -> ShowS
Prelude.Show, (forall x. GetWorkflowResponse -> Rep GetWorkflowResponse x)
-> (forall x. Rep GetWorkflowResponse x -> GetWorkflowResponse)
-> Generic GetWorkflowResponse
forall x. Rep GetWorkflowResponse x -> GetWorkflowResponse
forall x. GetWorkflowResponse -> Rep GetWorkflowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWorkflowResponse x -> GetWorkflowResponse
$cfrom :: forall x. GetWorkflowResponse -> Rep GetWorkflowResponse x
Prelude.Generic)
newGetWorkflowResponse ::
Prelude.Int ->
GetWorkflowResponse
newGetWorkflowResponse :: Int -> GetWorkflowResponse
newGetWorkflowResponse Int
pHttpStatus_ =
GetWorkflowResponse' :: Maybe Workflow -> Int -> GetWorkflowResponse
GetWorkflowResponse'
{ $sel:workflow:GetWorkflowResponse' :: Maybe Workflow
workflow = Maybe Workflow
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetWorkflowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getWorkflowResponse_workflow :: Lens.Lens' GetWorkflowResponse (Prelude.Maybe Workflow)
getWorkflowResponse_workflow :: (Maybe Workflow -> f (Maybe Workflow))
-> GetWorkflowResponse -> f GetWorkflowResponse
getWorkflowResponse_workflow = (GetWorkflowResponse -> Maybe Workflow)
-> (GetWorkflowResponse -> Maybe Workflow -> GetWorkflowResponse)
-> Lens
GetWorkflowResponse
GetWorkflowResponse
(Maybe Workflow)
(Maybe Workflow)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorkflowResponse' {Maybe Workflow
workflow :: Maybe Workflow
$sel:workflow:GetWorkflowResponse' :: GetWorkflowResponse -> Maybe Workflow
workflow} -> Maybe Workflow
workflow) (\s :: GetWorkflowResponse
s@GetWorkflowResponse' {} Maybe Workflow
a -> GetWorkflowResponse
s {$sel:workflow:GetWorkflowResponse' :: Maybe Workflow
workflow = Maybe Workflow
a} :: GetWorkflowResponse)
getWorkflowResponse_httpStatus :: Lens.Lens' GetWorkflowResponse Prelude.Int
getWorkflowResponse_httpStatus :: (Int -> f Int) -> GetWorkflowResponse -> f GetWorkflowResponse
getWorkflowResponse_httpStatus = (GetWorkflowResponse -> Int)
-> (GetWorkflowResponse -> Int -> GetWorkflowResponse)
-> Lens GetWorkflowResponse GetWorkflowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorkflowResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetWorkflowResponse' :: GetWorkflowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetWorkflowResponse
s@GetWorkflowResponse' {} Int
a -> GetWorkflowResponse
s {$sel:httpStatus:GetWorkflowResponse' :: Int
httpStatus = Int
a} :: GetWorkflowResponse)
instance Prelude.NFData GetWorkflowResponse