{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.GetJobBookmark
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information on a job bookmark entry.
--
-- For more information about enabling and using job bookmarks, see:
--
-- -   <https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html Tracking processed data using job bookmarks>
--
-- -   <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html Job parameters used by Glue>
--
-- -   <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-job.html#aws-glue-api-jobs-job-Job Job structure>
module Amazonka.Glue.GetJobBookmark
  ( -- * Creating a Request
    GetJobBookmark (..),
    newGetJobBookmark,

    -- * Request Lenses
    getJobBookmark_runId,
    getJobBookmark_jobName,

    -- * Destructuring the Response
    GetJobBookmarkResponse (..),
    newGetJobBookmarkResponse,

    -- * Response Lenses
    getJobBookmarkResponse_jobBookmarkEntry,
    getJobBookmarkResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetJobBookmark' smart constructor.
data GetJobBookmark = GetJobBookmark'
  { -- | The unique run identifier associated with this job run.
    GetJobBookmark -> Maybe Text
runId :: Prelude.Maybe Prelude.Text,
    -- | The name of the job in question.
    GetJobBookmark -> Text
jobName :: Prelude.Text
  }
  deriving (GetJobBookmark -> GetJobBookmark -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobBookmark -> GetJobBookmark -> Bool
$c/= :: GetJobBookmark -> GetJobBookmark -> Bool
== :: GetJobBookmark -> GetJobBookmark -> Bool
$c== :: GetJobBookmark -> GetJobBookmark -> Bool
Prelude.Eq, ReadPrec [GetJobBookmark]
ReadPrec GetJobBookmark
Int -> ReadS GetJobBookmark
ReadS [GetJobBookmark]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobBookmark]
$creadListPrec :: ReadPrec [GetJobBookmark]
readPrec :: ReadPrec GetJobBookmark
$creadPrec :: ReadPrec GetJobBookmark
readList :: ReadS [GetJobBookmark]
$creadList :: ReadS [GetJobBookmark]
readsPrec :: Int -> ReadS GetJobBookmark
$creadsPrec :: Int -> ReadS GetJobBookmark
Prelude.Read, Int -> GetJobBookmark -> ShowS
[GetJobBookmark] -> ShowS
GetJobBookmark -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobBookmark] -> ShowS
$cshowList :: [GetJobBookmark] -> ShowS
show :: GetJobBookmark -> String
$cshow :: GetJobBookmark -> String
showsPrec :: Int -> GetJobBookmark -> ShowS
$cshowsPrec :: Int -> GetJobBookmark -> ShowS
Prelude.Show, forall x. Rep GetJobBookmark x -> GetJobBookmark
forall x. GetJobBookmark -> Rep GetJobBookmark x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobBookmark x -> GetJobBookmark
$cfrom :: forall x. GetJobBookmark -> Rep GetJobBookmark x
Prelude.Generic)

-- |
-- Create a value of 'GetJobBookmark' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'runId', 'getJobBookmark_runId' - The unique run identifier associated with this job run.
--
-- 'jobName', 'getJobBookmark_jobName' - The name of the job in question.
newGetJobBookmark ::
  -- | 'jobName'
  Prelude.Text ->
  GetJobBookmark
newGetJobBookmark :: Text -> GetJobBookmark
newGetJobBookmark Text
pJobName_ =
  GetJobBookmark'
    { $sel:runId:GetJobBookmark' :: Maybe Text
runId = forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:GetJobBookmark' :: Text
jobName = Text
pJobName_
    }

-- | The unique run identifier associated with this job run.
getJobBookmark_runId :: Lens.Lens' GetJobBookmark (Prelude.Maybe Prelude.Text)
getJobBookmark_runId :: Lens' GetJobBookmark (Maybe Text)
getJobBookmark_runId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobBookmark' {Maybe Text
runId :: Maybe Text
$sel:runId:GetJobBookmark' :: GetJobBookmark -> Maybe Text
runId} -> Maybe Text
runId) (\s :: GetJobBookmark
s@GetJobBookmark' {} Maybe Text
a -> GetJobBookmark
s {$sel:runId:GetJobBookmark' :: Maybe Text
runId = Maybe Text
a} :: GetJobBookmark)

-- | The name of the job in question.
getJobBookmark_jobName :: Lens.Lens' GetJobBookmark Prelude.Text
getJobBookmark_jobName :: Lens' GetJobBookmark Text
getJobBookmark_jobName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobBookmark' {Text
jobName :: Text
$sel:jobName:GetJobBookmark' :: GetJobBookmark -> Text
jobName} -> Text
jobName) (\s :: GetJobBookmark
s@GetJobBookmark' {} Text
a -> GetJobBookmark
s {$sel:jobName:GetJobBookmark' :: Text
jobName = Text
a} :: GetJobBookmark)

instance Core.AWSRequest GetJobBookmark where
  type
    AWSResponse GetJobBookmark =
      GetJobBookmarkResponse
  request :: (Service -> Service) -> GetJobBookmark -> Request GetJobBookmark
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetJobBookmark
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobBookmark)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe JobBookmarkEntry -> Int -> GetJobBookmarkResponse
GetJobBookmarkResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"JobBookmarkEntry")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetJobBookmark where
  hashWithSalt :: Int -> GetJobBookmark -> Int
hashWithSalt Int
_salt GetJobBookmark' {Maybe Text
Text
jobName :: Text
runId :: Maybe Text
$sel:jobName:GetJobBookmark' :: GetJobBookmark -> Text
$sel:runId:GetJobBookmark' :: GetJobBookmark -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
runId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobName

instance Prelude.NFData GetJobBookmark where
  rnf :: GetJobBookmark -> ()
rnf GetJobBookmark' {Maybe Text
Text
jobName :: Text
runId :: Maybe Text
$sel:jobName:GetJobBookmark' :: GetJobBookmark -> Text
$sel:runId:GetJobBookmark' :: GetJobBookmark -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
runId seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobName

instance Data.ToHeaders GetJobBookmark where
  toHeaders :: GetJobBookmark -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AWSGlue.GetJobBookmark" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetJobBookmark where
  toJSON :: GetJobBookmark -> Value
toJSON GetJobBookmark' {Maybe Text
Text
jobName :: Text
runId :: Maybe Text
$sel:jobName:GetJobBookmark' :: GetJobBookmark -> Text
$sel:runId:GetJobBookmark' :: GetJobBookmark -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"RunId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
runId,
            forall a. a -> Maybe a
Prelude.Just (Key
"JobName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobName)
          ]
      )

instance Data.ToPath GetJobBookmark where
  toPath :: GetJobBookmark -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetJobBookmark where
  toQuery :: GetJobBookmark -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetJobBookmarkResponse' smart constructor.
