{-# 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.S3FileLocation
-- 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.S3FileLocation 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

-- | Specifies the details for the file location for the file that\'s being
-- used in the workflow. Only applicable if you are using S3 storage.
--
-- /See:/ 'newS3FileLocation' smart constructor.
data S3FileLocation = S3FileLocation'
  { -- | Specifies the S3 bucket that contains the file being used.
    S3FileLocation -> Maybe Text
bucket :: Prelude.Maybe Prelude.Text,
    -- | The entity tag is a hash of the object. The ETag reflects changes only
    -- to the contents of an object, not its metadata.
    S3FileLocation -> Maybe Text
etag :: Prelude.Maybe Prelude.Text,
    -- | The name assigned to the file when it was created in Amazon S3. You use
    -- the object key to retrieve the object.
    S3FileLocation -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | Specifies the file version.
    S3FileLocation -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text
  }
  deriving (S3FileLocation -> S3FileLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3FileLocation -> S3FileLocation -> Bool
$c/= :: S3FileLocation -> S3FileLocation -> Bool
== :: S3FileLocation -> S3FileLocation -> Bool
$c== :: S3FileLocation -> S3FileLocation -> Bool
Prelude.Eq, ReadPrec [S3FileLocation]
ReadPrec S3FileLocation
Int -> ReadS S3FileLocation
ReadS [S3FileLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3FileLocation]
$creadListPrec :: ReadPrec [S3FileLocation]
readPrec :: ReadPrec S3FileLocation
$creadPrec :: ReadPrec S3FileLocation
readList :: ReadS [S3FileLocation]
$creadList :: ReadS [S3FileLocation]
readsPrec :: Int -> ReadS S3FileLocation
$creadsPrec :: Int -> ReadS S3FileLocation
Prelude.Read, Int -> S3FileLocation -> ShowS
[S3FileLocation] -> ShowS
S3FileLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3FileLocation] -> ShowS
$cshowList :: [S3FileLocation] -> ShowS
show :: S3FileLocation -> String
$cshow :: S3FileLocation -> String
showsPrec :: Int -> S3FileLocation -> ShowS
$cshowsPrec :: Int -> S3FileLocation -> ShowS
Prelude.Show, forall x. Rep S3FileLocation x -> S3FileLocation
forall x. S3FileLocation -> Rep S3FileLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3FileLocation x -> S3FileLocation
$cfrom :: forall x. S3FileLocation -> Rep S3FileLocation x
Prelude.Generic)

-- |
-- Create a value of 'S3FileLocation' 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:
--
-- 'bucket', 's3FileLocation_bucket' - Specifies the S3 bucket that contains the file being used.
--
-- 'etag', 's3FileLocation_etag' - The entity tag is a hash of the object. The ETag reflects changes only
-- to the contents of an object, not its metadata.
--
-- 'key', 's3FileLocation_key' - The name assigned to the file when it was created in Amazon S3. You use
-- the object key to retrieve the object.
--
-- 'versionId', 's3FileLocation_versionId' - Specifies the file version.
newS3FileLocation ::
  S3FileLocation
newS3FileLocation :: S3FileLocation
newS3FileLocation =
  S3FileLocation'
    { $sel:bucket:S3FileLocation' :: Maybe Text
bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:etag:S3FileLocation' :: Maybe Text
etag = forall a. Maybe a
Prelude.Nothing,
      $sel:key:S3FileLocation' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:S3FileLocation' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the S3 bucket that contains the file being used.
s3FileLocation_bucket :: Lens.Lens' S3FileLocation (Prelude.Maybe Prelude.Text)
s3FileLocation_bucket :: Lens' S3FileLocation (Maybe Text)
s3FileLocation_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3FileLocation' {Maybe Text
bucket :: Maybe Text
$sel:bucket:S3FileLocation' :: S3FileLocation -> Maybe Text
bucket} -> Maybe Text
bucket) (\s :: S3FileLocation
s@S3FileLocation' {} Maybe Text
a -> S3FileLocation
s {$sel:bucket:S3FileLocation' :: Maybe Text
bucket = Maybe Text
a} :: S3FileLocation)

-- | The entity tag is a hash of the object. The ETag reflects changes only
-- to the contents of an object, not its metadata.
s3FileLocation_etag :: Lens.Lens' S3FileLocation (Prelude.Maybe Prelude.Text)
s3FileLocation_etag :: Lens' S3FileLocation (Maybe Text)
s3FileLocation_etag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3FileLocation' {Maybe Text
etag :: Maybe Text
$sel:etag:S3FileLocation' :: S3FileLocation -> Maybe Text
etag} -> Maybe Text
etag) (\s :: S3FileLocation
s@S3FileLocation' {} Maybe Text
a -> S3FileLocation
s {$sel:etag:S3FileLocation' :: Maybe Text
etag = Maybe Text
a} :: S3FileLocation)

-- | The name assigned to the file when it was created in Amazon S3. You use
-- the object key to retrieve the object.
s3FileLocation_key :: Lens.Lens' S3FileLocation (Prelude.Maybe Prelude.Text)
s3FileLocation_key :: Lens' S3FileLocation (Maybe Text)
s3FileLocation_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3FileLocation' {Maybe Text
key :: Maybe Text
$sel:key:S3FileLocation' :: S3FileLocation -> Maybe Text
key} -> Maybe Text
key) (\s :: S3FileLocation
s@S3FileLocation' {} Maybe Text
a -> S3FileLocation
s {$sel:key:S3FileLocation' :: Maybe Text
key = Maybe Text
a} :: S3FileLocation)

-- | Specifies the file version.
s3FileLocation_versionId :: Lens.Lens' S3FileLocation (Prelude.Maybe Prelude.Text)
s3FileLocation_versionId :: Lens' S3FileLocation (Maybe Text)
s3FileLocation_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3FileLocation' {Maybe Text
versionId :: Maybe Text
$sel:versionId:S3FileLocation' :: S3FileLocation -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: S3FileLocation
s@S3FileLocation' {} Maybe Text
a -> S3FileLocation
s {$sel:versionId:S3FileLocation' :: Maybe Text
versionId = Maybe Text
a} :: S3FileLocation)

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

instance Prelude.Hashable S3FileLocation where
  hashWithSalt :: Int -> S3FileLocation -> Int
hashWithSalt Int
_salt S3FileLocation' {Maybe Text
versionId :: Maybe Text
key :: Maybe Text
etag :: Maybe Text
bucket :: Maybe Text
$sel:versionId:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:key:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:etag:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:bucket:S3FileLocation' :: S3FileLocation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
etag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId

instance Prelude.NFData S3FileLocation where
  rnf :: S3FileLocation -> ()
rnf S3FileLocation' {Maybe Text
versionId :: Maybe Text
key :: Maybe Text
etag :: Maybe Text
bucket :: Maybe Text
$sel:versionId:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:key:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:etag:S3FileLocation' :: S3FileLocation -> Maybe Text
$sel:bucket:S3FileLocation' :: S3FileLocation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
etag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId