{-# 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.M2.Types.BatchJobDefinition
-- 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.M2.Types.BatchJobDefinition where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.FileBatchJobDefinition
import Amazonka.M2.Types.ScriptBatchJobDefinition
import qualified Amazonka.Prelude as Prelude

-- | Defines the details of a batch job.
--
-- /See:/ 'newBatchJobDefinition' smart constructor.
data BatchJobDefinition = BatchJobDefinition'
  { -- | Specifies a file containing a batch job definition.
    BatchJobDefinition -> Maybe FileBatchJobDefinition
fileBatchJobDefinition :: Prelude.Maybe FileBatchJobDefinition,
    -- | A script containing a batch job definition.
    BatchJobDefinition -> Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition :: Prelude.Maybe ScriptBatchJobDefinition
  }
  deriving (BatchJobDefinition -> BatchJobDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchJobDefinition -> BatchJobDefinition -> Bool
$c/= :: BatchJobDefinition -> BatchJobDefinition -> Bool
== :: BatchJobDefinition -> BatchJobDefinition -> Bool
$c== :: BatchJobDefinition -> BatchJobDefinition -> Bool
Prelude.Eq, ReadPrec [BatchJobDefinition]
ReadPrec BatchJobDefinition
Int -> ReadS BatchJobDefinition
ReadS [BatchJobDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchJobDefinition]
$creadListPrec :: ReadPrec [BatchJobDefinition]
readPrec :: ReadPrec BatchJobDefinition
$creadPrec :: ReadPrec BatchJobDefinition
readList :: ReadS [BatchJobDefinition]
$creadList :: ReadS [BatchJobDefinition]
readsPrec :: Int -> ReadS BatchJobDefinition
$creadsPrec :: Int -> ReadS BatchJobDefinition
Prelude.Read, Int -> BatchJobDefinition -> ShowS
[BatchJobDefinition] -> ShowS
BatchJobDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchJobDefinition] -> ShowS
$cshowList :: [BatchJobDefinition] -> ShowS
show :: BatchJobDefinition -> String
$cshow :: BatchJobDefinition -> String
showsPrec :: Int -> BatchJobDefinition -> ShowS
$cshowsPrec :: Int -> BatchJobDefinition -> ShowS
Prelude.Show, forall x. Rep BatchJobDefinition x -> BatchJobDefinition
forall x. BatchJobDefinition -> Rep BatchJobDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchJobDefinition x -> BatchJobDefinition
$cfrom :: forall x. BatchJobDefinition -> Rep BatchJobDefinition x
Prelude.Generic)

-- |
-- Create a value of 'BatchJobDefinition' 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:
--
-- 'fileBatchJobDefinition', 'batchJobDefinition_fileBatchJobDefinition' - Specifies a file containing a batch job definition.
--
-- 'scriptBatchJobDefinition', 'batchJobDefinition_scriptBatchJobDefinition' - A script containing a batch job definition.
newBatchJobDefinition ::
  BatchJobDefinition
newBatchJobDefinition :: BatchJobDefinition
newBatchJobDefinition =
  BatchJobDefinition'
    { $sel:fileBatchJobDefinition:BatchJobDefinition' :: Maybe FileBatchJobDefinition
fileBatchJobDefinition =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scriptBatchJobDefinition:BatchJobDefinition' :: Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies a file containing a batch job definition.
batchJobDefinition_fileBatchJobDefinition :: Lens.Lens' BatchJobDefinition (Prelude.Maybe FileBatchJobDefinition)
batchJobDefinition_fileBatchJobDefinition :: Lens' BatchJobDefinition (Maybe FileBatchJobDefinition)
batchJobDefinition_fileBatchJobDefinition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobDefinition' {Maybe FileBatchJobDefinition
fileBatchJobDefinition :: Maybe FileBatchJobDefinition
$sel:fileBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe FileBatchJobDefinition
fileBatchJobDefinition} -> Maybe FileBatchJobDefinition
fileBatchJobDefinition) (\s :: BatchJobDefinition
s@BatchJobDefinition' {} Maybe FileBatchJobDefinition
a -> BatchJobDefinition
s {$sel:fileBatchJobDefinition:BatchJobDefinition' :: Maybe FileBatchJobDefinition
fileBatchJobDefinition = Maybe FileBatchJobDefinition
a} :: BatchJobDefinition)

-- | A script containing a batch job definition.
batchJobDefinition_scriptBatchJobDefinition :: Lens.Lens' BatchJobDefinition (Prelude.Maybe ScriptBatchJobDefinition)
batchJobDefinition_scriptBatchJobDefinition :: Lens' BatchJobDefinition (Maybe ScriptBatchJobDefinition)
batchJobDefinition_scriptBatchJobDefinition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobDefinition' {Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition :: Maybe ScriptBatchJobDefinition
$sel:scriptBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition} -> Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition) (\s :: BatchJobDefinition
s@BatchJobDefinition' {} Maybe ScriptBatchJobDefinition
a -> BatchJobDefinition
s {$sel:scriptBatchJobDefinition:BatchJobDefinition' :: Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition = Maybe ScriptBatchJobDefinition
a} :: BatchJobDefinition)

instance Data.FromJSON BatchJobDefinition where
  parseJSON :: Value -> Parser BatchJobDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchJobDefinition"
      ( \Object
x ->
          Maybe FileBatchJobDefinition
-> Maybe ScriptBatchJobDefinition -> BatchJobDefinition
BatchJobDefinition'
            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
"fileBatchJobDefinition")
            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
"scriptBatchJobDefinition")
      )

instance Prelude.Hashable BatchJobDefinition where
  hashWithSalt :: Int -> BatchJobDefinition -> Int
hashWithSalt Int
_salt BatchJobDefinition' {Maybe FileBatchJobDefinition
Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition :: Maybe ScriptBatchJobDefinition
fileBatchJobDefinition :: Maybe FileBatchJobDefinition
$sel:scriptBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe ScriptBatchJobDefinition
$sel:fileBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe FileBatchJobDefinition
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileBatchJobDefinition
fileBatchJobDefinition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition

instance Prelude.NFData BatchJobDefinition where
  rnf :: BatchJobDefinition -> ()
rnf BatchJobDefinition' {Maybe FileBatchJobDefinition
Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition :: Maybe ScriptBatchJobDefinition
fileBatchJobDefinition :: Maybe FileBatchJobDefinition
$sel:scriptBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe ScriptBatchJobDefinition
$sel:fileBatchJobDefinition:BatchJobDefinition' :: BatchJobDefinition -> Maybe FileBatchJobDefinition
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FileBatchJobDefinition
fileBatchJobDefinition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScriptBatchJobDefinition
scriptBatchJobDefinition