{-# 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.Destination 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.AccessControlTranslation
import Amazonka.S3.Types.EncryptionConfiguration
import Amazonka.S3.Types.Metrics
import Amazonka.S3.Types.ReplicationTime
import Amazonka.S3.Types.StorageClass
data Destination = Destination'
{
Destination -> Maybe Metrics
metrics :: Prelude.Maybe Metrics,
Destination -> Maybe AccessControlTranslation
accessControlTranslation :: Prelude.Maybe AccessControlTranslation,
Destination -> Maybe Text
account :: Prelude.Maybe Prelude.Text,
Destination -> Maybe StorageClass
storageClass :: Prelude.Maybe StorageClass,
Destination -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
Destination -> Maybe ReplicationTime
replicationTime :: Prelude.Maybe ReplicationTime,
Destination -> BucketName
bucket :: BucketName
}
deriving (Destination -> Destination -> Bool
(Destination -> Destination -> Bool)
-> (Destination -> Destination -> Bool) -> Eq Destination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Destination -> Destination -> Bool
$c/= :: Destination -> Destination -> Bool
== :: Destination -> Destination -> Bool
$c== :: Destination -> Destination -> Bool
Prelude.Eq, ReadPrec [Destination]
ReadPrec Destination
Int -> ReadS Destination
ReadS [Destination]
(Int -> ReadS Destination)
-> ReadS [Destination]
-> ReadPrec Destination
-> ReadPrec [Destination]
-> Read Destination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Destination]
$creadListPrec :: ReadPrec [Destination]
readPrec :: ReadPrec Destination
$creadPrec :: ReadPrec Destination
readList :: ReadS [Destination]
$creadList :: ReadS [Destination]
readsPrec :: Int -> ReadS Destination
$creadsPrec :: Int -> ReadS Destination
Prelude.Read, Int -> Destination -> ShowS
[Destination] -> ShowS
Destination -> String
(Int -> Destination -> ShowS)
-> (Destination -> String)
-> ([Destination] -> ShowS)
-> Show Destination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Destination] -> ShowS
$cshowList :: [Destination] -> ShowS
show :: Destination -> String
$cshow :: Destination -> String
showsPrec :: Int -> Destination -> ShowS
$cshowsPrec :: Int -> Destination -> ShowS
Prelude.Show, (forall x. Destination -> Rep Destination x)
-> (forall x. Rep Destination x -> Destination)
-> Generic Destination
forall x. Rep Destination x -> Destination
forall x. Destination -> Rep Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Destination x -> Destination
$cfrom :: forall x. Destination -> Rep Destination x
Prelude.Generic)
newDestination ::
BucketName ->
Destination
newDestination :: BucketName -> Destination
newDestination BucketName
pBucket_ =
Destination' :: Maybe Metrics
-> Maybe AccessControlTranslation
-> Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination
Destination'
{ $sel:metrics:Destination' :: Maybe Metrics
metrics = Maybe Metrics
forall a. Maybe a
Prelude.Nothing,
$sel:accessControlTranslation:Destination' :: Maybe AccessControlTranslation
accessControlTranslation = Maybe AccessControlTranslation
forall a. Maybe a
Prelude.Nothing,
$sel:account:Destination' :: Maybe Text
account = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:storageClass:Destination' :: Maybe StorageClass
storageClass = Maybe StorageClass
forall a. Maybe a
Prelude.Nothing,
$sel:encryptionConfiguration:Destination' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:replicationTime:Destination' :: Maybe ReplicationTime
replicationTime = Maybe ReplicationTime
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:Destination' :: BucketName
bucket = BucketName
pBucket_
}
destination_metrics :: Lens.Lens' Destination (Prelude.Maybe Metrics)
destination_metrics :: (Maybe Metrics -> f (Maybe Metrics))
-> Destination -> f Destination
destination_metrics = (Destination -> Maybe Metrics)
-> (Destination -> Maybe Metrics -> Destination)
-> Lens Destination Destination (Maybe Metrics) (Maybe Metrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe Metrics
metrics :: Maybe Metrics
$sel:metrics:Destination' :: Destination -> Maybe Metrics
metrics} -> Maybe Metrics
metrics) (\s :: Destination
s@Destination' {} Maybe Metrics
a -> Destination
s {$sel:metrics:Destination' :: Maybe Metrics
metrics = Maybe Metrics
a} :: Destination)
destination_accessControlTranslation :: Lens.Lens' Destination (Prelude.Maybe AccessControlTranslation)
destination_accessControlTranslation :: (Maybe AccessControlTranslation
-> f (Maybe AccessControlTranslation))
-> Destination -> f Destination
destination_accessControlTranslation = (Destination -> Maybe AccessControlTranslation)
-> (Destination -> Maybe AccessControlTranslation -> Destination)
-> Lens
Destination
Destination
(Maybe AccessControlTranslation)
(Maybe AccessControlTranslation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe AccessControlTranslation
accessControlTranslation :: Maybe AccessControlTranslation
$sel:accessControlTranslation:Destination' :: Destination -> Maybe AccessControlTranslation
accessControlTranslation} -> Maybe AccessControlTranslation
accessControlTranslation) (\s :: Destination
s@Destination' {} Maybe AccessControlTranslation
a -> Destination
s {$sel:accessControlTranslation:Destination' :: Maybe AccessControlTranslation
accessControlTranslation = Maybe AccessControlTranslation
a} :: Destination)
destination_account :: Lens.Lens' Destination (Prelude.Maybe Prelude.Text)
destination_account :: (Maybe Text -> f (Maybe Text)) -> Destination -> f Destination
destination_account = (Destination -> Maybe Text)
-> (Destination -> Maybe Text -> Destination)
-> Lens Destination Destination (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe Text
account :: Maybe Text
$sel:account:Destination' :: Destination -> Maybe Text
account} -> Maybe Text
account) (\s :: Destination
s@Destination' {} Maybe Text
a -> Destination
s {$sel:account:Destination' :: Maybe Text
account = Maybe Text
a} :: Destination)
destination_storageClass :: Lens.Lens' Destination (Prelude.Maybe StorageClass)
destination_storageClass :: (Maybe StorageClass -> f (Maybe StorageClass))
-> Destination -> f Destination
destination_storageClass = (Destination -> Maybe StorageClass)
-> (Destination -> Maybe StorageClass -> Destination)
-> Lens
Destination Destination (Maybe StorageClass) (Maybe StorageClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe StorageClass
storageClass :: Maybe StorageClass
$sel:storageClass:Destination' :: Destination -> Maybe StorageClass
storageClass} -> Maybe StorageClass
storageClass) (\s :: Destination
s@Destination' {} Maybe StorageClass
a -> Destination
s {$sel:storageClass:Destination' :: Maybe StorageClass
storageClass = Maybe StorageClass
a} :: Destination)
destination_encryptionConfiguration :: Lens.Lens' Destination (Prelude.Maybe EncryptionConfiguration)
destination_encryptionConfiguration :: (Maybe EncryptionConfiguration
-> f (Maybe EncryptionConfiguration))
-> Destination -> f Destination
destination_encryptionConfiguration = (Destination -> Maybe EncryptionConfiguration)
-> (Destination -> Maybe EncryptionConfiguration -> Destination)
-> Lens
Destination
Destination
(Maybe EncryptionConfiguration)
(Maybe EncryptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:Destination' :: Destination -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: Destination
s@Destination' {} Maybe EncryptionConfiguration
a -> Destination
s {$sel:encryptionConfiguration:Destination' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: Destination)
destination_replicationTime :: Lens.Lens' Destination (Prelude.Maybe ReplicationTime)
destination_replicationTime :: (Maybe ReplicationTime -> f (Maybe ReplicationTime))
-> Destination -> f Destination
destination_replicationTime = (Destination -> Maybe ReplicationTime)
-> (Destination -> Maybe ReplicationTime -> Destination)
-> Lens
Destination
Destination
(Maybe ReplicationTime)
(Maybe ReplicationTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe ReplicationTime
replicationTime :: Maybe ReplicationTime
$sel:replicationTime:Destination' :: Destination -> Maybe ReplicationTime
replicationTime} -> Maybe ReplicationTime
replicationTime) (\s :: Destination
s@Destination' {} Maybe ReplicationTime
a -> Destination
s {$sel:replicationTime:Destination' :: Maybe ReplicationTime
replicationTime = Maybe ReplicationTime
a} :: Destination)
destination_bucket :: Lens.Lens' Destination BucketName
destination_bucket :: (BucketName -> f BucketName) -> Destination -> f Destination
destination_bucket = (Destination -> BucketName)
-> (Destination -> BucketName -> Destination)
-> Lens Destination Destination BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {BucketName
bucket :: BucketName
$sel:bucket:Destination' :: Destination -> BucketName
bucket} -> BucketName
bucket) (\s :: Destination
s@Destination' {} BucketName
a -> Destination
s {$sel:bucket:Destination' :: BucketName
bucket = BucketName
a} :: Destination)
instance Core.FromXML Destination where
parseXML :: [Node] -> Either String Destination
parseXML [Node]
x =
Maybe Metrics
-> Maybe AccessControlTranslation
-> Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination
Destination'
(Maybe Metrics
-> Maybe AccessControlTranslation
-> Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
-> Either String (Maybe Metrics)
-> Either
String
(Maybe AccessControlTranslation
-> Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Metrics)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Metrics")
Either
String
(Maybe AccessControlTranslation
-> Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
-> Either String (Maybe AccessControlTranslation)
-> Either
String
(Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AccessControlTranslation)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AccessControlTranslation")
Either
String
(Maybe Text
-> Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
-> Either String (Maybe Text)
-> Either
String
(Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Account")
Either
String
(Maybe StorageClass
-> Maybe EncryptionConfiguration
-> Maybe ReplicationTime
-> BucketName
-> Destination)
-> Either String (Maybe StorageClass)
-> Either
String
(Maybe EncryptionConfiguration
-> Maybe ReplicationTime -> BucketName -> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe StorageClass)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StorageClass")
Either
String
(Maybe EncryptionConfiguration
-> Maybe ReplicationTime -> BucketName -> Destination)
-> Either String (Maybe EncryptionConfiguration)
-> Either
String (Maybe ReplicationTime -> BucketName -> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe EncryptionConfiguration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EncryptionConfiguration")
Either String (Maybe ReplicationTime -> BucketName -> Destination)
-> Either String (Maybe ReplicationTime)
-> Either String (BucketName -> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ReplicationTime)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReplicationTime")
Either String (BucketName -> Destination)
-> Either String BucketName -> Either String Destination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String BucketName
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Bucket")
instance Prelude.Hashable Destination
instance Prelude.NFData Destination
instance Core.ToXML Destination where
toXML :: Destination -> XML
toXML Destination' {Maybe Text
Maybe EncryptionConfiguration
Maybe AccessControlTranslation
Maybe ReplicationTime
Maybe Metrics
Maybe StorageClass
BucketName
bucket :: BucketName
replicationTime :: Maybe ReplicationTime
encryptionConfiguration :: Maybe EncryptionConfiguration
storageClass :: Maybe StorageClass
account :: Maybe Text
accessControlTranslation :: Maybe AccessControlTranslation
metrics :: Maybe Metrics
$sel:bucket:Destination' :: Destination -> BucketName
$sel:replicationTime:Destination' :: Destination -> Maybe ReplicationTime
$sel:encryptionConfiguration:Destination' :: Destination -> Maybe EncryptionConfiguration
$sel:storageClass:Destination' :: Destination -> Maybe StorageClass
$sel:account:Destination' :: Destination -> Maybe Text
$sel:accessControlTranslation:Destination' :: Destination -> Maybe AccessControlTranslation
$sel:metrics:Destination' :: Destination -> Maybe Metrics
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Metrics" Name -> Maybe Metrics -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Metrics
metrics,
Name
"AccessControlTranslation"
Name -> Maybe AccessControlTranslation -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe AccessControlTranslation
accessControlTranslation,
Name
"Account" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
account,
Name
"StorageClass" Name -> Maybe StorageClass -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe StorageClass
storageClass,
Name
"EncryptionConfiguration"
Name -> Maybe EncryptionConfiguration -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe EncryptionConfiguration
encryptionConfiguration,
Name
"ReplicationTime" Name -> Maybe ReplicationTime -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ReplicationTime
replicationTime,
Name
"Bucket" Name -> BucketName -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= BucketName
bucket
]