{-# 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.ReplicationRuleAndOperator 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.Tag
data ReplicationRuleAndOperator = ReplicationRuleAndOperator'
{
ReplicationRuleAndOperator -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
ReplicationRuleAndOperator -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
}
deriving (ReplicationRuleAndOperator -> ReplicationRuleAndOperator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicationRuleAndOperator -> ReplicationRuleAndOperator -> Bool
$c/= :: ReplicationRuleAndOperator -> ReplicationRuleAndOperator -> Bool
== :: ReplicationRuleAndOperator -> ReplicationRuleAndOperator -> Bool
$c== :: ReplicationRuleAndOperator -> ReplicationRuleAndOperator -> Bool
Prelude.Eq, ReadPrec [ReplicationRuleAndOperator]
ReadPrec ReplicationRuleAndOperator
Int -> ReadS ReplicationRuleAndOperator
ReadS [ReplicationRuleAndOperator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicationRuleAndOperator]
$creadListPrec :: ReadPrec [ReplicationRuleAndOperator]
readPrec :: ReadPrec ReplicationRuleAndOperator
$creadPrec :: ReadPrec ReplicationRuleAndOperator
readList :: ReadS [ReplicationRuleAndOperator]
$creadList :: ReadS [ReplicationRuleAndOperator]
readsPrec :: Int -> ReadS ReplicationRuleAndOperator
$creadsPrec :: Int -> ReadS ReplicationRuleAndOperator
Prelude.Read, Int -> ReplicationRuleAndOperator -> ShowS
[ReplicationRuleAndOperator] -> ShowS
ReplicationRuleAndOperator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicationRuleAndOperator] -> ShowS
$cshowList :: [ReplicationRuleAndOperator] -> ShowS
show :: ReplicationRuleAndOperator -> String
$cshow :: ReplicationRuleAndOperator -> String
showsPrec :: Int -> ReplicationRuleAndOperator -> ShowS
$cshowsPrec :: Int -> ReplicationRuleAndOperator -> ShowS
Prelude.Show, forall x.
Rep ReplicationRuleAndOperator x -> ReplicationRuleAndOperator
forall x.
ReplicationRuleAndOperator -> Rep ReplicationRuleAndOperator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicationRuleAndOperator x -> ReplicationRuleAndOperator
$cfrom :: forall x.
ReplicationRuleAndOperator -> Rep ReplicationRuleAndOperator x
Prelude.Generic)
newReplicationRuleAndOperator ::
ReplicationRuleAndOperator
newReplicationRuleAndOperator :: ReplicationRuleAndOperator
newReplicationRuleAndOperator =
ReplicationRuleAndOperator'
{ $sel:prefix:ReplicationRuleAndOperator' :: Maybe Text
prefix =
forall a. Maybe a
Prelude.Nothing,
$sel:tags:ReplicationRuleAndOperator' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
}
replicationRuleAndOperator_prefix :: Lens.Lens' ReplicationRuleAndOperator (Prelude.Maybe Prelude.Text)
replicationRuleAndOperator_prefix :: Lens' ReplicationRuleAndOperator (Maybe Text)
replicationRuleAndOperator_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationRuleAndOperator' {Maybe Text
prefix :: Maybe Text
$sel:prefix:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: ReplicationRuleAndOperator
s@ReplicationRuleAndOperator' {} Maybe Text
a -> ReplicationRuleAndOperator
s {$sel:prefix:ReplicationRuleAndOperator' :: Maybe Text
prefix = Maybe Text
a} :: ReplicationRuleAndOperator)
replicationRuleAndOperator_tags :: Lens.Lens' ReplicationRuleAndOperator (Prelude.Maybe [Tag])
replicationRuleAndOperator_tags :: Lens' ReplicationRuleAndOperator (Maybe [Tag])
replicationRuleAndOperator_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationRuleAndOperator' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: ReplicationRuleAndOperator
s@ReplicationRuleAndOperator' {} Maybe [Tag]
a -> ReplicationRuleAndOperator
s {$sel:tags:ReplicationRuleAndOperator' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: ReplicationRuleAndOperator) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromXML ReplicationRuleAndOperator where
parseXML :: [Node] -> Either String ReplicationRuleAndOperator
parseXML [Node]
x =
Maybe Text -> Maybe [Tag] -> ReplicationRuleAndOperator
ReplicationRuleAndOperator'
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
"Prefix")
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
"Tag"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Tag")
)
instance Prelude.Hashable ReplicationRuleAndOperator where
hashWithSalt :: Int -> ReplicationRuleAndOperator -> Int
hashWithSalt Int
_salt ReplicationRuleAndOperator' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
prefix :: Maybe Text
$sel:tags:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe [Tag]
$sel:prefix:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
instance Prelude.NFData ReplicationRuleAndOperator where
rnf :: ReplicationRuleAndOperator -> ()
rnf ReplicationRuleAndOperator' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
prefix :: Maybe Text
$sel:tags:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe [Tag]
$sel:prefix:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefix seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
instance Data.ToXML ReplicationRuleAndOperator where
toXML :: ReplicationRuleAndOperator -> XML
toXML ReplicationRuleAndOperator' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
prefix :: Maybe Text
$sel:tags:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe [Tag]
$sel:prefix:ReplicationRuleAndOperator' :: ReplicationRuleAndOperator -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Prefix" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
prefix,
Name
"Tag"
forall a. ToXML a => Name -> a -> XML
Data.@= forall a. ToXML a => a -> XML
Data.toXML (forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Tag" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags)
]