{-# 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.FileBatchJobIdentifier
-- 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.FileBatchJobIdentifier where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A batch job identifier in which the batch job to run is identified by
-- the file name and the relative path to the file name.
--
-- /See:/ 'newFileBatchJobIdentifier' smart constructor.
data FileBatchJobIdentifier = FileBatchJobIdentifier'
  { -- | The relative path to the file name for the batch job identifier.
    FileBatchJobIdentifier -> Maybe Text
folderPath :: Prelude.Maybe Prelude.Text,
    -- | The file name for the batch job identifier.
    FileBatchJobIdentifier -> Text
fileName :: Prelude.Text
  }
  deriving (FileBatchJobIdentifier -> FileBatchJobIdentifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileBatchJobIdentifier -> FileBatchJobIdentifier -> Bool
$c/= :: FileBatchJobIdentifier -> FileBatchJobIdentifier -> Bool
== :: FileBatchJobIdentifier -> FileBatchJobIdentifier -> Bool
$c== :: FileBatchJobIdentifier -> FileBatchJobIdentifier -> Bool
Prelude.Eq, ReadPrec [FileBatchJobIdentifier]
ReadPrec FileBatchJobIdentifier
Int -> ReadS FileBatchJobIdentifier
ReadS [FileBatchJobIdentifier]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileBatchJobIdentifier]
$creadListPrec :: ReadPrec [FileBatchJobIdentifier]
readPrec :: ReadPrec FileBatchJobIdentifier
$creadPrec :: ReadPrec FileBatchJobIdentifier
readList :: ReadS [FileBatchJobIdentifier]
$creadList :: ReadS [FileBatchJobIdentifier]
readsPrec :: Int -> ReadS FileBatchJobIdentifier
$creadsPrec :: Int -> ReadS FileBatchJobIdentifier
Prelude.Read, Int -> FileBatchJobIdentifier -> ShowS
[FileBatchJobIdentifier] -> ShowS
FileBatchJobIdentifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileBatchJobIdentifier] -> ShowS
$cshowList :: [FileBatchJobIdentifier] -> ShowS
show :: FileBatchJobIdentifier -> String
$cshow :: FileBatchJobIdentifier -> String
showsPrec :: Int -> FileBatchJobIdentifier -> ShowS
$cshowsPrec :: Int -> FileBatchJobIdentifier -> ShowS
Prelude.Show, forall x. Rep FileBatchJobIdentifier x -> FileBatchJobIdentifier
forall x. FileBatchJobIdentifier -> Rep FileBatchJobIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileBatchJobIdentifier x -> FileBatchJobIdentifier
$cfrom :: forall x. FileBatchJobIdentifier -> Rep FileBatchJobIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'FileBatchJobIdentifier' 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:
--
-- 'folderPath', 'fileBatchJobIdentifier_folderPath' - The relative path to the file name for the batch job identifier.
--
-- 'fileName', 'fileBatchJobIdentifier_fileName' - The file name for the batch job identifier.
newFileBatchJobIdentifier ::
  -- | 'fileName'
  Prelude.Text ->
  FileBatchJobIdentifier
newFileBatchJobIdentifier :: Text -> FileBatchJobIdentifier
newFileBatchJobIdentifier Text
pFileName_ =
  FileBatchJobIdentifier'
    { $sel:folderPath:FileBatchJobIdentifier' :: Maybe Text
folderPath =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fileName:FileBatchJobIdentifier' :: Text
fileName = Text
pFileName_
    }

-- | The relative path to the file name for the batch job identifier.
fileBatchJobIdentifier_folderPath :: Lens.Lens' FileBatchJobIdentifier (Prelude.Maybe Prelude.Text)
fileBatchJobIdentifier_folderPath :: Lens' FileBatchJobIdentifier (Maybe Text)
fileBatchJobIdentifier_folderPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileBatchJobIdentifier' {Maybe Text
folderPath :: Maybe Text
$sel:folderPath:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Maybe Text
folderPath} -> Maybe Text
folderPath) (\s :: FileBatchJobIdentifier
s@FileBatchJobIdentifier' {} Maybe Text
a -> FileBatchJobIdentifier
s {$sel:folderPath:FileBatchJobIdentifier' :: Maybe Text
folderPath = Maybe Text
a} :: FileBatchJobIdentifier)

-- | The file name for the batch job identifier.
fileBatchJobIdentifier_fileName :: Lens.Lens' FileBatchJobIdentifier Prelude.Text
fileBatchJobIdentifier_fileName :: Lens' FileBatchJobIdentifier Text
fileBatchJobIdentifier_fileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileBatchJobIdentifier' {Text
fileName :: Text
$sel:fileName:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Text
fileName} -> Text
fileName) (\s :: FileBatchJobIdentifier
s@FileBatchJobIdentifier' {} Text
a -> FileBatchJobIdentifier
s {$sel:fileName:FileBatchJobIdentifier' :: Text
fileName = Text
a} :: FileBatchJobIdentifier)

instance Prelude.Hashable FileBatchJobIdentifier where
  hashWithSalt :: Int -> FileBatchJobIdentifier -> Int
hashWithSalt Int
_salt FileBatchJobIdentifier' {Maybe Text
Text
fileName :: Text
folderPath :: Maybe Text
$sel:fileName:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Text
$sel:folderPath:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
folderPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fileName

instance Prelude.NFData FileBatchJobIdentifier where
  rnf :: FileBatchJobIdentifier -> ()
rnf FileBatchJobIdentifier' {Maybe Text
Text
fileName :: Text
folderPath :: Maybe Text
$sel:fileName:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Text
$sel:folderPath:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
folderPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fileName

instance Data.ToJSON FileBatchJobIdentifier where
  toJSON :: FileBatchJobIdentifier -> Value
toJSON FileBatchJobIdentifier' {Maybe Text
Text
fileName :: Text
folderPath :: Maybe Text
$sel:fileName:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Text
$sel:folderPath:FileBatchJobIdentifier' :: FileBatchJobIdentifier -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"folderPath" 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 Text
folderPath,
            forall a. a -> Maybe a
Prelude.Just (Key
"fileName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fileName)
          ]
      )