{-# 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.S3.Types.S3Location
-- 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.S3.Types.S3Location 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.S3.Internal
import Amazonka.S3.Types.Encryption
import Amazonka.S3.Types.Grant
import Amazonka.S3.Types.MetadataEntry
import Amazonka.S3.Types.ObjectCannedACL
import Amazonka.S3.Types.StorageClass
import Amazonka.S3.Types.Tagging

-- | Describes an Amazon S3 location that will receive the results of the
-- restore request.
--
-- /See:/ 'newS3Location' smart constructor.
data S3Location = S3Location'
  { -- | A list of grants that control access to the staged results.
    S3Location -> Maybe [Grant]
accessControlList :: Prelude.Maybe [Grant],
    -- | The canned ACL to apply to the restore results.
    S3Location -> Maybe ObjectCannedACL
cannedACL :: Prelude.Maybe ObjectCannedACL,
    S3Location -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | The class of storage used to store the restore results.
    S3Location -> Maybe StorageClass
storageClass :: Prelude.Maybe StorageClass,
    -- | The tag-set that is applied to the restore results.
    S3Location -> Maybe Tagging
tagging :: Prelude.Maybe Tagging,
    -- | A list of metadata to store with the restore results in S3.
    S3Location -> Maybe [MetadataEntry]
userMetadata :: Prelude.Maybe [MetadataEntry],
    -- | The name of the bucket where the restore results will be placed.
    S3Location -> BucketName
bucketName :: BucketName,
    -- | The prefix that is prepended to the restore results for this request.
    S3Location -> Text
prefix :: Prelude.Text
  }
  deriving (S3Location -> S3Location -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Location -> S3Location -> Bool
$c/= :: S3Location -> S3Location -> Bool
== :: S3Location -> S3Location -> Bool
$c== :: S3Location -> S3Location -> Bool
Prelude.Eq, Int -> S3Location -> ShowS
[S3Location] -> ShowS
S3Location -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Location] -> ShowS
$cshowList :: [S3Location] -> ShowS
show :: S3Location -> String
$cshow :: S3Location -> String
showsPrec :: Int -> S3Location -> ShowS
$cshowsPrec :: Int -> S3Location -> ShowS
Prelude.Show, forall x. Rep S3Location x -> S3Location
forall x. S3Location -> Rep S3Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Location x -> S3Location
$cfrom :: forall x. S3Location -> Rep S3Location x
Prelude.Generic)

-- |
-- Create a value of 'S3Location' 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:
--
-- 'accessControlList', 's3Location_accessControlList' - A list of grants that control access to the staged results.
--
-- 'cannedACL', 's3Location_cannedACL' - The canned ACL to apply to the restore results.
--
-- 'encryption', 's3Location_encryption' - Undocumented member.
--
-- 'storageClass', 's3Location_storageClass' - The class of storage used to store the restore results.
--
-- 'tagging', 's3Location_tagging' - The tag-set that is applied to the restore results.
--
-- 'userMetadata', 's3Location_userMetadata' - A list of metadata to store with the restore results in S3.
--
-- 'bucketName', 's3Location_bucketName' - The name of the bucket where the restore results will be placed.
--
-- 'prefix', 's3Location_prefix' - The prefix that is prepended to the restore results for this request.
newS3Location ::
  -- | 'bucketName'
  BucketName ->
  -- | 'prefix'
  Prelude.Text ->
  S3Location
newS3Location :: BucketName -> Text -> S3Location
newS3Location BucketName
pBucketName_ Text
pPrefix_ =
  S3Location'
    { $sel:accessControlList:S3Location' :: Maybe [Grant]
accessControlList = forall a. Maybe a
Prelude.Nothing,
      $sel:cannedACL:S3Location' :: Maybe ObjectCannedACL
cannedACL = forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:S3Location' :: Maybe Encryption
encryption = forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:S3Location' :: Maybe StorageClass
storageClass = forall a. Maybe a
Prelude.Nothing,
      $sel:tagging:S3Location' :: Maybe Tagging
tagging = forall a. Maybe a
Prelude.Nothing,
      $sel:userMetadata:S3Location' :: Maybe [MetadataEntry]
userMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:bucketName:S3Location' :: BucketName
bucketName = BucketName
pBucketName_,
      $sel:prefix:S3Location' :: Text
prefix = Text
pPrefix_
    }

