{-# 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.TopicConfiguration 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.Event
import Amazonka.S3.Types.NotificationConfigurationFilter
data TopicConfiguration = TopicConfiguration'
{ TopicConfiguration -> Maybe NotificationConfigurationFilter
filter' :: Prelude.Maybe NotificationConfigurationFilter,
TopicConfiguration -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
TopicConfiguration -> Text
topicArn :: Prelude.Text,
TopicConfiguration -> [Event]
events :: [Event]
}
deriving (TopicConfiguration -> TopicConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopicConfiguration -> TopicConfiguration -> Bool
$c/= :: TopicConfiguration -> TopicConfiguration -> Bool
== :: TopicConfiguration -> TopicConfiguration -> Bool
$c== :: TopicConfiguration -> TopicConfiguration -> Bool
Prelude.Eq, ReadPrec [TopicConfiguration]
ReadPrec TopicConfiguration
Int -> ReadS TopicConfiguration
ReadS [TopicConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TopicConfiguration]
$creadListPrec :: ReadPrec [TopicConfiguration]
readPrec :: ReadPrec TopicConfiguration
$creadPrec :: ReadPrec TopicConfiguration
readList :: ReadS [TopicConfiguration]
$creadList :: ReadS [TopicConfiguration]
readsPrec :: Int -> ReadS TopicConfiguration
$creadsPrec :: Int -> ReadS TopicConfiguration
Prelude.Read, Int -> TopicConfiguration -> ShowS
[TopicConfiguration] -> ShowS
TopicConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopicConfiguration] -> ShowS
$cshowList :: [TopicConfiguration] -> ShowS
show :: TopicConfiguration -> String
$cshow :: TopicConfiguration -> String
showsPrec :: Int -> TopicConfiguration -> ShowS
$cshowsPrec :: Int -> TopicConfiguration -> ShowS
Prelude.Show, forall x. Rep TopicConfiguration x -> TopicConfiguration
forall x. TopicConfiguration -> Rep TopicConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TopicConfiguration x -> TopicConfiguration
$cfrom :: forall x. TopicConfiguration -> Rep TopicConfiguration x
Prelude.Generic)
newTopicConfiguration ::
Prelude.Text ->
TopicConfiguration
newTopicConfiguration :: Text -> TopicConfiguration
newTopicConfiguration Text
pTopicArn_ =
TopicConfiguration'
{ $sel:filter':TopicConfiguration' :: Maybe NotificationConfigurationFilter
filter' = forall a. Maybe a
Prelude.Nothing,
$sel:id:TopicConfiguration' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:topicArn:TopicConfiguration' :: Text
topicArn = Text
pTopicArn_,
$sel:events:TopicConfiguration' :: [Event]
events = forall a. Monoid a => a
Prelude.mempty
}
topicConfiguration_filter :: Lens.Lens' TopicConfiguration (Prelude.Maybe NotificationConfigurationFilter)
topicConfiguration_filter :: Lens' TopicConfiguration (Maybe NotificationConfigurationFilter)
topicConfiguration_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicConfiguration' {Maybe NotificationConfigurationFilter
filter' :: Maybe NotificationConfigurationFilter
$sel:filter':TopicConfiguration' :: TopicConfiguration -> Maybe NotificationConfigurationFilter
filter'} -> Maybe NotificationConfigurationFilter
filter') (\s :: TopicConfiguration
s@TopicConfiguration' {} Maybe NotificationConfigurationFilter
a -> TopicConfiguration
s {$sel:filter':TopicConfiguration' :: Maybe NotificationConfigurationFilter
filter' = Maybe NotificationConfigurationFilter
a} :: TopicConfiguration)
topicConfiguration_id :: Lens.Lens' TopicConfiguration (Prelude.Maybe Prelude.Text)
topicConfiguration_id :: Lens' TopicConfiguration (Maybe Text)
topicConfiguration_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicConfiguration' {Maybe Text
id :: Maybe Text
$sel:id:TopicConfiguration' :: TopicConfiguration -> Maybe Text
id} -> Maybe Text
id) (\s :: TopicConfiguration
s@TopicConfiguration' {} Maybe Text
a -> TopicConfiguration
s {$sel:id:TopicConfiguration' :: Maybe Text
id = Maybe Text
a} :: TopicConfiguration)
topicConfiguration_topicArn :: Lens.Lens' TopicConfiguration Prelude.Text
topicConfiguration_topicArn :: Lens' TopicConfiguration Text
topicConfiguration_topicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicConfiguration' {Text
topicArn :: Text
$sel:topicArn:TopicConfiguration' :: TopicConfiguration -> Text
topicArn} -> Text
topicArn) (\s :: TopicConfiguration
s@TopicConfiguration' {} Text
a -> TopicConfiguration
s {$sel:topicArn:TopicConfiguration' :: Text
topicArn = Text
a} :: TopicConfiguration)
topicConfiguration_events :: Lens.Lens' TopicConfiguration [Event]
topicConfiguration_events :: Lens' TopicConfiguration [Event]
topicConfiguration_events = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicConfiguration' {[Event]
events :: [Event]
$sel:events:TopicConfiguration' :: TopicConfiguration -> [Event]
events} -> [Event]
events) (\s :: TopicConfiguration
s@TopicConfiguration' {} [Event]
a -> TopicConfiguration
s {$sel:events:TopicConfiguration' :: [Event]
events = [Event]
a} :: TopicConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromXML TopicConfiguration where
parseXML :: [Node] -> Either String TopicConfiguration
parseXML [Node]
x =
Maybe NotificationConfigurationFilter
-> Maybe Text -> Text -> [Event] -> TopicConfiguration
TopicConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Filter")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Topic")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Event" [Node]
x)
instance Prelude.Hashable TopicConfiguration where
hashWithSalt :: Int -> TopicConfiguration -> Int
hashWithSalt Int
_salt TopicConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
topicArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:TopicConfiguration' :: TopicConfiguration -> [Event]
$sel:topicArn:TopicConfiguration' :: TopicConfiguration -> Text
$sel:id:TopicConfiguration' :: TopicConfiguration -> Maybe Text
$sel:filter':TopicConfiguration' :: TopicConfiguration -> Maybe NotificationConfigurationFilter
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationConfigurationFilter
filter'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
topicArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Event]
events
instance Prelude.NFData TopicConfiguration where
rnf :: TopicConfiguration -> ()
rnf TopicConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
topicArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:TopicConfiguration' :: TopicConfiguration -> [Event]
$sel:topicArn:TopicConfiguration' :: TopicConfiguration -> Text
$sel:id:TopicConfiguration' :: TopicConfiguration -> Maybe Text
$sel:filter':TopicConfiguration' :: TopicConfiguration -> Maybe NotificationConfigurationFilter
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationConfigurationFilter
filter'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
topicArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Event]
events
instance Data.ToXML TopicConfiguration where
toXML :: TopicConfiguration -> XML
toXML TopicConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
topicArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:TopicConfiguration' :: TopicConfiguration -> [Event]
$sel:topicArn:TopicConfiguration' :: TopicConfiguration -> Text
$sel:id:TopicConfiguration' :: TopicConfiguration -> Maybe Text
$sel:filter':TopicConfiguration' :: TopicConfiguration -> Maybe NotificationConfigurationFilter
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Filter" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe NotificationConfigurationFilter
filter',
Name
"Id" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
id,
Name
"Topic" forall a. ToXML a => Name -> a -> XML
Data.@= Text
topicArn,
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Event" [Event]
events
]