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