-- | A list of grants that control access to the staged results.
s3Location_accessControlList :: Lens.Lens' S3Location (Prelude.Maybe [Grant])
s3Location_accessControlList :: Lens' S3Location (Maybe [Grant])
s3Location_accessControlList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe [Grant]
accessControlList :: Maybe [Grant]
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
accessControlList} -> Maybe [Grant]
accessControlList) (\s :: S3Location
s@S3Location' {} Maybe [Grant]
a -> S3Location
s {$sel:accessControlList:S3Location' :: Maybe [Grant]
accessControlList = Maybe [Grant]
a} :: S3Location) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The canned ACL to apply to the restore results.
s3Location_cannedACL :: Lens.Lens' S3Location (Prelude.Maybe ObjectCannedACL)
s3Location_cannedACL :: Lens' S3Location (Maybe ObjectCannedACL)
s3Location_cannedACL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe ObjectCannedACL
cannedACL :: Maybe ObjectCannedACL
$sel:cannedACL:S3Location' :: S3Location -> Maybe ObjectCannedACL
cannedACL} -> Maybe ObjectCannedACL
cannedACL) (\s :: S3Location
s@S3Location' {} Maybe ObjectCannedACL
a -> S3Location
s {$sel:cannedACL:S3Location' :: Maybe ObjectCannedACL
cannedACL = Maybe ObjectCannedACL
a} :: S3Location)

-- | Undocumented member.
s3Location_encryption :: Lens.Lens' S3Location (Prelude.Maybe Encryption)
s3Location_encryption :: Lens' S3Location (Maybe Encryption)
s3Location_encryption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: S3Location
s@S3Location' {} Maybe Encryption
a -> S3Location
s {$sel:encryption:S3Location' :: Maybe Encryption
encryption = Maybe Encryption
a} :: S3Location)

-- | The class of storage used to store the restore results.
s3Location_storageClass :: Lens.Lens' S3Location (Prelude.Maybe StorageClass)
s3Location_storageClass :: Lens' S3Location (Maybe StorageClass)
s3Location_storageClass = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe StorageClass
storageClass :: Maybe StorageClass
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
storageClass} -> Maybe StorageClass
storageClass) (\s :: S3Location
s@S3Location' {} Maybe StorageClass
a -> S3Location
s {$sel:storageClass:S3Location' :: Maybe StorageClass
storageClass = Maybe StorageClass
a} :: S3Location)

-- | The tag-set that is applied to the restore results.
s3Location_tagging :: Lens.Lens' S3Location (Prelude.Maybe Tagging)
s3Location_tagging :: Lens' S3Location (Maybe Tagging)
s3Location_tagging = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe Tagging
tagging :: Maybe Tagging
$sel:tagging:S3Location' :: S3Location -> Maybe Tagging
tagging} -> Maybe Tagging
tagging) (\s :: S3Location
s@S3Location' {} Maybe Tagging
a -> S3Location
s {$sel:tagging:S3Location' :: Maybe Tagging
tagging = Maybe Tagging
a} :: S3Location)

-- | A list of metadata to store with the restore results in S3.
s3Location_userMetadata :: Lens.Lens' S3Location (Prelude.Maybe [MetadataEntry])
s3Location_userMetadata :: Lens' S3Location (Maybe [MetadataEntry])
s3Location_userMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe [MetadataEntry]
userMetadata :: Maybe [MetadataEntry]
$sel:userMetadata:S3Location' :: S3Location -> Maybe [MetadataEntry]
userMetadata} -> Maybe [MetadataEntry]
userMetadata) (\s :: S3Location
s@S3Location' {} Maybe [MetadataEntry]
a -> S3Location
s {$sel:userMetadata:S3Location' :: Maybe [MetadataEntry]
userMetadata = Maybe [MetadataEntry]
a} :: S3Location) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the bucket where the restore results will be placed.
s3Location_bucketName :: Lens.Lens' S3Location BucketName
s3Location_bucketName :: Lens' S3Location BucketName
s3Location_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {BucketName
bucketName :: BucketName
$sel:bucketName:S3Location' :: S3Location -> BucketName
bucketName} -> BucketName
bucketName) (\s :: S3Location
s@S3Location' {} BucketName
a -> S3Location
s {$sel:bucketName:S3Location' :: BucketName
bucketName = BucketName
a} :: S3Location)

-- | The prefix that is prepended to the restore results for this request.
s3Location_prefix :: Lens.Lens' S3Location Prelude.Text
s3Location_prefix :: Lens' S3Location Text
s3Location_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Text
prefix :: Text
$sel:prefix:S3Location' :: S3Location -> Text
prefix} -> Text
prefix) (\s :: S3Location
s@S3Location' {} Text
a -> S3Location
s {$sel:prefix:S3Location' :: Text
prefix = Text
a} :: S3Location)

