{-# 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.QueueConfiguration 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 QueueConfiguration = QueueConfiguration'
{ QueueConfiguration -> Maybe NotificationConfigurationFilter
filter' :: Prelude.Maybe NotificationConfigurationFilter,
QueueConfiguration -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
QueueConfiguration -> Text
queueArn :: Prelude.Text,
QueueConfiguration -> [Event]
events :: [Event]
}
deriving (QueueConfiguration -> QueueConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueueConfiguration -> QueueConfiguration -> Bool
$c/= :: QueueConfiguration -> QueueConfiguration -> Bool
== :: QueueConfiguration -> QueueConfiguration -> Bool
$c== :: QueueConfiguration -> QueueConfiguration -> Bool
Prelude.Eq, ReadPrec [QueueConfiguration]
ReadPrec QueueConfiguration
Int -> ReadS QueueConfiguration
ReadS [QueueConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueueConfiguration]
$creadListPrec :: ReadPrec [QueueConfiguration]
readPrec :: ReadPrec QueueConfiguration
$creadPrec :: ReadPrec QueueConfiguration
readList :: ReadS [QueueConfiguration]
$creadList :: ReadS [QueueConfiguration]
readsPrec :: Int -> ReadS QueueConfiguration
$creadsPrec :: Int -> ReadS QueueConfiguration
Prelude.Read, Int -> QueueConfiguration -> ShowS
[QueueConfiguration] -> ShowS
QueueConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueueConfiguration] -> ShowS
$cshowList :: [QueueConfiguration] -> ShowS
show :: QueueConfiguration -> String
$cshow :: QueueConfiguration -> String
showsPrec :: Int -> QueueConfiguration -> ShowS
$cshowsPrec :: Int -> QueueConfiguration -> ShowS
Prelude.Show, forall x. Rep QueueConfiguration x -> QueueConfiguration
forall x. QueueConfiguration -> Rep QueueConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueueConfiguration x -> QueueConfiguration
$cfrom :: forall x. QueueConfiguration -> Rep QueueConfiguration x
Prelude.Generic)
newQueueConfiguration ::
Prelude.Text ->
QueueConfiguration
newQueueConfiguration :: Text -> QueueConfiguration
newQueueConfiguration Text
pQueueArn_ =
QueueConfiguration'
{ $sel:filter':QueueConfiguration' :: Maybe NotificationConfigurationFilter
filter' = forall a. Maybe a
Prelude.Nothing,
$sel:id:QueueConfiguration' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:queueArn:QueueConfiguration' :: Text
queueArn = Text
pQueueArn_,
$sel:events:QueueConfiguration' :: [Event]
events = forall a. Monoid a => a
Prelude.mempty
}
queueConfiguration_filter :: Lens.Lens' QueueConfiguration (Prelude.Maybe NotificationConfigurationFilter)
queueConfiguration_filter :: Lens' QueueConfiguration (Maybe NotificationConfigurationFilter)
queueConfiguration_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueConfiguration' {Maybe NotificationConfigurationFilter
filter' :: Maybe NotificationConfigurationFilter
$sel:filter':QueueConfiguration' :: QueueConfiguration -> Maybe NotificationConfigurationFilter
filter'} -> Maybe NotificationConfigurationFilter
filter') (\s :: QueueConfiguration
s@QueueConfiguration' {} Maybe NotificationConfigurationFilter
a -> QueueConfiguration
s {$sel:filter':QueueConfiguration' :: Maybe NotificationConfigurationFilter
filter' = Maybe NotificationConfigurationFilter
a} :: QueueConfiguration)
queueConfiguration_id :: Lens.Lens' QueueConfiguration (Prelude.Maybe Prelude.Text)
queueConfiguration_id :: Lens' QueueConfiguration (Maybe Text)
queueConfiguration_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueConfiguration' {Maybe Text
id :: Maybe Text
$sel:id:QueueConfiguration' :: QueueConfiguration -> Maybe Text
id} -> Maybe Text
id) (\s :: QueueConfiguration
s@QueueConfiguration' {} Maybe Text
a -> QueueConfiguration
s {$sel:id:QueueConfiguration' :: Maybe Text
id = Maybe Text
a} :: QueueConfiguration)
queueConfiguration_queueArn :: Lens.Lens' QueueConfiguration Prelude.Text
queueConfiguration_queueArn :: Lens' QueueConfiguration Text
queueConfiguration_queueArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueConfiguration' {Text
queueArn :: Text
$sel:queueArn:QueueConfiguration' :: QueueConfiguration -> Text
queueArn} -> Text
queueArn) (\s :: QueueConfiguration
s@QueueConfiguration' {} Text
a -> QueueConfiguration
s {$sel:queueArn:QueueConfiguration' :: Text
queueArn = Text
a} :: QueueConfiguration)
queueConfiguration_events :: Lens.Lens' QueueConfiguration [Event]
queueConfiguration_events :: Lens' QueueConfiguration [Event]
queueConfiguration_events = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueConfiguration' {[Event]
events :: [Event]
$sel:events:QueueConfiguration' :: QueueConfiguration -> [Event]
events} -> [Event]
events) (\s :: QueueConfiguration
s@QueueConfiguration' {} [Event]
a -> QueueConfiguration
s {$sel:events:QueueConfiguration' :: [Event]
events = [Event]
a} :: QueueConfiguration) 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 QueueConfiguration where
parseXML :: [Node] -> Either String QueueConfiguration
parseXML [Node]
x =
Maybe NotificationConfigurationFilter
-> Maybe Text -> Text -> [Event] -> QueueConfiguration
QueueConfiguration'
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
"Queue")
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 QueueConfiguration where
hashWithSalt :: Int -> QueueConfiguration -> Int
hashWithSalt Int
_salt QueueConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
queueArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:QueueConfiguration' :: QueueConfiguration -> [Event]
$sel:queueArn:QueueConfiguration' :: QueueConfiguration -> Text
$sel:id:QueueConfiguration' :: QueueConfiguration -> Maybe Text
$sel:filter':QueueConfiguration' :: QueueConfiguration -> 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
queueArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Event]
events
instance Prelude.NFData QueueConfiguration where
rnf :: QueueConfiguration -> ()
rnf QueueConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
queueArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:QueueConfiguration' :: QueueConfiguration -> [Event]
$sel:queueArn:QueueConfiguration' :: QueueConfiguration -> Text
$sel:id:QueueConfiguration' :: QueueConfiguration -> Maybe Text
$sel:filter':QueueConfiguration' :: QueueConfiguration -> 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
queueArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Event]
events
instance Data.ToXML QueueConfiguration where
toXML :: QueueConfiguration -> XML
toXML QueueConfiguration' {[Event]
Maybe Text
Maybe NotificationConfigurationFilter
Text
events :: [Event]
queueArn :: Text
id :: Maybe Text
filter' :: Maybe NotificationConfigurationFilter
$sel:events:QueueConfiguration' :: QueueConfiguration -> [Event]
$sel:queueArn:QueueConfiguration' :: QueueConfiguration -> Text
$sel:id:QueueConfiguration' :: QueueConfiguration -> Maybe Text
$sel:filter':QueueConfiguration' :: QueueConfiguration -> 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
"Queue" forall a. ToXML a => Name -> a -> XML
Data.@= Text
queueArn,
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Event" [Event]
events
]