{-# 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.GetJobRun
(
GetJobRun (..),
newGetJobRun,
getJobRun_predecessorsIncluded,
getJobRun_jobName,
getJobRun_runId,
GetJobRunResponse (..),
newGetJobRunResponse,
getJobRunResponse_jobRun,
getJobRunResponse_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 GetJobRun = GetJobRun'
{
GetJobRun -> Maybe Bool
predecessorsIncluded :: Prelude.Maybe Prelude.Bool,
GetJobRun -> Text
jobName :: Prelude.Text,
GetJobRun -> Text
runId :: Prelude.Text
}
deriving (GetJobRun -> GetJobRun -> Bool
(GetJobRun -> GetJobRun -> Bool)
-> (GetJobRun -> GetJobRun -> Bool) -> Eq GetJobRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobRun -> GetJobRun -> Bool
$c/= :: GetJobRun -> GetJobRun -> Bool
== :: GetJobRun -> GetJobRun -> Bool
$c== :: GetJobRun -> GetJobRun -> Bool
Prelude.Eq, ReadPrec [GetJobRun]
ReadPrec GetJobRun
Int -> ReadS GetJobRun
ReadS [GetJobRun]
(Int -> ReadS GetJobRun)
-> ReadS [GetJobRun]
-> ReadPrec GetJobRun
-> ReadPrec [GetJobRun]
-> Read GetJobRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobRun]
$creadListPrec :: ReadPrec [GetJobRun]
readPrec :: ReadPrec GetJobRun
$creadPrec :: ReadPrec GetJobRun
readList :: ReadS [GetJobRun]
$creadList :: ReadS [GetJobRun]
readsPrec :: Int -> ReadS GetJobRun
$creadsPrec :: Int -> ReadS GetJobRun
Prelude.Read, Int -> GetJobRun -> ShowS
[GetJobRun] -> ShowS
GetJobRun -> String
(Int -> GetJobRun -> ShowS)
-> (GetJobRun -> String)
-> ([GetJobRun] -> ShowS)
-> Show GetJobRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobRun] -> ShowS
$cshowList :: [GetJobRun] -> ShowS
show :: GetJobRun -> String
$cshow :: GetJobRun -> String
showsPrec :: Int -> GetJobRun -> ShowS
$cshowsPrec :: Int -> GetJobRun -> ShowS
Prelude.Show, (forall x. GetJobRun -> Rep GetJobRun x)
-> (forall x. Rep GetJobRun x -> GetJobRun) -> Generic GetJobRun
forall x. Rep GetJobRun x -> GetJobRun
forall x. GetJobRun -> Rep GetJobRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobRun x -> GetJobRun
$cfrom :: forall x. GetJobRun -> Rep GetJobRun x
Prelude.Generic)
newGetJobRun ::
Prelude.Text ->
Prelude.Text ->
GetJobRun
newGetJobRun :: Text -> Text -> GetJobRun
newGetJobRun Text
pJobName_ Text
pRunId_ =
GetJobRun' :: Maybe Bool -> Text -> Text -> GetJobRun
GetJobRun'
{ $sel:predecessorsIncluded:GetJobRun' :: Maybe Bool
predecessorsIncluded = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:jobName:GetJobRun' :: Text
jobName = Text
pJobName_,
$sel:runId:GetJobRun' :: Text
runId = Text
pRunId_
}
getJobRun_predecessorsIncluded :: Lens.Lens' GetJobRun (Prelude.Maybe Prelude.Bool)
getJobRun_predecessorsIncluded :: (Maybe Bool -> f (Maybe Bool)) -> GetJobRun -> f GetJobRun
getJobRun_predecessorsIncluded = (GetJobRun -> Maybe Bool)
-> (GetJobRun -> Maybe Bool -> GetJobRun)
-> Lens GetJobRun GetJobRun (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobRun' {Maybe Bool
predecessorsIncluded :: Maybe Bool
$sel:predecessorsIncluded:GetJobRun' :: GetJobRun -> Maybe Bool
predecessorsIncluded} -> Maybe Bool
predecessorsIncluded) (\s :: GetJobRun
s@GetJobRun' {} Maybe Bool
a -> GetJobRun
s {$sel:predecessorsIncluded:GetJobRun' :: Maybe Bool
predecessorsIncluded = Maybe Bool
a} :: GetJobRun)
getJobRun_jobName :: Lens.Lens' GetJobRun Prelude.Text
getJobRun_jobName :: (Text -> f Text) -> GetJobRun -> f GetJobRun
getJobRun_jobName = (GetJobRun -> Text)
-> (GetJobRun -> Text -> GetJobRun)
-> Lens GetJobRun GetJobRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobRun' {Text
jobName :: Text
$sel:jobName:GetJobRun' :: GetJobRun -> Text
jobName} -> Text
jobName) (\s :: GetJobRun
s@GetJobRun' {} Text
a -> GetJobRun
s {$sel:jobName:GetJobRun' :: Text
jobName = Text
a} :: GetJobRun)
getJobRun_runId :: Lens.Lens' GetJobRun Prelude.Text
getJobRun_runId :: (Text -> f Text) -> GetJobRun -> f GetJobRun
getJobRun_runId = (GetJobRun -> Text)
-> (GetJobRun -> Text -> GetJobRun)
-> Lens GetJobRun GetJobRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobRun' {Text
runId :: Text
$sel:runId:GetJobRun' :: GetJobRun -> Text
runId} -> Text
runId) (\s :: GetJobRun
s@GetJobRun' {} Text
a -> GetJobRun
s {$sel:runId:GetJobRun' :: Text
runId = Text
a} :: GetJobRun)
instance Core.AWSRequest GetJobRun where
type AWSResponse GetJobRun = GetJobRunResponse
request :: GetJobRun -> Request GetJobRun
request = Service -> GetJobRun -> Request GetJobRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobRun)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetJobRun))
-> Logger
-> Service
-> Proxy GetJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobRun)))
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 JobRun -> Int -> GetJobRunResponse
GetJobRunResponse'
(Maybe JobRun -> Int -> GetJobRunResponse)
-> Either String (Maybe JobRun)
-> Either String (Int -> GetJobRunResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe JobRun)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobRun")
Either String (Int -> GetJobRunResponse)
-> Either String Int -> Either String GetJobRunResponse
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 GetJobRun
instance Prelude.NFData GetJobRun
instance Core.ToHeaders GetJobRun where
toHeaders :: GetJobRun -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetJobRun -> 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.GetJobRun" :: 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 GetJobRun where
toJSON :: GetJobRun -> Value
toJSON GetJobRun' {Maybe Bool
Text
runId :: Text
jobName :: Text
predecessorsIncluded :: Maybe Bool
$sel:runId:GetJobRun' :: GetJobRun -> Text
$sel:jobName:GetJobRun' :: GetJobRun -> Text
$sel:predecessorsIncluded:GetJobRun' :: GetJobRun -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PredecessorsIncluded" 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
predecessorsIncluded,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RunId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
runId)
]
)
instance Core.ToPath GetJobRun where
toPath :: GetJobRun -> ByteString
toPath = ByteString -> GetJobRun -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetJobRun where
toQuery :: GetJobRun -> QueryString
toQuery = QueryString -> GetJobRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetJobRunResponse = GetJobRunResponse'
{
GetJobRunResponse -> Maybe JobRun
jobRun :: Prelude.Maybe JobRun,
GetJobRunResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetJobRunResponse -> GetJobRunResponse -> Bool
(GetJobRunResponse -> GetJobRunResponse -> Bool)
-> (GetJobRunResponse -> GetJobRunResponse -> Bool)
-> Eq GetJobRunResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobRunResponse -> GetJobRunResponse -> Bool
$c/= :: GetJobRunResponse -> GetJobRunResponse -> Bool
== :: GetJobRunResponse -> GetJobRunResponse -> Bool
$c== :: GetJobRunResponse -> GetJobRunResponse -> Bool
Prelude.Eq, ReadPrec [GetJobRunResponse]
ReadPrec GetJobRunResponse
Int -> ReadS GetJobRunResponse
ReadS [GetJobRunResponse]
(Int -> ReadS GetJobRunResponse)
-> ReadS [GetJobRunResponse]
-> ReadPrec GetJobRunResponse
-> ReadPrec [GetJobRunResponse]
-> Read GetJobRunResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobRunResponse]
$creadListPrec :: ReadPrec [GetJobRunResponse]
readPrec :: ReadPrec GetJobRunResponse
$creadPrec :: ReadPrec GetJobRunResponse
readList :: ReadS [GetJobRunResponse]
$creadList :: ReadS [GetJobRunResponse]
readsPrec :: Int -> ReadS GetJobRunResponse
$creadsPrec :: Int -> ReadS GetJobRunResponse
Prelude.Read, Int -> GetJobRunResponse -> ShowS
[GetJobRunResponse] -> ShowS
GetJobRunResponse -> String
(Int -> GetJobRunResponse -> ShowS)
-> (GetJobRunResponse -> String)
-> ([GetJobRunResponse] -> ShowS)
-> Show GetJobRunResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobRunResponse] -> ShowS
$cshowList :: [GetJobRunResponse] -> ShowS
show :: GetJobRunResponse -> String
$cshow :: GetJobRunResponse -> String
showsPrec :: Int -> GetJobRunResponse -> ShowS
$cshowsPrec :: Int -> GetJobRunResponse -> ShowS
Prelude.Show, (forall x. GetJobRunResponse -> Rep GetJobRunResponse x)
-> (forall x. Rep GetJobRunResponse x -> GetJobRunResponse)
-> Generic GetJobRunResponse
forall x. Rep GetJobRunResponse x -> GetJobRunResponse
forall x. GetJobRunResponse -> Rep GetJobRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobRunResponse x -> GetJobRunResponse
$cfrom :: forall x. GetJobRunResponse -> Rep GetJobRunResponse x
Prelude.Generic)
newGetJobRunResponse ::
Prelude.Int ->
GetJobRunResponse
newGetJobRunResponse :: Int -> GetJobRunResponse
newGetJobRunResponse Int
pHttpStatus_ =
GetJobRunResponse' :: Maybe JobRun -> Int -> GetJobRunResponse
GetJobRunResponse'
{ $sel:jobRun:GetJobRunResponse' :: Maybe JobRun
jobRun = Maybe JobRun
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetJobRunResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getJobRunResponse_jobRun :: Lens.Lens' GetJobRunResponse (Prelude.Maybe JobRun)
getJobRunResponse_jobRun :: (Maybe JobRun -> f (Maybe JobRun))
-> GetJobRunResponse -> f GetJobRunResponse
getJobRunResponse_jobRun = (GetJobRunResponse -> Maybe JobRun)
-> (GetJobRunResponse -> Maybe JobRun -> GetJobRunResponse)
-> Lens
GetJobRunResponse GetJobRunResponse (Maybe JobRun) (Maybe JobRun)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobRunResponse' {Maybe JobRun
jobRun :: Maybe JobRun
$sel:jobRun:GetJobRunResponse' :: GetJobRunResponse -> Maybe JobRun
jobRun} -> Maybe JobRun
jobRun) (\s :: GetJobRunResponse
s@GetJobRunResponse' {} Maybe JobRun
a -> GetJobRunResponse
s {$sel:jobRun:GetJobRunResponse' :: Maybe JobRun
jobRun = Maybe JobRun
a} :: GetJobRunResponse)
getJobRunResponse_httpStatus :: Lens.Lens' GetJobRunResponse Prelude.Int
getJobRunResponse_httpStatus :: (Int -> f Int) -> GetJobRunResponse -> f GetJobRunResponse
getJobRunResponse_httpStatus = (GetJobRunResponse -> Int)
-> (GetJobRunResponse -> Int -> GetJobRunResponse)
-> Lens GetJobRunResponse GetJobRunResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobRunResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetJobRunResponse' :: GetJobRunResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetJobRunResponse
s@GetJobRunResponse' {} Int
a -> GetJobRunResponse
s {$sel:httpStatus:GetJobRunResponse' :: Int
httpStatus = Int
a} :: GetJobRunResponse)
instance Prelude.NFData GetJobRunResponse