{-# 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.AnalyticsConfiguration 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.AnalyticsFilter
import Amazonka.S3.Types.StorageClassAnalysis
data AnalyticsConfiguration = AnalyticsConfiguration'
{
AnalyticsConfiguration -> Maybe AnalyticsFilter
filter' :: Prelude.Maybe AnalyticsFilter,
AnalyticsConfiguration -> Text
id :: Prelude.Text,
AnalyticsConfiguration -> StorageClassAnalysis
storageClassAnalysis :: StorageClassAnalysis
}
deriving (AnalyticsConfiguration -> AnalyticsConfiguration -> Bool
(AnalyticsConfiguration -> AnalyticsConfiguration -> Bool)
-> (AnalyticsConfiguration -> AnalyticsConfiguration -> Bool)
-> Eq AnalyticsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyticsConfiguration -> AnalyticsConfiguration -> Bool
$c/= :: AnalyticsConfiguration -> AnalyticsConfiguration -> Bool
== :: AnalyticsConfiguration -> AnalyticsConfiguration -> Bool
$c== :: AnalyticsConfiguration -> AnalyticsConfiguration -> Bool
Prelude.Eq, ReadPrec [AnalyticsConfiguration]
ReadPrec AnalyticsConfiguration
Int -> ReadS AnalyticsConfiguration
ReadS [AnalyticsConfiguration]
(Int -> ReadS AnalyticsConfiguration)
-> ReadS [AnalyticsConfiguration]
-> ReadPrec AnalyticsConfiguration
-> ReadPrec [AnalyticsConfiguration]
-> Read AnalyticsConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyticsConfiguration]
$creadListPrec :: ReadPrec [AnalyticsConfiguration]
readPrec :: ReadPrec AnalyticsConfiguration
$creadPrec :: ReadPrec AnalyticsConfiguration
readList :: ReadS [AnalyticsConfiguration]
$creadList :: ReadS [AnalyticsConfiguration]
readsPrec :: Int -> ReadS AnalyticsConfiguration
$creadsPrec :: Int -> ReadS AnalyticsConfiguration
Prelude.Read, Int -> AnalyticsConfiguration -> ShowS
[AnalyticsConfiguration] -> ShowS
AnalyticsConfiguration -> String
(Int -> AnalyticsConfiguration -> ShowS)
-> (AnalyticsConfiguration -> String)
-> ([AnalyticsConfiguration] -> ShowS)
-> Show AnalyticsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyticsConfiguration] -> ShowS
$cshowList :: [AnalyticsConfiguration] -> ShowS
show :: AnalyticsConfiguration -> String
$cshow :: AnalyticsConfiguration -> String
showsPrec :: Int -> AnalyticsConfiguration -> ShowS
$cshowsPrec :: Int -> AnalyticsConfiguration -> ShowS
Prelude.Show, (forall x. AnalyticsConfiguration -> Rep AnalyticsConfiguration x)
-> (forall x.
Rep AnalyticsConfiguration x -> AnalyticsConfiguration)
-> Generic AnalyticsConfiguration
forall x. Rep AnalyticsConfiguration x -> AnalyticsConfiguration
forall x. AnalyticsConfiguration -> Rep AnalyticsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalyticsConfiguration x -> AnalyticsConfiguration
$cfrom :: forall x. AnalyticsConfiguration -> Rep AnalyticsConfiguration x
Prelude.Generic)
newAnalyticsConfiguration ::
Prelude.Text ->
StorageClassAnalysis ->
AnalyticsConfiguration
newAnalyticsConfiguration :: Text -> StorageClassAnalysis -> AnalyticsConfiguration
newAnalyticsConfiguration Text
pId_ StorageClassAnalysis
pStorageClassAnalysis_ =
AnalyticsConfiguration' :: Maybe AnalyticsFilter
-> Text -> StorageClassAnalysis -> AnalyticsConfiguration
AnalyticsConfiguration'
{ $sel:filter':AnalyticsConfiguration' :: Maybe AnalyticsFilter
filter' = Maybe AnalyticsFilter
forall a. Maybe a
Prelude.Nothing,
$sel:id:AnalyticsConfiguration' :: Text
id = Text
pId_,
$sel:storageClassAnalysis:AnalyticsConfiguration' :: StorageClassAnalysis
storageClassAnalysis = StorageClassAnalysis
pStorageClassAnalysis_
}
analyticsConfiguration_filter :: Lens.Lens' AnalyticsConfiguration (Prelude.Maybe AnalyticsFilter)
analyticsConfiguration_filter :: (Maybe AnalyticsFilter -> f (Maybe AnalyticsFilter))
-> AnalyticsConfiguration -> f AnalyticsConfiguration
analyticsConfiguration_filter = (AnalyticsConfiguration -> Maybe AnalyticsFilter)
-> (AnalyticsConfiguration
-> Maybe AnalyticsFilter -> AnalyticsConfiguration)
-> Lens
AnalyticsConfiguration
AnalyticsConfiguration
(Maybe AnalyticsFilter)
(Maybe AnalyticsFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsConfiguration' {Maybe AnalyticsFilter
filter' :: Maybe AnalyticsFilter
$sel:filter':AnalyticsConfiguration' :: AnalyticsConfiguration -> Maybe AnalyticsFilter
filter'} -> Maybe AnalyticsFilter
filter') (\s :: AnalyticsConfiguration
s@AnalyticsConfiguration' {} Maybe AnalyticsFilter
a -> AnalyticsConfiguration
s {$sel:filter':AnalyticsConfiguration' :: Maybe AnalyticsFilter
filter' = Maybe AnalyticsFilter
a} :: AnalyticsConfiguration)
analyticsConfiguration_id :: Lens.Lens' AnalyticsConfiguration Prelude.Text
analyticsConfiguration_id :: (Text -> f Text)
-> AnalyticsConfiguration -> f AnalyticsConfiguration
analyticsConfiguration_id = (AnalyticsConfiguration -> Text)
-> (AnalyticsConfiguration -> Text -> AnalyticsConfiguration)
-> Lens AnalyticsConfiguration AnalyticsConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsConfiguration' {Text
id :: Text
$sel:id:AnalyticsConfiguration' :: AnalyticsConfiguration -> Text
id} -> Text
id) (\s :: AnalyticsConfiguration
s@AnalyticsConfiguration' {} Text
a -> AnalyticsConfiguration
s {$sel:id:AnalyticsConfiguration' :: Text
id = Text
a} :: AnalyticsConfiguration)
analyticsConfiguration_storageClassAnalysis :: Lens.Lens' AnalyticsConfiguration StorageClassAnalysis
analyticsConfiguration_storageClassAnalysis :: (StorageClassAnalysis -> f StorageClassAnalysis)
-> AnalyticsConfiguration -> f AnalyticsConfiguration
analyticsConfiguration_storageClassAnalysis = (AnalyticsConfiguration -> StorageClassAnalysis)
-> (AnalyticsConfiguration
-> StorageClassAnalysis -> AnalyticsConfiguration)
-> Lens
AnalyticsConfiguration
AnalyticsConfiguration
StorageClassAnalysis
StorageClassAnalysis
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsConfiguration' {StorageClassAnalysis
storageClassAnalysis :: StorageClassAnalysis
$sel:storageClassAnalysis:AnalyticsConfiguration' :: AnalyticsConfiguration -> StorageClassAnalysis
storageClassAnalysis} -> StorageClassAnalysis
storageClassAnalysis) (\s :: AnalyticsConfiguration
s@AnalyticsConfiguration' {} StorageClassAnalysis
a -> AnalyticsConfiguration
s {$sel:storageClassAnalysis:AnalyticsConfiguration' :: StorageClassAnalysis
storageClassAnalysis = StorageClassAnalysis
a} :: AnalyticsConfiguration)
instance Core.FromXML AnalyticsConfiguration where
parseXML :: [Node] -> Either String AnalyticsConfiguration
parseXML [Node]
x =
Maybe AnalyticsFilter
-> Text -> StorageClassAnalysis -> AnalyticsConfiguration
AnalyticsConfiguration'
(Maybe AnalyticsFilter
-> Text -> StorageClassAnalysis -> AnalyticsConfiguration)
-> Either String (Maybe AnalyticsFilter)
-> Either
String (Text -> StorageClassAnalysis -> AnalyticsConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe AnalyticsFilter)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Filter")
Either
String (Text -> StorageClassAnalysis -> AnalyticsConfiguration)
-> Either String Text
-> Either String (StorageClassAnalysis -> AnalyticsConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
Either String (StorageClassAnalysis -> AnalyticsConfiguration)
-> Either String StorageClassAnalysis
-> Either String AnalyticsConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StorageClassAnalysis
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StorageClassAnalysis")
instance Prelude.Hashable AnalyticsConfiguration
instance Prelude.NFData AnalyticsConfiguration
instance Core.ToXML AnalyticsConfiguration where
toXML :: AnalyticsConfiguration -> XML
toXML AnalyticsConfiguration' {Maybe AnalyticsFilter
Text
StorageClassAnalysis
storageClassAnalysis :: StorageClassAnalysis
id :: Text
filter' :: Maybe AnalyticsFilter
$sel:storageClassAnalysis:AnalyticsConfiguration' :: AnalyticsConfiguration -> StorageClassAnalysis
$sel:id:AnalyticsConfiguration' :: AnalyticsConfiguration -> Text
$sel:filter':AnalyticsConfiguration' :: AnalyticsConfiguration -> Maybe AnalyticsFilter
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Filter" Name -> Maybe AnalyticsFilter -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe AnalyticsFilter
filter',
Name
"Id" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
id,
Name
"StorageClassAnalysis" Name -> StorageClassAnalysis -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= StorageClassAnalysis
storageClassAnalysis
]