{-# 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.AnomalyDetector where
import Amazonka.CloudWatch.Types.AnomalyDetectorConfiguration
import Amazonka.CloudWatch.Types.AnomalyDetectorStateValue
import Amazonka.CloudWatch.Types.Dimension
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AnomalyDetector = AnomalyDetector'
{
AnomalyDetector -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
AnomalyDetector -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
AnomalyDetector -> Maybe AnomalyDetectorStateValue
stateValue :: Prelude.Maybe AnomalyDetectorStateValue,
AnomalyDetector -> Maybe Text
stat :: Prelude.Maybe Prelude.Text,
AnomalyDetector -> Maybe AnomalyDetectorConfiguration
configuration :: Prelude.Maybe AnomalyDetectorConfiguration,
AnomalyDetector -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension]
}
deriving (AnomalyDetector -> AnomalyDetector -> Bool
(AnomalyDetector -> AnomalyDetector -> Bool)
-> (AnomalyDetector -> AnomalyDetector -> Bool)
-> Eq AnomalyDetector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyDetector -> AnomalyDetector -> Bool
$c/= :: AnomalyDetector -> AnomalyDetector -> Bool
== :: AnomalyDetector -> AnomalyDetector -> Bool
$c== :: AnomalyDetector -> AnomalyDetector -> Bool
Prelude.Eq, ReadPrec [AnomalyDetector]
ReadPrec AnomalyDetector
Int -> ReadS AnomalyDetector
ReadS [AnomalyDetector]
(Int -> ReadS AnomalyDetector)
-> ReadS [AnomalyDetector]
-> ReadPrec AnomalyDetector
-> ReadPrec [AnomalyDetector]
-> Read AnomalyDetector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyDetector]
$creadListPrec :: ReadPrec [AnomalyDetector]
readPrec :: ReadPrec AnomalyDetector
$creadPrec :: ReadPrec AnomalyDetector
readList :: ReadS [AnomalyDetector]
$creadList :: ReadS [AnomalyDetector]
readsPrec :: Int -> ReadS AnomalyDetector
$creadsPrec :: Int -> ReadS AnomalyDetector
Prelude.Read, Int -> AnomalyDetector -> ShowS
[AnomalyDetector] -> ShowS
AnomalyDetector -> String
(Int -> AnomalyDetector -> ShowS)
-> (AnomalyDetector -> String)
-> ([AnomalyDetector] -> ShowS)
-> Show AnomalyDetector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyDetector] -> ShowS
$cshowList :: [AnomalyDetector] -> ShowS
show :: AnomalyDetector -> String
$cshow :: AnomalyDetector -> String
showsPrec :: Int -> AnomalyDetector -> ShowS
$cshowsPrec :: Int -> AnomalyDetector -> ShowS
Prelude.Show, (forall x. AnomalyDetector -> Rep AnomalyDetector x)
-> (forall x. Rep AnomalyDetector x -> AnomalyDetector)
-> Generic AnomalyDetector
forall x. Rep AnomalyDetector x -> AnomalyDetector
forall x. AnomalyDetector -> Rep AnomalyDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyDetector x -> AnomalyDetector
$cfrom :: forall x. AnomalyDetector -> Rep AnomalyDetector x
Prelude.Generic)
newAnomalyDetector ::
AnomalyDetector
newAnomalyDetector :: AnomalyDetector
newAnomalyDetector =
AnomalyDetector' :: Maybe Text
-> Maybe Text
-> Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector
AnomalyDetector'
{ $sel:metricName:AnomalyDetector' :: Maybe Text
metricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:namespace:AnomalyDetector' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stateValue:AnomalyDetector' :: Maybe AnomalyDetectorStateValue
stateValue = Maybe AnomalyDetectorStateValue
forall a. Maybe a
Prelude.Nothing,
$sel:stat:AnomalyDetector' :: Maybe Text
stat = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:configuration:AnomalyDetector' :: Maybe AnomalyDetectorConfiguration
configuration = Maybe AnomalyDetectorConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:dimensions:AnomalyDetector' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing
}
anomalyDetector_metricName :: Lens.Lens' AnomalyDetector (Prelude.Maybe Prelude.Text)
anomalyDetector_metricName :: (Maybe Text -> f (Maybe Text))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_metricName = (AnomalyDetector -> Maybe Text)
-> (AnomalyDetector -> Maybe Text -> AnomalyDetector)
-> Lens AnomalyDetector AnomalyDetector (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe Text
metricName :: Maybe Text
$sel:metricName:AnomalyDetector' :: AnomalyDetector -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe Text
a -> AnomalyDetector
s {$sel:metricName:AnomalyDetector' :: Maybe Text
metricName = Maybe Text
a} :: AnomalyDetector)
anomalyDetector_namespace :: Lens.Lens' AnomalyDetector (Prelude.Maybe Prelude.Text)
anomalyDetector_namespace :: (Maybe Text -> f (Maybe Text))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_namespace = (AnomalyDetector -> Maybe Text)
-> (AnomalyDetector -> Maybe Text -> AnomalyDetector)
-> Lens AnomalyDetector AnomalyDetector (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe Text
namespace :: Maybe Text
$sel:namespace:AnomalyDetector' :: AnomalyDetector -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe Text
a -> AnomalyDetector
s {$sel:namespace:AnomalyDetector' :: Maybe Text
namespace = Maybe Text
a} :: AnomalyDetector)
anomalyDetector_stateValue :: Lens.Lens' AnomalyDetector (Prelude.Maybe AnomalyDetectorStateValue)
anomalyDetector_stateValue :: (Maybe AnomalyDetectorStateValue
-> f (Maybe AnomalyDetectorStateValue))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_stateValue = (AnomalyDetector -> Maybe AnomalyDetectorStateValue)
-> (AnomalyDetector
-> Maybe AnomalyDetectorStateValue -> AnomalyDetector)
-> Lens
AnomalyDetector
AnomalyDetector
(Maybe AnomalyDetectorStateValue)
(Maybe AnomalyDetectorStateValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe AnomalyDetectorStateValue
stateValue :: Maybe AnomalyDetectorStateValue
$sel:stateValue:AnomalyDetector' :: AnomalyDetector -> Maybe AnomalyDetectorStateValue
stateValue} -> Maybe AnomalyDetectorStateValue
stateValue) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe AnomalyDetectorStateValue
a -> AnomalyDetector
s {$sel:stateValue:AnomalyDetector' :: Maybe AnomalyDetectorStateValue
stateValue = Maybe AnomalyDetectorStateValue
a} :: AnomalyDetector)
anomalyDetector_stat :: Lens.Lens' AnomalyDetector (Prelude.Maybe Prelude.Text)
anomalyDetector_stat :: (Maybe Text -> f (Maybe Text))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_stat = (AnomalyDetector -> Maybe Text)
-> (AnomalyDetector -> Maybe Text -> AnomalyDetector)
-> Lens AnomalyDetector AnomalyDetector (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe Text
stat :: Maybe Text
$sel:stat:AnomalyDetector' :: AnomalyDetector -> Maybe Text
stat} -> Maybe Text
stat) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe Text
a -> AnomalyDetector
s {$sel:stat:AnomalyDetector' :: Maybe Text
stat = Maybe Text
a} :: AnomalyDetector)
anomalyDetector_configuration :: Lens.Lens' AnomalyDetector (Prelude.Maybe AnomalyDetectorConfiguration)
anomalyDetector_configuration :: (Maybe AnomalyDetectorConfiguration
-> f (Maybe AnomalyDetectorConfiguration))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_configuration = (AnomalyDetector -> Maybe AnomalyDetectorConfiguration)
-> (AnomalyDetector
-> Maybe AnomalyDetectorConfiguration -> AnomalyDetector)
-> Lens
AnomalyDetector
AnomalyDetector
(Maybe AnomalyDetectorConfiguration)
(Maybe AnomalyDetectorConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe AnomalyDetectorConfiguration
configuration :: Maybe AnomalyDetectorConfiguration
$sel:configuration:AnomalyDetector' :: AnomalyDetector -> Maybe AnomalyDetectorConfiguration
configuration} -> Maybe AnomalyDetectorConfiguration
configuration) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe AnomalyDetectorConfiguration
a -> AnomalyDetector
s {$sel:configuration:AnomalyDetector' :: Maybe AnomalyDetectorConfiguration
configuration = Maybe AnomalyDetectorConfiguration
a} :: AnomalyDetector)
anomalyDetector_dimensions :: Lens.Lens' AnomalyDetector (Prelude.Maybe [Dimension])
anomalyDetector_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> AnomalyDetector -> f AnomalyDetector
anomalyDetector_dimensions = (AnomalyDetector -> Maybe [Dimension])
-> (AnomalyDetector -> Maybe [Dimension] -> AnomalyDetector)
-> Lens
AnomalyDetector
AnomalyDetector
(Maybe [Dimension])
(Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetector' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:AnomalyDetector' :: AnomalyDetector -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: AnomalyDetector
s@AnomalyDetector' {} Maybe [Dimension]
a -> AnomalyDetector
s {$sel:dimensions:AnomalyDetector' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: AnomalyDetector) ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> AnomalyDetector -> f AnomalyDetector)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> AnomalyDetector
-> f AnomalyDetector
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML AnomalyDetector where
parseXML :: [Node] -> Either String AnomalyDetector
parseXML [Node]
x =
Maybe Text
-> Maybe Text
-> Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector
AnomalyDetector'
(Maybe Text
-> Maybe Text
-> Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
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
"MetricName")
Either
String
(Maybe Text
-> Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
-> Either String (Maybe Text)
-> Either
String
(Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
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
"Namespace")
Either
String
(Maybe AnomalyDetectorStateValue
-> Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
-> Either String (Maybe AnomalyDetectorStateValue)
-> Either
String
(Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AnomalyDetectorStateValue)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StateValue")
Either
String
(Maybe Text
-> Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension]
-> AnomalyDetector)
-> Either String (Maybe Text)
-> Either
String
(Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension] -> AnomalyDetector)
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
"Stat")
Either
String
(Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension] -> AnomalyDetector)
-> Either String (Maybe AnomalyDetectorConfiguration)
-> Either String (Maybe [Dimension] -> AnomalyDetector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text -> Either String (Maybe AnomalyDetectorConfiguration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Configuration")
Either String (Maybe [Dimension] -> AnomalyDetector)
-> Either String (Maybe [Dimension])
-> Either String AnomalyDetector
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
"Dimensions" 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 [Dimension]))
-> Either String (Maybe [Dimension])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Dimension])
-> [Node] -> Either String (Maybe [Dimension])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Dimension]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
instance Prelude.Hashable AnomalyDetector
instance Prelude.NFData AnomalyDetector