{-# 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.BatchJobIdentifier
-- 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.BatchJobIdentifier 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.FileBatchJobIdentifier
import Amazonka.M2.Types.ScriptBatchJobIdentifier
import qualified Amazonka.Prelude as Prelude

-- | Identifies a specific batch job.
--
-- /See:/ 'newBatchJobIdentifier' smart constructor.
data BatchJobIdentifier = BatchJobIdentifier'
  { -- | Specifies a file associated with a specific batch job.
    BatchJobIdentifier -> Maybe FileBatchJobIdentifier
fileBatchJobIdentifier :: Prelude.Maybe FileBatchJobIdentifier,
    -- | A batch job identifier in which the batch job to run is identified by
    -- the script name.
    BatchJobIdentifier -> Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier :: Prelude.Maybe ScriptBatchJobIdentifier
  }
  deriving (BatchJobIdentifier -> BatchJobIdentifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchJobIdentifier -> BatchJobIdentifier -> Bool
$c/= :: BatchJobIdentifier -> BatchJobIdentifier -> Bool
== :: BatchJobIdentifier -> BatchJobIdentifier -> Bool
$c== :: BatchJobIdentifier -> BatchJobIdentifier -> Bool
Prelude.Eq, ReadPrec [BatchJobIdentifier]
ReadPrec BatchJobIdentifier
Int -> ReadS BatchJobIdentifier
ReadS [BatchJobIdentifier]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchJobIdentifier]
$creadListPrec :: ReadPrec [BatchJobIdentifier]
readPrec :: ReadPrec BatchJobIdentifier
$creadPrec :: ReadPrec BatchJobIdentifier
readList :: ReadS [BatchJobIdentifier]
$creadList :: ReadS [BatchJobIdentifier]
readsPrec :: Int -> ReadS BatchJobIdentifier
$creadsPrec :: Int -> ReadS BatchJobIdentifier
Prelude.Read, Int -> BatchJobIdentifier -> ShowS
[BatchJobIdentifier] -> ShowS
BatchJobIdentifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchJobIdentifier] -> ShowS
$cshowList :: [BatchJobIdentifier] -> ShowS
show :: BatchJobIdentifier -> String
$cshow :: BatchJobIdentifier -> String
showsPrec :: Int -> BatchJobIdentifier -> ShowS
$cshowsPrec :: Int -> BatchJobIdentifier -> ShowS
Prelude.Show, forall x. Rep BatchJobIdentifier x -> BatchJobIdentifier
forall x. BatchJobIdentifier -> Rep BatchJobIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchJobIdentifier x -> BatchJobIdentifier
$cfrom :: forall x. BatchJobIdentifier -> Rep BatchJobIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'BatchJobIdentifier' 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:
--
-- 'fileBatchJobIdentifier', 'batchJobIdentifier_fileBatchJobIdentifier' - Specifies a file associated with a specific batch job.
--
-- 'scriptBatchJobIdentifier', 'batchJobIdentifier_scriptBatchJobIdentifier' - A batch job identifier in which the batch job to run is identified by
-- the script name.
newBatchJobIdentifier ::
  BatchJobIdentifier
newBatchJobIdentifier :: BatchJobIdentifier
newBatchJobIdentifier =
  BatchJobIdentifier'
    { $sel:fileBatchJobIdentifier:BatchJobIdentifier' :: Maybe FileBatchJobIdentifier
fileBatchJobIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies a file associated with a specific batch job.
batchJobIdentifier_fileBatchJobIdentifier :: Lens.Lens' BatchJobIdentifier (Prelude.Maybe FileBatchJobIdentifier)
batchJobIdentifier_fileBatchJobIdentifier :: Lens' BatchJobIdentifier (Maybe FileBatchJobIdentifier)
batchJobIdentifier_fileBatchJobIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobIdentifier' {Maybe FileBatchJobIdentifier
fileBatchJobIdentifier :: Maybe FileBatchJobIdentifier
$sel:fileBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe FileBatchJobIdentifier
fileBatchJobIdentifier} -> Maybe FileBatchJobIdentifier
fileBatchJobIdentifier) (\s :: BatchJobIdentifier
s@BatchJobIdentifier' {} Maybe FileBatchJobIdentifier
a -> BatchJobIdentifier
s {$sel:fileBatchJobIdentifier:BatchJobIdentifier' :: Maybe FileBatchJobIdentifier
fileBatchJobIdentifier = Maybe FileBatchJobIdentifier
a} :: BatchJobIdentifier)

-- | A batch job identifier in which the batch job to run is identified by
-- the script name.
batchJobIdentifier_scriptBatchJobIdentifier :: Lens.Lens' BatchJobIdentifier (Prelude.Maybe ScriptBatchJobIdentifier)
batchJobIdentifier_scriptBatchJobIdentifier :: Lens' BatchJobIdentifier (Maybe ScriptBatchJobIdentifier)
batchJobIdentifier_scriptBatchJobIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobIdentifier' {Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier :: Maybe ScriptBatchJobIdentifier
$sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier} -> Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier) (\s :: BatchJobIdentifier
s@BatchJobIdentifier' {} Maybe ScriptBatchJobIdentifier
a -> BatchJobIdentifier
s {$sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier = Maybe ScriptBatchJobIdentifier
a} :: BatchJobIdentifier)

instance Prelude.Hashable BatchJobIdentifier where
  hashWithSalt :: Int -> BatchJobIdentifier -> Int
hashWithSalt Int
_salt BatchJobIdentifier' {Maybe FileBatchJobIdentifier
Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier :: Maybe ScriptBatchJobIdentifier
fileBatchJobIdentifier :: Maybe FileBatchJobIdentifier
$sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe ScriptBatchJobIdentifier
$sel:fileBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe FileBatchJobIdentifier
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileBatchJobIdentifier
fileBatchJobIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier

instance Prelude.NFData BatchJobIdentifier where
  rnf :: BatchJobIdentifier -> ()
rnf BatchJobIdentifier' {Maybe FileBatchJobIdentifier
Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier :: Maybe ScriptBatchJobIdentifier
fileBatchJobIdentifier :: Maybe FileBatchJobIdentifier
$sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe ScriptBatchJobIdentifier
$sel:fileBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe FileBatchJobIdentifier
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FileBatchJobIdentifier
fileBatchJobIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier

instance Data.ToJSON BatchJobIdentifier where
  toJSON :: BatchJobIdentifier -> Value
toJSON BatchJobIdentifier' {Maybe FileBatchJobIdentifier
Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier :: Maybe ScriptBatchJobIdentifier
fileBatchJobIdentifier :: Maybe FileBatchJobIdentifier
$sel:scriptBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe ScriptBatchJobIdentifier
$sel:fileBatchJobIdentifier:BatchJobIdentifier' :: BatchJobIdentifier -> Maybe FileBatchJobIdentifier
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"fileBatchJobIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileBatchJobIdentifier
fileBatchJobIdentifier,
            (Key
"scriptBatchJobIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScriptBatchJobIdentifier
scriptBatchJobIdentifier
          ]
      )