{-# 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 #-}
module Amazonka.S3.Types.S3Location where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
data S3Location = S3Location'
{
S3Location -> Maybe ObjectCannedACL
cannedACL :: Prelude.Maybe ObjectCannedACL,
S3Location -> Maybe [Grant]
accessControlList :: Prelude.Maybe [Grant],
S3Location -> Maybe [MetadataEntry]
userMetadata :: Prelude.Maybe [MetadataEntry],
S3Location -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
S3Location -> Maybe StorageClass
storageClass :: Prelude.Maybe StorageClass,
S3Location -> Maybe Tagging
tagging :: Prelude.Maybe Tagging,
S3Location -> BucketName
bucketName :: BucketName,
S3Location -> Text
prefix :: Prelude.Text
}
deriving (S3Location -> S3Location -> Bool
(S3Location -> S3Location -> Bool)
-> (S3Location -> S3Location -> Bool) -> Eq S3Location
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
(Int -> S3Location -> ShowS)
-> (S3Location -> String)
-> ([S3Location] -> ShowS)
-> Show S3Location
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. S3Location -> Rep S3Location x)
-> (forall x. Rep S3Location x -> S3Location) -> Generic S3Location
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)
newS3Location ::
BucketName ->
Prelude.Text ->
S3Location
newS3Location :: BucketName -> Text -> S3Location
newS3Location BucketName
pBucketName_ Text
pPrefix_ =
S3Location' :: Maybe ObjectCannedACL
-> Maybe [Grant]
-> Maybe [MetadataEntry]
-> Maybe Encryption
-> Maybe StorageClass
-> Maybe Tagging
-> BucketName
-> Text
-> S3Location
S3Location'
{ $sel:cannedACL:S3Location' :: Maybe ObjectCannedACL
cannedACL = Maybe ObjectCannedACL
forall a. Maybe a
Prelude.Nothing,
$sel:accessControlList:S3Location' :: Maybe [Grant]
accessControlList = Maybe [Grant]
forall a. Maybe a
Prelude.Nothing,
$sel:userMetadata:S3Location' :: Maybe [MetadataEntry]
userMetadata = Maybe [MetadataEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:encryption:S3Location' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
$sel:storageClass:S3Location' :: Maybe StorageClass
storageClass = Maybe StorageClass
forall a. Maybe a
Prelude.Nothing,
$sel:tagging:S3Location' :: Maybe Tagging
tagging = Maybe Tagging
forall a. Maybe a
Prelude.Nothing,
$sel:bucketName:S3Location' :: BucketName
bucketName = BucketName
pBucketName_,
$sel:prefix:S3Location' :: Text
prefix = Text
pPrefix_
}
s3Location_cannedACL :: Lens.Lens' S3Location (Prelude.Maybe ObjectCannedACL)
s3Location_cannedACL :: (Maybe ObjectCannedACL -> f (Maybe ObjectCannedACL))
-> S3Location -> f S3Location
s3Location_cannedACL = (S3Location -> Maybe ObjectCannedACL)
-> (S3Location -> Maybe ObjectCannedACL -> S3Location)
-> Lens
S3Location
S3Location
(Maybe ObjectCannedACL)
(Maybe ObjectCannedACL)
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)
s3Location_accessControlList :: Lens.Lens' S3Location (Prelude.Maybe [Grant])
s3Location_accessControlList :: (Maybe [Grant] -> f (Maybe [Grant])) -> S3Location -> f S3Location
s3Location_accessControlList = (S3Location -> Maybe [Grant])
-> (S3Location -> Maybe [Grant] -> S3Location)
-> Lens S3Location S3Location (Maybe [Grant]) (Maybe [Grant])
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) ((Maybe [Grant] -> f (Maybe [Grant]))
-> S3Location -> f S3Location)
-> ((Maybe [Grant] -> f (Maybe [Grant]))
-> Maybe [Grant] -> f (Maybe [Grant]))
-> (Maybe [Grant] -> f (Maybe [Grant]))
-> S3Location
-> f S3Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Grant] [Grant] [Grant] [Grant]
-> Iso
(Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant])
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 AnIso [Grant] [Grant] [Grant] [Grant]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
s3Location_userMetadata :: Lens.Lens' S3Location (Prelude.Maybe [MetadataEntry])
s3Location_userMetadata :: (Maybe [MetadataEntry] -> f (Maybe [MetadataEntry]))
-> S3Location -> f S3Location
s3Location_userMetadata = (S3Location -> Maybe [MetadataEntry])
-> (S3Location -> Maybe [MetadataEntry] -> S3Location)
-> Lens
S3Location
S3Location
(Maybe [MetadataEntry])
(Maybe [MetadataEntry])
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) ((Maybe [MetadataEntry] -> f (Maybe [MetadataEntry]))
-> S3Location -> f S3Location)
-> ((Maybe [MetadataEntry] -> f (Maybe [MetadataEntry]))
-> Maybe [MetadataEntry] -> f (Maybe [MetadataEntry]))
-> (Maybe [MetadataEntry] -> f (Maybe [MetadataEntry]))
-> S3Location
-> f S3Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetadataEntry] [MetadataEntry] [MetadataEntry] [MetadataEntry]
-> Iso
(Maybe [MetadataEntry])
(Maybe [MetadataEntry])
(Maybe [MetadataEntry])
(Maybe [MetadataEntry])
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 AnIso
[MetadataEntry] [MetadataEntry] [MetadataEntry] [MetadataEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
s3Location_encryption :: Lens.Lens' S3Location (Prelude.Maybe Encryption)
s3Location_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> S3Location -> f S3Location
s3Location_encryption = (S3Location -> Maybe Encryption)
-> (S3Location -> Maybe Encryption -> S3Location)
-> Lens S3Location S3Location (Maybe Encryption) (Maybe 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)
s3Location_storageClass :: Lens.Lens' S3Location (Prelude.Maybe StorageClass)
s3Location_storageClass :: (Maybe StorageClass -> f (Maybe StorageClass))
-> S3Location -> f S3Location
s3Location_storageClass = (S3Location -> Maybe StorageClass)
-> (S3Location -> Maybe StorageClass -> S3Location)
-> Lens
S3Location S3Location (Maybe StorageClass) (Maybe 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)
s3Location_tagging :: Lens.Lens' S3Location (Prelude.Maybe Tagging)
s3Location_tagging :: (Maybe Tagging -> f (Maybe Tagging)) -> S3Location -> f S3Location
s3Location_tagging = (S3Location -> Maybe Tagging)
-> (S3Location -> Maybe Tagging -> S3Location)
-> Lens S3Location S3Location (Maybe Tagging) (Maybe 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)
s3Location_bucketName :: Lens.Lens' S3Location BucketName
s3Location_bucketName :: (BucketName -> f BucketName) -> S3Location -> f S3Location
s3Location_bucketName = (S3Location -> BucketName)
-> (S3Location -> BucketName -> S3Location)
-> Lens S3Location S3Location BucketName 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)
s3Location_prefix :: Lens.Lens' S3Location Prelude.Text
s3Location_prefix :: (Text -> f Text) -> S3Location -> f S3Location
s3Location_prefix = (S3Location -> Text)
-> (S3Location -> Text -> S3Location)
-> Lens S3Location S3Location Text Text
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
instance Prelude.NFData S3Location
instance Core.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
tagging :: Maybe Tagging
storageClass :: Maybe StorageClass
encryption :: Maybe Encryption
userMetadata :: Maybe [MetadataEntry]
accessControlList :: Maybe [Grant]
cannedACL :: Maybe ObjectCannedACL
$sel:prefix:S3Location' :: S3Location -> Text
$sel:bucketName:S3Location' :: S3Location -> BucketName
$sel:tagging:S3Location' :: S3Location -> Maybe Tagging
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
$sel:userMetadata:S3Location' :: S3Location -> Maybe [MetadataEntry]
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
$sel:cannedACL:S3Location' :: S3Location -> Maybe ObjectCannedACL
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"CannedACL" Name -> Maybe ObjectCannedACL -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ObjectCannedACL
cannedACL,
Name
"AccessControlList"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML
( Name -> [Grant] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"Grant"
([Grant] -> XML) -> Maybe [Grant] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Grant]
accessControlList
),
Name
"UserMetadata"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML
( Name -> [MetadataEntry] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"MetadataEntry"
([MetadataEntry] -> XML) -> Maybe [MetadataEntry] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetadataEntry]
userMetadata
),
Name
"Encryption" Name -> Maybe Encryption -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Encryption
encryption,
Name
"StorageClass" Name -> Maybe StorageClass -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe StorageClass
storageClass,
Name
"Tagging" Name -> Maybe Tagging -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Tagging
tagging,
Name
"BucketName" Name -> BucketName -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= BucketName
bucketName,
Name
"Prefix" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
prefix
]