instance Prelude.Hashable S3Location where
  hashWithSalt :: Int -> S3Location -> Int
hashWithSalt Int
_salt S3Location' {Maybe [MetadataEntry]
Maybe [Grant]
Maybe ObjectCannedACL
Maybe Encryption
Maybe StorageClass
Maybe Tagging
Text
BucketName
prefix :: Text
bucketName :: BucketName
userMetadata :: Maybe [MetadataEntry]
tagging :: Maybe Tagging
storageClass :: Maybe StorageClass
encryption :: Maybe Encryption
cannedACL :: Maybe ObjectCannedACL
accessControlList :: Maybe [Grant]
$sel:prefix:S3Location' :: S3Location -> Text
$sel:bucketName:S3Location' :: S3Location -> BucketName
$sel:userMetadata:S3Location' :: S3Location -> Maybe [MetadataEntry]
$sel:tagging:S3Location' :: S3Location -> Maybe Tagging
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
$sel:cannedACL:S3Location' :: S3Location -> Maybe ObjectCannedACL
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Grant]
accessControlList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ObjectCannedACL
cannedACL
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Encryption
encryption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StorageClass
storageClass
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Tagging
tagging
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MetadataEntry]
userMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BucketName
bucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
prefix

instance Prelude.NFData S3Location where
  rnf :: S3Location -> ()
rnf S3Location' {Maybe [MetadataEntry]
Maybe [Grant]
Maybe ObjectCannedACL
Maybe Encryption
Maybe StorageClass
Maybe Tagging
Text
BucketName
prefix :: Text
bucketName :: BucketName
userMetadata :: Maybe [MetadataEntry]
tagging :: Maybe Tagging
storageClass :: Maybe StorageClass
encryption :: Maybe Encryption
cannedACL :: Maybe ObjectCannedACL
accessControlList :: Maybe [Grant]
$sel:prefix:S3Location' :: S3Location -> Text
$sel:bucketName:S3Location' :: S3Location -> BucketName
$sel:userMetadata:S3Location' :: S3Location -> Maybe [MetadataEntry]
$sel:tagging:S3Location' :: S3Location -> Maybe Tagging
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
$sel:cannedACL:S3Location' :: S3Location -> Maybe ObjectCannedACL
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Grant]
accessControlList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ObjectCannedACL
cannedACL
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Encryption
encryption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StorageClass
storageClass
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Tagging
tagging
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetadataEntry]
userMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BucketName
bucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
prefix

instance Data.ToXML S3Location where
  toXML :: S3Location -> XML
toXML S3Location' {Maybe [MetadataEntry]
Maybe [Grant]
Maybe ObjectCannedACL
Maybe Encryption
Maybe StorageClass
Maybe Tagging
Text
BucketName
prefix :: Text
bucketName :: BucketName
userMetadata :: Maybe [MetadataEntry]
tagging :: Maybe Tagging
storageClass :: Maybe StorageClass
encryption :: Maybe Encryption
cannedACL :: Maybe ObjectCannedACL
accessControlList :: Maybe [Grant]
$sel:prefix:S3Location' :: S3Location -> Text
$sel:bucketName:S3Location' :: S3Location -> BucketName
$sel:userMetadata:S3Location' :: S3Location -> Maybe [MetadataEntry]
$sel:tagging:S3Location' :: S3Location -> Maybe Tagging
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
$sel:cannedACL:S3Location' :: S3Location -> Maybe ObjectCannedACL
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"AccessControlList"
          forall a. ToXML a => Name -> a -> XML
Data.@= forall a. ToXML a => a -> XML
Data.toXML
            ( forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Grant"
                forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Grant]
accessControlList
            ),
        Name
"CannedACL" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe ObjectCannedACL
cannedACL,
        Name
"Encryption" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Encryption
encryption,
        Name
"StorageClass" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe StorageClass
storageClass,
        Name
"Tagging" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Tagging
tagging,
        Name
"UserMetadata"
          forall a. ToXML a => Name -> a -> XML
Data.@= forall a. ToXML a => a -> XML
Data.toXML
            ( forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"MetadataEntry"
                forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetadataEntry]
userMetadata
            ),
        Name
"BucketName" forall a. ToXML a => Name -> a -> XML
Data.@= BucketName
bucketName,
        Name
"Prefix" forall a. ToXML a => Name -> a -> XML
Data.@= Text
prefix
      ]