{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information on a job bookmark entry.
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 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

-- | /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
(GetJobBookmark -> GetJobBookmark -> Bool)
-> (GetJobBookmark -> GetJobBookmark -> Bool) -> Eq GetJobBookmark
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]
(Int -> ReadS GetJobBookmark)
-> ReadS [GetJobBookmark]
-> ReadPrec GetJobBookmark
-> ReadPrec [GetJobBookmark]
-> Read 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
(Int -> GetJobBookmark -> ShowS)
-> (GetJobBookmark -> String)
-> ([GetJobBookmark] -> ShowS)
-> Show GetJobBookmark
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. GetJobBookmark -> Rep GetJobBookmark x)
-> (forall x. Rep GetJobBookmark x -> GetJobBookmark)
-> Generic GetJobBookmark
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' :: Maybe Text -> Text -> GetJobBookmark
GetJobBookmark'
    { $sel:runId:GetJobBookmark' :: Maybe Text
runId = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> GetJobBookmark -> f GetJobBookmark
getJobBookmark_runId = (GetJobBookmark -> Maybe Text)
-> (GetJobBookmark -> Maybe Text -> GetJobBookmark)
-> Lens GetJobBookmark GetJobBookmark (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> GetJobBookmark -> f GetJobBookmark
getJobBookmark_jobName = (GetJobBookmark -> Text)
-> (GetJobBookmark -> Text -> GetJobBookmark)
-> Lens GetJobBookmark GetJobBookmark Text Text
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 :: GetJobBookmark -> Request GetJobBookmark
request = Service -> GetJobBookmark -> Request GetJobBookmark
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetJobBookmark
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobBookmark)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetJobBookmark))
-> Logger
-> Service
-> Proxy GetJobBookmark
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobBookmark)))
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 JobBookmarkEntry -> Int -> GetJobBookmarkResponse
GetJobBookmarkResponse'
            (Maybe JobBookmarkEntry -> Int -> GetJobBookmarkResponse)
-> Either String (Maybe JobBookmarkEntry)
-> Either String (Int -> GetJobBookmarkResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe JobBookmarkEntry)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobBookmarkEntry")
            Either String (Int -> GetJobBookmarkResponse)
-> Either String Int -> Either String GetJobBookmarkResponse
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 GetJobBookmark

instance Prelude.NFData GetJobBookmark

instance Core.ToHeaders GetJobBookmark where
  toHeaders :: GetJobBookmark -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetJobBookmark -> 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.GetJobBookmark" :: 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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RunId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
runId,
            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)
          ]
      )

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

instance Core.ToQuery GetJobBookmark where
  toQuery :: GetJobBookmark -> QueryString
toQuery = QueryString -> GetJobBookmark -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool)
-> (GetJobBookmarkResponse -> GetJobBookmarkResponse -> Bool)
-> Eq GetJobBookmarkResponse
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]
(Int -> ReadS GetJobBookmarkResponse)
-> ReadS [GetJobBookmarkResponse]
-> ReadPrec GetJobBookmarkResponse
-> ReadPrec [GetJobBookmarkResponse]
-> Read 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
(Int -> GetJobBookmarkResponse -> ShowS)
-> (GetJobBookmarkResponse -> String)
-> ([GetJobBookmarkResponse] -> ShowS)
-> Show GetJobBookmarkResponse
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. GetJobBookmarkResponse -> Rep GetJobBookmarkResponse x)
-> (forall x.
    Rep GetJobBookmarkResponse x -> GetJobBookmarkResponse)
-> Generic GetJobBookmarkResponse
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' :: Maybe JobBookmarkEntry -> Int -> GetJobBookmarkResponse
GetJobBookmarkResponse'
    { $sel:jobBookmarkEntry:GetJobBookmarkResponse' :: Maybe JobBookmarkEntry
jobBookmarkEntry =
        Maybe 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 :: (Maybe JobBookmarkEntry -> f (Maybe JobBookmarkEntry))
-> GetJobBookmarkResponse -> f GetJobBookmarkResponse
getJobBookmarkResponse_jobBookmarkEntry = (GetJobBookmarkResponse -> Maybe JobBookmarkEntry)
-> (GetJobBookmarkResponse
    -> Maybe JobBookmarkEntry -> GetJobBookmarkResponse)
-> Lens
     GetJobBookmarkResponse
     GetJobBookmarkResponse
     (Maybe JobBookmarkEntry)
     (Maybe 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 :: (Int -> f Int)
-> GetJobBookmarkResponse -> f GetJobBookmarkResponse
getJobBookmarkResponse_httpStatus = (GetJobBookmarkResponse -> Int)
-> (GetJobBookmarkResponse -> Int -> GetJobBookmarkResponse)
-> Lens GetJobBookmarkResponse GetJobBookmarkResponse Int Int
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