{-# 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-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)
module Amazonka.Glue.Types.BatchStopJobRunError where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.ErrorDetail
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | Specifies details about the error that was encountered.
    BatchStopJobRunError -> Maybe ErrorDetail
errorDetail :: Prelude.Maybe ErrorDetail
  }
  deriving (BatchStopJobRunError -> BatchStopJobRunError -> Bool
(BatchStopJobRunError -> BatchStopJobRunError -> Bool)
-> (BatchStopJobRunError -> BatchStopJobRunError -> Bool)
-> Eq BatchStopJobRunError
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]
(Int -> ReadS BatchStopJobRunError)
-> ReadS [BatchStopJobRunError]
-> ReadPrec BatchStopJobRunError
-> ReadPrec [BatchStopJobRunError]
-> Read 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
(Int -> BatchStopJobRunError -> ShowS)
-> (BatchStopJobRunError -> String)
-> ([BatchStopJobRunError] -> ShowS)
-> Show BatchStopJobRunError
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. BatchStopJobRunError -> Rep BatchStopJobRunError x)
-> (forall x. Rep BatchStopJobRunError x -> BatchStopJobRunError)
-> Generic BatchStopJobRunError
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:
--
-- '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.
--
-- 'errorDetail', 'batchStopJobRunError_errorDetail' - Specifies details about the error that was encountered.
newBatchStopJobRunError ::
  BatchStopJobRunError
newBatchStopJobRunError :: BatchStopJobRunError
newBatchStopJobRunError =
  BatchStopJobRunError' :: Maybe Text
-> Maybe Text -> Maybe ErrorDetail -> BatchStopJobRunError
BatchStopJobRunError'
    { $sel:jobName:BatchStopJobRunError' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobRunId:BatchStopJobRunError' :: Maybe Text
jobRunId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorDetail:BatchStopJobRunError' :: Maybe ErrorDetail
errorDetail = Maybe ErrorDetail
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> BatchStopJobRunError -> f BatchStopJobRunError
batchStopJobRunError_jobName = (BatchStopJobRunError -> Maybe Text)
-> (BatchStopJobRunError -> Maybe Text -> BatchStopJobRunError)
-> Lens
     BatchStopJobRunError BatchStopJobRunError (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> BatchStopJobRunError -> f BatchStopJobRunError
batchStopJobRunError_jobRunId = (BatchStopJobRunError -> Maybe Text)
-> (BatchStopJobRunError -> Maybe Text -> BatchStopJobRunError)
-> Lens
     BatchStopJobRunError BatchStopJobRunError (Maybe Text) (Maybe Text)
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)

-- | Specifies details about the error that was encountered.
batchStopJobRunError_errorDetail :: Lens.Lens' BatchStopJobRunError (Prelude.Maybe ErrorDetail)
batchStopJobRunError_errorDetail :: (Maybe ErrorDetail -> f (Maybe ErrorDetail))
-> BatchStopJobRunError -> f BatchStopJobRunError
batchStopJobRunError_errorDetail = (BatchStopJobRunError -> Maybe ErrorDetail)
-> (BatchStopJobRunError
    -> Maybe ErrorDetail -> BatchStopJobRunError)
-> Lens
     BatchStopJobRunError
     BatchStopJobRunError
     (Maybe ErrorDetail)
     (Maybe 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)

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

instance Prelude.Hashable BatchStopJobRunError

instance Prelude.NFData BatchStopJobRunError