data GetJobBookmarkResponse = GetJobBookmarkResponse'
  { -- | A structure that defines a point that a job can resume processing.
    GetJobBookmarkResponse -> Maybe JobBookmarkEntry
jobBookmarkEntry :: Prelude.Maybe JobBookmarkEntry,
    -- | The response's http status code.
    GetJobBookmarkResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool
$c/= :: GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool
== :: GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool
$c== :: GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool
Prelude.Eq, ReadPrec [GetJobBookmarkResponse]
ReadPrec GetJobBookmarkResponse
Int -> ReadS GetJobBookmarkResponse
ReadS [GetJobBookmarkResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobBookmarkResponse]
$creadListPrec :: ReadPrec [GetJobBookmarkResponse]
readPrec :: ReadPrec GetJobBookmarkResponse
$creadPrec :: ReadPrec GetJobBookmarkResponse
readList :: ReadS [GetJobBookmarkResponse]
$creadList :: ReadS [GetJobBookmarkResponse]
readsPrec :: Int -> ReadS GetJobBookmarkResponse
$creadsPrec :: Int -> ReadS GetJobBookmarkResponse
Prelude.Read, Int -> GetJobBookmarkResponse -> ShowS
[GetJobBookmarkResponse] -> ShowS
GetJobBookmarkResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobBookmarkResponse] -> ShowS
$cshowList :: [GetJobBookmarkResponse] -> ShowS
show :: GetJobBookmarkResponse -> String
$cshow :: GetJobBookmarkResponse -> String
showsPrec :: Int -> GetJobBookmarkResponse -> ShowS
$cshowsPrec :: Int -> GetJobBookmarkResponse -> ShowS
Prelude.Show, forall x. Rep GetJobBookmarkResponse x -> GetJobBookmarkResponse
forall x. GetJobBookmarkResponse -> Rep GetJobBookmarkResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobBookmarkResponse x -> GetJobBookmarkResponse
$cfrom :: forall x. GetJobBookmarkResponse -> Rep GetJobBookmarkResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetJobBookmarkResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobBookmarkEntry', 'getJobBookmarkResponse_jobBookmarkEntry' - A structure that defines a point that a job can resume processing.
--
-- 'httpStatus', 'getJobBookmarkResponse_httpStatus' - The response's http status code.
newGetJobBookmarkResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetJobBookmarkResponse
newGetJobBookmarkResponse :: Int -> GetJobBookmarkResponse
newGetJobBookmarkResponse Int
pHttpStatus_ =
  GetJobBookmarkResponse'
    { $sel:jobBookmarkEntry:GetJobBookmarkResponse' :: Maybe JobBookmarkEntry
jobBookmarkEntry =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetJobBookmarkResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A structure that defines a point that a job can resume processing.
getJobBookmarkResponse_jobBookmarkEntry :: Lens.Lens' GetJobBookmarkResponse (Prelude.Maybe JobBookmarkEntry)
getJobBookmarkResponse_jobBookmarkEntry :: Lens' GetJobBookmarkResponse (Maybe JobBookmarkEntry)
getJobBookmarkResponse_jobBookmarkEntry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobBookmarkResponse' {Maybe JobBookmarkEntry
jobBookmarkEntry :: Maybe JobBookmarkEntry
$sel:jobBookmarkEntry:GetJobBookmarkResponse' :: GetJobBookmarkResponse -> Maybe JobBookmarkEntry
jobBookmarkEntry} -> Maybe JobBookmarkEntry
jobBookmarkEntry) (\s :: GetJobBookmarkResponse
s@GetJobBookmarkResponse' {} Maybe JobBookmarkEntry
a -> GetJobBookmarkResponse
s {$sel:jobBookmarkEntry:GetJobBookmarkResponse' :: Maybe JobBookmarkEntry
jobBookmarkEntry = Maybe JobBookmarkEntry
a} :: GetJobBookmarkResponse)

-- | The response's http status code.
getJobBookmarkResponse_httpStatus :: Lens.Lens' GetJobBookmarkResponse Prelude.Int
getJobBookmarkResponse_httpStatus :: Lens' GetJobBookmarkResponse Int
getJobBookmarkResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobBookmarkResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetJobBookmarkResponse' :: GetJobBookmarkResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetJobBookmarkResponse
s@GetJobBookmarkResponse' {} Int
a -> GetJobBookmarkResponse
s {$sel:httpStatus:GetJobBookmarkResponse' :: Int
httpStatus = Int
a} :: GetJobBookmarkResponse)

instance Prelude.NFData GetJobBookmarkResponse where
  rnf :: GetJobBookmarkResponse -> ()
rnf GetJobBookmarkResponse' {Int
Maybe JobBookmarkEntry
httpStatus :: Int
jobBookmarkEntry :: Maybe JobBookmarkEntry
$sel:httpStatus:GetJobBookmarkResponse' :: GetJobBookmarkResponse -> Int
$sel:jobBookmarkEntry:GetJobBookmarkResponse' :: GetJobBookmarkResponse -> Maybe JobBookmarkEntry
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe JobBookmarkEntry
jobBookmarkEntry
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus