{-# 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.CloudWatch.Types.InsightRuleContributor where
import Amazonka.CloudWatch.Types.InsightRuleContributorDatapoint
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InsightRuleContributor = InsightRuleContributor'
{
InsightRuleContributor -> [Text]
keys :: [Prelude.Text],
InsightRuleContributor -> Double
approximateAggregateValue :: Prelude.Double,
InsightRuleContributor -> [InsightRuleContributorDatapoint]
datapoints :: [InsightRuleContributorDatapoint]
}
deriving (InsightRuleContributor -> InsightRuleContributor -> Bool
(InsightRuleContributor -> InsightRuleContributor -> Bool)
-> (InsightRuleContributor -> InsightRuleContributor -> Bool)
-> Eq InsightRuleContributor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsightRuleContributor -> InsightRuleContributor -> Bool
$c/= :: InsightRuleContributor -> InsightRuleContributor -> Bool
== :: InsightRuleContributor -> InsightRuleContributor -> Bool
$c== :: InsightRuleContributor -> InsightRuleContributor -> Bool
Prelude.Eq, ReadPrec [InsightRuleContributor]
ReadPrec InsightRuleContributor
Int -> ReadS InsightRuleContributor
ReadS [InsightRuleContributor]
(Int -> ReadS InsightRuleContributor)
-> ReadS [InsightRuleContributor]
-> ReadPrec InsightRuleContributor
-> ReadPrec [InsightRuleContributor]
-> Read InsightRuleContributor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InsightRuleContributor]
$creadListPrec :: ReadPrec [InsightRuleContributor]
readPrec :: ReadPrec InsightRuleContributor
$creadPrec :: ReadPrec InsightRuleContributor
readList :: ReadS [InsightRuleContributor]
$creadList :: ReadS [InsightRuleContributor]
readsPrec :: Int -> ReadS InsightRuleContributor
$creadsPrec :: Int -> ReadS InsightRuleContributor
Prelude.Read, Int -> InsightRuleContributor -> ShowS
[InsightRuleContributor] -> ShowS
InsightRuleContributor -> String
(Int -> InsightRuleContributor -> ShowS)
-> (InsightRuleContributor -> String)
-> ([InsightRuleContributor] -> ShowS)
-> Show InsightRuleContributor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsightRuleContributor] -> ShowS
$cshowList :: [InsightRuleContributor] -> ShowS
show :: InsightRuleContributor -> String
$cshow :: InsightRuleContributor -> String
showsPrec :: Int -> InsightRuleContributor -> ShowS
$cshowsPrec :: Int -> InsightRuleContributor -> ShowS
Prelude.Show, (forall x. InsightRuleContributor -> Rep InsightRuleContributor x)
-> (forall x.
Rep InsightRuleContributor x -> InsightRuleContributor)
-> Generic InsightRuleContributor
forall x. Rep InsightRuleContributor x -> InsightRuleContributor
forall x. InsightRuleContributor -> Rep InsightRuleContributor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InsightRuleContributor x -> InsightRuleContributor
$cfrom :: forall x. InsightRuleContributor -> Rep InsightRuleContributor x
Prelude.Generic)
newInsightRuleContributor ::
Prelude.Double ->
InsightRuleContributor
newInsightRuleContributor :: Double -> InsightRuleContributor
newInsightRuleContributor Double
pApproximateAggregateValue_ =
InsightRuleContributor' :: [Text]
-> Double
-> [InsightRuleContributorDatapoint]
-> InsightRuleContributor
InsightRuleContributor'
{ $sel:keys:InsightRuleContributor' :: [Text]
keys = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:approximateAggregateValue:InsightRuleContributor' :: Double
approximateAggregateValue =
Double
pApproximateAggregateValue_,
$sel:datapoints:InsightRuleContributor' :: [InsightRuleContributorDatapoint]
datapoints = [InsightRuleContributorDatapoint]
forall a. Monoid a => a
Prelude.mempty
}
insightRuleContributor_keys :: Lens.Lens' InsightRuleContributor [Prelude.Text]
insightRuleContributor_keys :: ([Text] -> f [Text])
-> InsightRuleContributor -> f InsightRuleContributor
insightRuleContributor_keys = (InsightRuleContributor -> [Text])
-> (InsightRuleContributor -> [Text] -> InsightRuleContributor)
-> Lens InsightRuleContributor InsightRuleContributor [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRuleContributor' {[Text]
keys :: [Text]
$sel:keys:InsightRuleContributor' :: InsightRuleContributor -> [Text]
keys} -> [Text]
keys) (\s :: InsightRuleContributor
s@InsightRuleContributor' {} [Text]
a -> InsightRuleContributor
s {$sel:keys:InsightRuleContributor' :: [Text]
keys = [Text]
a} :: InsightRuleContributor) (([Text] -> f [Text])
-> InsightRuleContributor -> f InsightRuleContributor)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> InsightRuleContributor
-> f InsightRuleContributor
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
insightRuleContributor_approximateAggregateValue :: Lens.Lens' InsightRuleContributor Prelude.Double
insightRuleContributor_approximateAggregateValue :: (Double -> f Double)
-> InsightRuleContributor -> f InsightRuleContributor
insightRuleContributor_approximateAggregateValue = (InsightRuleContributor -> Double)
-> (InsightRuleContributor -> Double -> InsightRuleContributor)
-> Lens InsightRuleContributor InsightRuleContributor Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRuleContributor' {Double
approximateAggregateValue :: Double
$sel:approximateAggregateValue:InsightRuleContributor' :: InsightRuleContributor -> Double
approximateAggregateValue} -> Double
approximateAggregateValue) (\s :: InsightRuleContributor
s@InsightRuleContributor' {} Double
a -> InsightRuleContributor
s {$sel:approximateAggregateValue:InsightRuleContributor' :: Double
approximateAggregateValue = Double
a} :: InsightRuleContributor)
insightRuleContributor_datapoints :: Lens.Lens' InsightRuleContributor [InsightRuleContributorDatapoint]
insightRuleContributor_datapoints :: ([InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> InsightRuleContributor -> f InsightRuleContributor
insightRuleContributor_datapoints = (InsightRuleContributor -> [InsightRuleContributorDatapoint])
-> (InsightRuleContributor
-> [InsightRuleContributorDatapoint] -> InsightRuleContributor)
-> Lens
InsightRuleContributor
InsightRuleContributor
[InsightRuleContributorDatapoint]
[InsightRuleContributorDatapoint]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRuleContributor' {[InsightRuleContributorDatapoint]
datapoints :: [InsightRuleContributorDatapoint]
$sel:datapoints:InsightRuleContributor' :: InsightRuleContributor -> [InsightRuleContributorDatapoint]
datapoints} -> [InsightRuleContributorDatapoint]
datapoints) (\s :: InsightRuleContributor
s@InsightRuleContributor' {} [InsightRuleContributorDatapoint]
a -> InsightRuleContributor
s {$sel:datapoints:InsightRuleContributor' :: [InsightRuleContributorDatapoint]
datapoints = [InsightRuleContributorDatapoint]
a} :: InsightRuleContributor) (([InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> InsightRuleContributor -> f InsightRuleContributor)
-> (([InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> [InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> ([InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> InsightRuleContributor
-> f InsightRuleContributor
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint])
-> [InsightRuleContributorDatapoint]
-> f [InsightRuleContributorDatapoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML InsightRuleContributor where
parseXML :: [Node] -> Either String InsightRuleContributor
parseXML [Node]
x =
[Text]
-> Double
-> [InsightRuleContributorDatapoint]
-> InsightRuleContributor
InsightRuleContributor'
([Text]
-> Double
-> [InsightRuleContributorDatapoint]
-> InsightRuleContributor)
-> Either String [Text]
-> Either
String
(Double
-> [InsightRuleContributorDatapoint] -> InsightRuleContributor)
forall (f :: * -> *) a b. Functor 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
"Keys" 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 [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
)
Either
String
(Double
-> [InsightRuleContributorDatapoint] -> InsightRuleContributor)
-> Either String Double
-> Either
String
([InsightRuleContributorDatapoint] -> InsightRuleContributor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Double
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ApproximateAggregateValue")
Either
String
([InsightRuleContributorDatapoint] -> InsightRuleContributor)
-> Either String [InsightRuleContributorDatapoint]
-> Either String InsightRuleContributor
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
"Datapoints" 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 [InsightRuleContributorDatapoint])
-> Either String [InsightRuleContributorDatapoint]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [InsightRuleContributorDatapoint]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
)
instance Prelude.Hashable InsightRuleContributor
instance Prelude.NFData InsightRuleContributor