{-# 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.AnalyticsAndOperator 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 AnalyticsAndOperator = AnalyticsAndOperator'
{
AnalyticsAndOperator -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
AnalyticsAndOperator -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
}
deriving (AnalyticsAndOperator -> AnalyticsAndOperator -> Bool
(AnalyticsAndOperator -> AnalyticsAndOperator -> Bool)
-> (AnalyticsAndOperator -> AnalyticsAndOperator -> Bool)
-> Eq AnalyticsAndOperator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyticsAndOperator -> AnalyticsAndOperator -> Bool
$c/= :: AnalyticsAndOperator -> AnalyticsAndOperator -> Bool
== :: AnalyticsAndOperator -> AnalyticsAndOperator -> Bool
$c== :: AnalyticsAndOperator -> AnalyticsAndOperator -> Bool
Prelude.Eq, ReadPrec [AnalyticsAndOperator]
ReadPrec AnalyticsAndOperator
Int -> ReadS AnalyticsAndOperator
ReadS [AnalyticsAndOperator]
(Int -> ReadS AnalyticsAndOperator)
-> ReadS [AnalyticsAndOperator]
-> ReadPrec AnalyticsAndOperator
-> ReadPrec [AnalyticsAndOperator]
-> Read AnalyticsAndOperator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyticsAndOperator]
$creadListPrec :: ReadPrec [AnalyticsAndOperator]
readPrec :: ReadPrec AnalyticsAndOperator
$creadPrec :: ReadPrec AnalyticsAndOperator
readList :: ReadS [AnalyticsAndOperator]
$creadList :: ReadS [AnalyticsAndOperator]
readsPrec :: Int -> ReadS AnalyticsAndOperator
$creadsPrec :: Int -> ReadS AnalyticsAndOperator
Prelude.Read, Int -> AnalyticsAndOperator -> ShowS
[AnalyticsAndOperator] -> ShowS
AnalyticsAndOperator -> String
(Int -> AnalyticsAndOperator -> ShowS)
-> (AnalyticsAndOperator -> String)
-> ([AnalyticsAndOperator] -> ShowS)
-> Show AnalyticsAndOperator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyticsAndOperator] -> ShowS
$cshowList :: [AnalyticsAndOperator] -> ShowS
show :: AnalyticsAndOperator -> String
$cshow :: AnalyticsAndOperator -> String
showsPrec :: Int -> AnalyticsAndOperator -> ShowS
$cshowsPrec :: Int -> AnalyticsAndOperator -> ShowS
Prelude.Show, (forall x. AnalyticsAndOperator -> Rep AnalyticsAndOperator x)
-> (forall x. Rep AnalyticsAndOperator x -> AnalyticsAndOperator)
-> Generic AnalyticsAndOperator
forall x. Rep AnalyticsAndOperator x -> AnalyticsAndOperator
forall x. AnalyticsAndOperator -> Rep AnalyticsAndOperator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalyticsAndOperator x -> AnalyticsAndOperator
$cfrom :: forall x. AnalyticsAndOperator -> Rep AnalyticsAndOperator x
Prelude.Generic)
newAnalyticsAndOperator ::
AnalyticsAndOperator
newAnalyticsAndOperator :: AnalyticsAndOperator
newAnalyticsAndOperator =
AnalyticsAndOperator' :: Maybe Text -> Maybe [Tag] -> AnalyticsAndOperator
AnalyticsAndOperator'
{ $sel:prefix:AnalyticsAndOperator' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:AnalyticsAndOperator' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
}
analyticsAndOperator_prefix :: Lens.Lens' AnalyticsAndOperator (Prelude.Maybe Prelude.Text)
analyticsAndOperator_prefix :: (Maybe Text -> f (Maybe Text))
-> AnalyticsAndOperator -> f AnalyticsAndOperator
analyticsAndOperator_prefix = (AnalyticsAndOperator -> Maybe Text)
-> (AnalyticsAndOperator -> Maybe Text -> AnalyticsAndOperator)
-> Lens
AnalyticsAndOperator AnalyticsAndOperator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsAndOperator' {Maybe Text
prefix :: Maybe Text
$sel:prefix:AnalyticsAndOperator' :: AnalyticsAndOperator -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: AnalyticsAndOperator
s@AnalyticsAndOperator' {} Maybe Text
a -> AnalyticsAndOperator
s {$sel:prefix:AnalyticsAndOperator' :: Maybe Text
prefix = Maybe Text
a} :: AnalyticsAndOperator)
analyticsAndOperator_tags :: Lens.Lens' AnalyticsAndOperator (Prelude.Maybe [Tag])
analyticsAndOperator_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> AnalyticsAndOperator -> f AnalyticsAndOperator
analyticsAndOperator_tags = (AnalyticsAndOperator -> Maybe [Tag])
-> (AnalyticsAndOperator -> Maybe [Tag] -> AnalyticsAndOperator)
-> Lens
AnalyticsAndOperator
AnalyticsAndOperator
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsAndOperator' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:AnalyticsAndOperator' :: AnalyticsAndOperator -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: AnalyticsAndOperator
s@AnalyticsAndOperator' {} Maybe [Tag]
a -> AnalyticsAndOperator
s {$sel:tags:AnalyticsAndOperator' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: AnalyticsAndOperator) ((Maybe [Tag] -> f (Maybe [Tag]))
-> AnalyticsAndOperator -> f AnalyticsAndOperator)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> AnalyticsAndOperator
-> f AnalyticsAndOperator
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 AnalyticsAndOperator where
parseXML :: [Node] -> Either String AnalyticsAndOperator
parseXML [Node]
x =
Maybe Text -> Maybe [Tag] -> AnalyticsAndOperator
AnalyticsAndOperator'
(Maybe Text -> Maybe [Tag] -> AnalyticsAndOperator)
-> Either String (Maybe Text)
-> Either String (Maybe [Tag] -> AnalyticsAndOperator)
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] -> AnalyticsAndOperator)
-> Either String (Maybe [Tag])
-> Either String AnalyticsAndOperator
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 AnalyticsAndOperator
instance Prelude.NFData AnalyticsAndOperator
instance Core.ToXML AnalyticsAndOperator where
toXML :: AnalyticsAndOperator -> XML
toXML AnalyticsAndOperator' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
prefix :: Maybe Text
$sel:tags:AnalyticsAndOperator' :: AnalyticsAndOperator -> Maybe [Tag]
$sel:prefix:AnalyticsAndOperator' :: AnalyticsAndOperator -> 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)
]