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