{-# 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.ResetJobBookmark
-- 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)
--
-- Resets a bookmark entry.
module Amazonka.Glue.ResetJobBookmark
  ( -- * Creating a Request
    ResetJobBookmark (..),
    newResetJobBookmark,

    -- * Request Lenses
    resetJobBookmark_runId,
    resetJobBookmark_jobName,

    -- * Destructuring the Response
    ResetJobBookmarkResponse (..),
    newResetJobBookmarkResponse,

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

-- |
-- Create a value of 'ResetJobBookmark' 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', 'resetJobBookmark_runId' - The unique run identifier associated with this job run.
--
-- 'jobName', 'resetJobBookmark_jobName' - The name of the job in question.
newResetJobBookmark ::
  -- | 'jobName'
  Prelude.Text ->
  ResetJobBookmark
newResetJobBookmark :: Text -> ResetJobBookmark
newResetJobBookmark Text
pJobName_ =
  ResetJobBookmark' :: Maybe Text -> Text -> ResetJobBookmark
ResetJobBookmark'
    { $sel:runId:ResetJobBookmark' :: Maybe Text
runId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:ResetJobBookmark' :: Text
jobName = Text
pJobName_
    }

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

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

instance Core.AWSRequest ResetJobBookmark where
  type
    AWSResponse ResetJobBookmark =
      ResetJobBookmarkResponse
  request :: ResetJobBookmark -> Request ResetJobBookmark
request = Service -> ResetJobBookmark -> Request ResetJobBookmark
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ResetJobBookmark
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetJobBookmark)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ResetJobBookmark))
-> Logger
-> Service
-> Proxy ResetJobBookmark
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetJobBookmark)))
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 -> ResetJobBookmarkResponse
ResetJobBookmarkResponse'
            (Maybe JobBookmarkEntry -> Int -> ResetJobBookmarkResponse)
-> Either String (Maybe JobBookmarkEntry)
-> Either String (Int -> ResetJobBookmarkResponse)
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 -> ResetJobBookmarkResponse)
-> Either String Int -> Either String ResetJobBookmarkResponse
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 ResetJobBookmark

instance Prelude.NFData ResetJobBookmark

instance Core.ToHeaders ResetJobBookmark where
  toHeaders :: ResetJobBookmark -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ResetJobBookmark -> 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.ResetJobBookmark" :: 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 ResetJobBookmark where
  toJSON :: ResetJobBookmark -> Value
toJSON ResetJobBookmark' {Maybe Text
Text
jobName :: Text
runId :: Maybe Text
$sel:jobName:ResetJobBookmark' :: ResetJobBookmark -> Text
$sel:runId:ResetJobBookmark' :: ResetJobBookmark -> 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 ResetJobBookmark where
  toPath :: ResetJobBookmark -> ByteString
toPath = ByteString -> ResetJobBookmark -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newResetJobBookmarkResponse' smart constructor.
data ResetJobBookmarkResponse = ResetJobBookmarkResponse'
  { -- | The reset bookmark entry.
    ResetJobBookmarkResponse -> Maybe JobBookmarkEntry
jobBookmarkEntry :: Prelude.Maybe JobBookmarkEntry,
    -- | The response's http status code.
    ResetJobBookmarkResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool
(ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool)
-> (ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool)
-> Eq ResetJobBookmarkResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool
$c/= :: ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool
== :: ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool
$c== :: ResetJobBookmarkResponse -> ResetJobBookmarkResponse -> Bool
Prelude.Eq, ReadPrec [ResetJobBookmarkResponse]
ReadPrec ResetJobBookmarkResponse
Int -> ReadS ResetJobBookmarkResponse
ReadS [ResetJobBookmarkResponse]
(Int -> ReadS ResetJobBookmarkResponse)
-> ReadS [ResetJobBookmarkResponse]
-> ReadPrec ResetJobBookmarkResponse
-> ReadPrec [ResetJobBookmarkResponse]
-> Read ResetJobBookmarkResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetJobBookmarkResponse]
$creadListPrec :: ReadPrec [ResetJobBookmarkResponse]
readPrec :: ReadPrec ResetJobBookmarkResponse
$creadPrec :: ReadPrec ResetJobBookmarkResponse
readList :: ReadS [ResetJobBookmarkResponse]
$creadList :: ReadS [ResetJobBookmarkResponse]
readsPrec :: Int -> ReadS ResetJobBookmarkResponse
$creadsPrec :: Int -> ReadS ResetJobBookmarkResponse
Prelude.Read, Int -> ResetJobBookmarkResponse -> ShowS
[ResetJobBookmarkResponse] -> ShowS
ResetJobBookmarkResponse -> String
(Int -> ResetJobBookmarkResponse -> ShowS)
-> (ResetJobBookmarkResponse -> String)
-> ([ResetJobBookmarkResponse] -> ShowS)
-> Show ResetJobBookmarkResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetJobBookmarkResponse] -> ShowS
$cshowList :: [ResetJobBookmarkResponse] -> ShowS
show :: ResetJobBookmarkResponse -> String
$cshow :: ResetJobBookmarkResponse -> String
showsPrec :: Int -> ResetJobBookmarkResponse -> ShowS
$cshowsPrec :: Int -> ResetJobBookmarkResponse -> ShowS
Prelude.Show, (forall x.
 ResetJobBookmarkResponse -> Rep ResetJobBookmarkResponse x)
