{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.BatchStopJobRunError
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.BatchStopJobRunError 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.ErrorDetail
import qualified Amazonka.Prelude as Prelude

-- | Records an error that occurred when attempting to stop a specified job
-- run.
--
-- /See:/ 'newBatchStopJobRunError' smart constructor.
data BatchStopJobRunError = BatchStopJobRunError'
  { -- | Specifies details about the error that was encountered.
    BatchStopJobRunError -> Maybe ErrorDetail
errorDetail :: Prelude.Maybe ErrorDetail,
    -- | The name of the job definition that is used in the job run in question.
    BatchStopJobRunError -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | The @JobRunId@ of the job run in question.
    BatchStopJobRunError -> Maybe Text
jobRunId :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchStopJobRunError -> BatchStopJobRunError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchStopJobRunError -> BatchStopJobRunError -> Bool
$c/= :: BatchStopJobRunError -> BatchStopJobRunError -> Bool
== :: BatchStopJobRunError -> BatchStopJobRunError -> Bool
$c== :: BatchStopJobRunError -> BatchStopJobRunError -> Bool
Prelude.Eq, ReadPrec [BatchStopJobRunError]
ReadPrec BatchStopJobRunError
Int -> ReadS BatchStopJobRunError
ReadS [BatchStopJobRunError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchStopJobRunError]
$creadListPrec :: ReadPrec [BatchStopJobRunError]
readPrec :: ReadPrec BatchStopJobRunError
$creadPrec :: ReadPrec BatchStopJobRunError
readList :: ReadS [BatchStopJobRunError]
$creadList :: ReadS [BatchStopJobRunError]
readsPrec :: Int -> ReadS BatchStopJobRunError
$creadsPrec :: Int -> ReadS BatchStopJobRunError
Prelude.Read, Int -> BatchStopJobRunError -> ShowS
[BatchStopJobRunError] -> ShowS
BatchStopJobRunError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchStopJobRunError] -> ShowS
$cshowList :: [BatchStopJobRunError] -> ShowS
show :: BatchStopJobRunError -> String
$cshow :: BatchStopJobRunError -> String
showsPrec :: Int -> BatchStopJobRunError -> ShowS
$cshowsPrec :: Int -> BatchStopJobRunError -> ShowS
Prelude.Show, forall x. Rep BatchStopJobRunError x -> BatchStopJobRunError
forall x. BatchStopJobRunError -> Rep BatchStopJobRunError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchStopJobRunError x -> BatchStopJobRunError
$cfrom :: forall x. BatchStopJobRunError -> Rep BatchStopJobRunError x
Prelude.Generic)

-- |
-- Create a value of 'BatchStopJobRunError' 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:
--
-- 'errorDetail', 'batchStopJobRunError_errorDetail' - Specifies details about the error that was encountered.
--
-- 'jobName', 'batchStopJobRunError_jobName' - The name of the job definition that is used in the job run in question.
--
-- 'jobRunId', 'batchStopJobRunError_jobRunId' - The @JobRunId@ of the job run in question.
newBatchStopJobRunError ::
  BatchStopJobRunError
newBatchStopJobRunError :: BatchStopJobRunError
newBatchStopJobRunError =
  BatchStopJobRunError'
    { $sel:errorDetail:BatchStopJobRunError' :: Maybe ErrorDetail
errorDetail =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:BatchStopJobRunError' :: Maybe Text
jobName = forall a. Maybe a
Prelude.Nothing,
      $sel:jobRunId:BatchStopJobRunError' :: Maybe Text
jobRunId = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies details about the error that was encountered.
batchStopJobRunError_errorDetail :: Lens.Lens' BatchStopJobRunError (Prelude.Maybe ErrorDetail)
batchStopJobRunError_errorDetail :: Lens' BatchStopJobRunError (Maybe ErrorDetail)
batchStopJobRunError_errorDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchStopJobRunError' {Maybe ErrorDetail
errorDetail :: Maybe ErrorDetail
$sel:errorDetail:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe ErrorDetail
errorDetail} -> Maybe ErrorDetail
errorDetail) (\s :: BatchStopJobRunError
s@BatchStopJobRunError' {} Maybe ErrorDetail
a -> BatchStopJobRunError
s {$sel:errorDetail:BatchStopJobRunError' :: Maybe ErrorDetail
errorDetail = Maybe ErrorDetail
a} :: BatchStopJobRunError)

-- | The name of the job definition that is used in the job run in question.
batchStopJobRunError_jobName :: Lens.Lens' BatchStopJobRunError (Prelude.Maybe Prelude.Text)
batchStopJobRunError_jobName :: Lens' BatchStopJobRunError (Maybe Text)
batchStopJobRunError_jobName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchStopJobRunError' {Maybe Text
jobName :: Maybe Text
$sel:jobName:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: BatchStopJobRunError
s@BatchStopJobRunError' {} Maybe Text
a -> BatchStopJobRunError
s {$sel:jobName:BatchStopJobRunError' :: Maybe Text
jobName = Maybe Text
a} :: BatchStopJobRunError)

-- | The @JobRunId@ of the job run in question.
batchStopJobRunError_jobRunId :: Lens.Lens' BatchStopJobRunError (Prelude.Maybe Prelude.Text)
batchStopJobRunError_jobRunId :: Lens' BatchStopJobRunError (Maybe Text)
batchStopJobRunError_jobRunId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchStopJobRunError' {Maybe Text
jobRunId :: Maybe Text
$sel:jobRunId:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe Text
jobRunId} -> Maybe Text
jobRunId) (\s :: BatchStopJobRunError
s@BatchStopJobRunError' {} Maybe Text
a -> BatchStopJobRunError
s {$sel:jobRunId:BatchStopJobRunError' :: Maybe Text
jobRunId = Maybe Text
a} :: BatchStopJobRunError)

instance Data.FromJSON BatchStopJobRunError where
  parseJSON :: Value -> Parser BatchStopJobRunError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchStopJobRunError"
      ( \Object
x ->
          Maybe ErrorDetail
-> Maybe Text -> Maybe Text -> BatchStopJobRunError
BatchStopJobRunError'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ErrorDetail")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobRunId")
      )

instance Prelude.Hashable BatchStopJobRunError where
  hashWithSalt :: Int -> BatchStopJobRunError -> Int
hashWithSalt Int
_salt BatchStopJobRunError' {Maybe Text
Maybe ErrorDetail
jobRunId :: Maybe Text
jobName :: Maybe Text
errorDetail :: Maybe ErrorDetail
$sel:jobRunId:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe Text
$sel:jobName:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe Text
$sel:errorDetail:BatchStopJobRunError' :: BatchStopJobRunError -> Maybe ErrorDetail
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorDetail
errorDetail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobRunId

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