{-# 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.UpdateJob
(
UpdateJob (..),
newUpdateJob,
updateJob_jobName,
updateJob_jobUpdate,
UpdateJobResponse (..),
newUpdateJobResponse,
updateJobResponse_jobName,
updateJobResponse_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 UpdateJob = UpdateJob'
{
UpdateJob -> Text
jobName :: Prelude.Text,
UpdateJob -> JobUpdate
jobUpdate :: JobUpdate
}
deriving (UpdateJob -> UpdateJob -> Bool
(UpdateJob -> UpdateJob -> Bool)
-> (UpdateJob -> UpdateJob -> Bool) -> Eq UpdateJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateJob -> UpdateJob -> Bool
$c/= :: UpdateJob -> UpdateJob -> Bool
== :: UpdateJob -> UpdateJob -> Bool
$c== :: UpdateJob -> UpdateJob -> Bool
Prelude.Eq, ReadPrec [UpdateJob]
ReadPrec UpdateJob
Int -> ReadS UpdateJob
ReadS [UpdateJob]
(Int -> ReadS UpdateJob)
-> ReadS [UpdateJob]
-> ReadPrec UpdateJob
-> ReadPrec [UpdateJob]
-> Read UpdateJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateJob]
$creadListPrec :: ReadPrec [UpdateJob]
readPrec :: ReadPrec UpdateJob
$creadPrec :: ReadPrec UpdateJob
readList :: ReadS [UpdateJob]
$creadList :: ReadS [UpdateJob]
readsPrec :: Int -> ReadS UpdateJob
$creadsPrec :: Int -> ReadS UpdateJob
Prelude.Read, Int -> UpdateJob -> ShowS
[UpdateJob] -> ShowS
UpdateJob -> String
(Int -> UpdateJob -> ShowS)
-> (UpdateJob -> String)
-> ([UpdateJob] -> ShowS)
-> Show UpdateJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateJob] -> ShowS
$cshowList :: [UpdateJob] -> ShowS
show :: UpdateJob -> String
$cshow :: UpdateJob -> String
showsPrec :: Int -> UpdateJob -> ShowS
$cshowsPrec :: Int -> UpdateJob -> ShowS
Prelude.Show, (forall x. UpdateJob -> Rep UpdateJob x)
-> (forall x. Rep UpdateJob x -> UpdateJob) -> Generic UpdateJob
forall x. Rep UpdateJob x -> UpdateJob
forall x. UpdateJob -> Rep UpdateJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateJob x -> UpdateJob
$cfrom :: forall x. UpdateJob -> Rep UpdateJob x
Prelude.Generic)
newUpdateJob ::
Prelude.Text ->
JobUpdate ->
UpdateJob
newUpdateJob :: Text -> JobUpdate -> UpdateJob
newUpdateJob Text
pJobName_ JobUpdate
pJobUpdate_ =
UpdateJob' :: Text -> JobUpdate -> UpdateJob
UpdateJob'
{ $sel:jobName:UpdateJob' :: Text
jobName = Text
pJobName_,
$sel:jobUpdate:UpdateJob' :: JobUpdate
jobUpdate = JobUpdate
pJobUpdate_
}
updateJob_jobName :: Lens.Lens' UpdateJob Prelude.Text
updateJob_jobName :: (Text -> f Text) -> UpdateJob -> f UpdateJob
updateJob_jobName = (UpdateJob -> Text)
-> (UpdateJob -> Text -> UpdateJob)
-> Lens UpdateJob UpdateJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJob' {Text
jobName :: Text
$sel:jobName:UpdateJob' :: UpdateJob -> Text
jobName} -> Text
jobName) (\s :: UpdateJob
s@UpdateJob' {} Text
a -> UpdateJob
s {$sel:jobName:UpdateJob' :: Text
jobName = Text
a} :: UpdateJob)
updateJob_jobUpdate :: Lens.Lens' UpdateJob JobUpdate
updateJob_jobUpdate :: (JobUpdate -> f JobUpdate) -> UpdateJob -> f UpdateJob
updateJob_jobUpdate = (UpdateJob -> JobUpdate)
-> (UpdateJob -> JobUpdate -> UpdateJob)
-> Lens UpdateJob UpdateJob JobUpdate JobUpdate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJob' {JobUpdate
jobUpdate :: JobUpdate
$sel:jobUpdate:UpdateJob' :: UpdateJob -> JobUpdate
jobUpdate} -> JobUpdate
jobUpdate) (\s :: UpdateJob
s@UpdateJob' {} JobUpdate
a -> UpdateJob
s {$sel:jobUpdate:UpdateJob' :: JobUpdate
jobUpdate = JobUpdate
a} :: UpdateJob)
instance Core.AWSRequest UpdateJob where
type AWSResponse UpdateJob = UpdateJobResponse
request :: UpdateJob -> Request UpdateJob
request = Service -> UpdateJob -> Request UpdateJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateJob))
-> Logger
-> Service
-> Proxy UpdateJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateJob)))
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 Text -> Int -> UpdateJobResponse
UpdateJobResponse'
(Maybe Text -> Int -> UpdateJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobName")
Either String (Int -> UpdateJobResponse)
-> Either String Int -> Either String UpdateJobResponse
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 UpdateJob
instance Prelude.NFData UpdateJob
instance Core.ToHeaders UpdateJob where
toHeaders :: UpdateJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateJob -> 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.UpdateJob" :: 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 UpdateJob where
toJSON :: UpdateJob -> Value
toJSON UpdateJob' {Text
JobUpdate
jobUpdate :: JobUpdate
jobName :: Text
$sel:jobUpdate:UpdateJob' :: UpdateJob -> JobUpdate
$sel:jobName:UpdateJob' :: UpdateJob -> 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
"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
"JobUpdate" Text -> JobUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= JobUpdate
jobUpdate)
]
)
instance Core.ToPath UpdateJob where
toPath :: UpdateJob -> ByteString
toPath = ByteString -> UpdateJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateJob where
toQuery :: UpdateJob -> QueryString
toQuery = QueryString -> UpdateJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateJobResponse = UpdateJobResponse'
{
UpdateJobResponse -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
UpdateJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateJobResponse -> UpdateJobResponse -> Bool
(UpdateJobResponse -> UpdateJobResponse -> Bool)
-> (UpdateJobResponse -> UpdateJobResponse -> Bool)
-> Eq UpdateJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateJobResponse -> UpdateJobResponse -> Bool
$c/= :: UpdateJobResponse -> UpdateJobResponse -> Bool
== :: UpdateJobResponse -> UpdateJobResponse -> Bool
$c== :: UpdateJobResponse -> UpdateJobResponse -> Bool
Prelude.Eq, ReadPrec [UpdateJobResponse]
ReadPrec UpdateJobResponse
Int -> ReadS UpdateJobResponse
ReadS [UpdateJobResponse]
(Int -> ReadS UpdateJobResponse)
-> ReadS [UpdateJobResponse]
-> ReadPrec UpdateJobResponse
-> ReadPrec [UpdateJobResponse]
-> Read UpdateJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateJobResponse]
$creadListPrec :: ReadPrec [UpdateJobResponse]
readPrec :: ReadPrec UpdateJobResponse
$creadPrec :: ReadPrec UpdateJobResponse
readList :: ReadS [UpdateJobResponse]
$creadList :: ReadS [UpdateJobResponse]
readsPrec :: Int -> ReadS UpdateJobResponse
$creadsPrec :: Int -> ReadS UpdateJobResponse
Prelude.Read, Int -> UpdateJobResponse -> ShowS
[UpdateJobResponse] -> ShowS
UpdateJobResponse -> String
(Int -> UpdateJobResponse -> ShowS)
-> (UpdateJobResponse -> String)
-> ([UpdateJobResponse] -> ShowS)
-> Show UpdateJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateJobResponse] -> ShowS
$cshowList :: [UpdateJobResponse] -> ShowS
show :: UpdateJobResponse -> String
$cshow :: UpdateJobResponse -> String
showsPrec :: Int -> UpdateJobResponse -> ShowS
$cshowsPrec :: Int -> UpdateJobResponse -> ShowS
Prelude.Show, (forall x. UpdateJobResponse -> Rep UpdateJobResponse x)
-> (forall x. Rep UpdateJobResponse x -> UpdateJobResponse)
-> Generic UpdateJobResponse
forall x. Rep UpdateJobResponse x -> UpdateJobResponse
forall x. UpdateJobResponse -> Rep UpdateJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateJobResponse x -> UpdateJobResponse
$cfrom :: forall x. UpdateJobResponse -> Rep UpdateJobResponse x
Prelude.Generic)
newUpdateJobResponse ::
Prelude.Int ->
UpdateJobResponse
newUpdateJobResponse :: Int -> UpdateJobResponse
newUpdateJobResponse Int
pHttpStatus_ =
UpdateJobResponse' :: Maybe Text -> Int -> UpdateJobResponse
UpdateJobResponse'
{ $sel:jobName:UpdateJobResponse' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateJobResponse_jobName :: Lens.Lens' UpdateJobResponse (Prelude.Maybe Prelude.Text)
updateJobResponse_jobName :: (Maybe Text -> f (Maybe Text))
-> UpdateJobResponse -> f UpdateJobResponse
updateJobResponse_jobName = (UpdateJobResponse -> Maybe Text)
-> (UpdateJobResponse -> Maybe Text -> UpdateJobResponse)
-> Lens
UpdateJobResponse UpdateJobResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJobResponse' {Maybe Text
jobName :: Maybe Text
$sel:jobName:UpdateJobResponse' :: UpdateJobResponse -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: UpdateJobResponse
s@UpdateJobResponse' {} Maybe Text
a -> UpdateJobResponse
s {$sel:jobName:UpdateJobResponse' :: Maybe Text
jobName = Maybe Text
a} :: UpdateJobResponse)
updateJobResponse_httpStatus :: Lens.Lens' UpdateJobResponse Prelude.Int
updateJobResponse_httpStatus :: (Int -> f Int) -> UpdateJobResponse -> f UpdateJobResponse
updateJobResponse_httpStatus = (UpdateJobResponse -> Int)
-> (UpdateJobResponse -> Int -> UpdateJobResponse)
-> Lens UpdateJobResponse UpdateJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateJobResponse' :: UpdateJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateJobResponse
s@UpdateJobResponse' {} Int
a -> UpdateJobResponse
s {$sel:httpStatus:UpdateJobResponse' :: Int
httpStatus = Int
a} :: UpdateJobResponse)
instance Prelude.NFData UpdateJobResponse