-> (forall x.
    Rep ResetJobBookmarkResponse x -> ResetJobBookmarkResponse)
-> Generic ResetJobBookmarkResponse
forall x.
Rep ResetJobBookmarkResponse x -> ResetJobBookmarkResponse
forall x.
ResetJobBookmarkResponse -> Rep ResetJobBookmarkResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResetJobBookmarkResponse x -> ResetJobBookmarkResponse
$cfrom :: forall x.
ResetJobBookmarkResponse -> Rep ResetJobBookmarkResponse x
Prelude.Generic)

-- |
-- Create a value of 'ResetJobBookmarkResponse' 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', 'resetJobBookmarkResponse_jobBookmarkEntry' - The reset bookmark entry.
--
-- 'httpStatus', 'resetJobBookmarkResponse_httpStatus' - The response's http status code.
newResetJobBookmarkResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ResetJobBookmarkResponse
newResetJobBookmarkResponse :: Int -> ResetJobBookmarkResponse
newResetJobBookmarkResponse Int
pHttpStatus_ =
  ResetJobBookmarkResponse' :: Maybe JobBookmarkEntry -> Int -> ResetJobBookmarkResponse
ResetJobBookmarkResponse'
    { $sel:jobBookmarkEntry:ResetJobBookmarkResponse' :: Maybe JobBookmarkEntry
jobBookmarkEntry =
        Maybe JobBookmarkEntry
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ResetJobBookmarkResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The reset bookmark entry.
resetJobBookmarkResponse_jobBookmarkEntry :: Lens.Lens' ResetJobBookmarkResponse (Prelude.Maybe JobBookmarkEntry)
resetJobBookmarkResponse_jobBookmarkEntry :: (Maybe JobBookmarkEntry -> f (Maybe JobBookmarkEntry))
-> ResetJobBookmarkResponse -> f ResetJobBookmarkResponse
resetJobBookmarkResponse_jobBookmarkEntry = (ResetJobBookmarkResponse -> Maybe JobBookmarkEntry)
-> (ResetJobBookmarkResponse
    -> Maybe JobBookmarkEntry -> ResetJobBookmarkResponse)
-> Lens
     ResetJobBookmarkResponse
     ResetJobBookmarkResponse
     (Maybe JobBookmarkEntry)
     (Maybe JobBookmarkEntry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetJobBookmarkResponse' {Maybe JobBookmarkEntry
jobBookmarkEntry :: Maybe JobBookmarkEntry
$sel:jobBookmarkEntry:ResetJobBookmarkResponse' :: ResetJobBookmarkResponse -> Maybe JobBookmarkEntry
jobBookmarkEntry} -> Maybe JobBookmarkEntry
jobBookmarkEntry) (\s :: ResetJobBookmarkResponse
s@ResetJobBookmarkResponse' {} Maybe JobBookmarkEntry
a -> ResetJobBookmarkResponse
s {$sel:jobBookmarkEntry:ResetJobBookmarkResponse' :: Maybe JobBookmarkEntry
jobBookmarkEntry = Maybe JobBookmarkEntry
a} :: ResetJobBookmarkResponse)

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

instance Prelude.NFData ResetJobBookmarkResponse