{-# 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.Transfer.Types.FileLocation
-- 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.Transfer.Types.FileLocation 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
import Amazonka.Transfer.Types.EfsFileLocation
import Amazonka.Transfer.Types.S3FileLocation

-- | Specifies the Amazon S3 or EFS file details to be used in the step.
--
-- /See:/ 'newFileLocation' smart constructor.
data FileLocation = FileLocation'
  { -- | Specifies the Amazon EFS identifier and the path for the file being
    -- used.
    FileLocation -> Maybe EfsFileLocation
efsFileLocation :: Prelude.Maybe EfsFileLocation,
    -- | Specifies the S3 details for the file being used, such as bucket, ETag,
    -- and so forth.
    FileLocation -> Maybe S3FileLocation
s3FileLocation :: Prelude.Maybe S3FileLocation
  }
  deriving (FileLocation -> FileLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileLocation -> FileLocation -> Bool
$c/= :: FileLocation -> FileLocation -> Bool
== :: FileLocation -> FileLocation -> Bool
$c== :: FileLocation -> FileLocation -> Bool
Prelude.Eq, ReadPrec [FileLocation]
ReadPrec FileLocation
Int -> ReadS FileLocation
ReadS [FileLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileLocation]
$creadListPrec :: ReadPrec [FileLocation]
readPrec :: ReadPrec FileLocation
$creadPrec :: ReadPrec FileLocation
readList :: ReadS [FileLocation]
$creadList :: ReadS [FileLocation]
readsPrec :: Int -> ReadS FileLocation
$creadsPrec :: Int -> ReadS FileLocation
Prelude.Read, Int -> FileLocation -> ShowS
[FileLocation] -> ShowS
FileLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileLocation] -> ShowS
$cshowList :: [FileLocation] -> ShowS
show :: FileLocation -> String
$cshow :: FileLocation -> String
showsPrec :: Int -> FileLocation -> ShowS
$cshowsPrec :: Int -> FileLocation -> ShowS
Prelude.Show, forall x. Rep FileLocation x -> FileLocation
forall x. FileLocation -> Rep FileLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileLocation x -> FileLocation
$cfrom :: forall x. FileLocation -> Rep FileLocation x
Prelude.Generic)

-- |
-- Create a value of 'FileLocation' 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:
--
-- 'efsFileLocation', 'fileLocation_efsFileLocation' - Specifies the Amazon EFS identifier and the path for the file being
-- used.
--
-- 's3FileLocation', 'fileLocation_s3FileLocation' - Specifies the S3 details for the file being used, such as bucket, ETag,
-- and so forth.
newFileLocation ::
  FileLocation
newFileLocation :: FileLocation
newFileLocation =
  FileLocation'
    { $sel:efsFileLocation:FileLocation' :: Maybe EfsFileLocation
efsFileLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:s3FileLocation:FileLocation' :: Maybe S3FileLocation
s3FileLocation = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the Amazon EFS identifier and the path for the file being
-- used.
fileLocation_efsFileLocation :: Lens.Lens' FileLocation (Prelude.Maybe EfsFileLocation)
fileLocation_efsFileLocation :: Lens' FileLocation (Maybe EfsFileLocation)
fileLocation_efsFileLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileLocation' {Maybe EfsFileLocation
efsFileLocation :: Maybe EfsFileLocation
$sel:efsFileLocation:FileLocation' :: FileLocation -> Maybe EfsFileLocation
efsFileLocation} -> Maybe EfsFileLocation
efsFileLocation) (\s :: FileLocation
s@FileLocation' {} Maybe EfsFileLocation
a -> FileLocation
s {$sel:efsFileLocation:FileLocation' :: Maybe EfsFileLocation
efsFileLocation = Maybe EfsFileLocation
a} :: FileLocation)

-- | Specifies the S3 details for the file being used, such as bucket, ETag,
-- and so forth.
fileLocation_s3FileLocation :: Lens.Lens' FileLocation (Prelude.Maybe S3FileLocation)
fileLocation_s3FileLocation :: Lens' FileLocation (Maybe S3FileLocation)
fileLocation_s3FileLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileLocation' {Maybe S3FileLocation
s3FileLocation :: Maybe S3FileLocation
$sel:s3FileLocation:FileLocation' :: FileLocation -> Maybe S3FileLocation
s3FileLocation} -> Maybe S3FileLocation
s3FileLocation) (\s :: FileLocation
s@FileLocation' {} Maybe S3FileLocation
a -> FileLocation
s {$sel:s3FileLocation:FileLocation' :: Maybe S3FileLocation
s3FileLocation = Maybe S3FileLocation
a} :: FileLocation)

instance Data.FromJSON FileLocation where
  parseJSON :: Value -> Parser FileLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileLocation"
      ( \Object
x ->
          Maybe EfsFileLocation -> Maybe S3FileLocation -> FileLocation
FileLocation'
            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
"EfsFileLocation")
            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
"S3FileLocation")
      )

instance Prelude.Hashable FileLocation where
  hashWithSalt :: Int -> FileLocation -> Int
hashWithSalt Int
_salt FileLocation' {Maybe EfsFileLocation
Maybe S3FileLocation
s3FileLocation :: Maybe S3FileLocation
efsFileLocation :: Maybe EfsFileLocation
$sel:s3FileLocation:FileLocation' :: FileLocation -> Maybe S3FileLocation
$sel:efsFileLocation:FileLocation' :: FileLocation -> Maybe EfsFileLocation
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EfsFileLocation
efsFileLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3FileLocation
s3FileLocation

instance Prelude.NFData FileLocation where
  rnf :: FileLocation -> ()
rnf FileLocation' {Maybe EfsFileLocation
Maybe S3FileLocation
s3FileLocation :: Maybe S3FileLocation
efsFileLocation :: Maybe EfsFileLocation
$sel:s3FileLocation:FileLocation' :: FileLocation -> Maybe S3FileLocation
$sel:efsFileLocation:FileLocation' :: FileLocation -> Maybe EfsFileLocation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EfsFileLocation
efsFileLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3FileLocation
s3FileLocation