{-# 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.AnomalyDetectorConfiguration where
import Amazonka.CloudWatch.Types.Range
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data AnomalyDetectorConfiguration = AnomalyDetectorConfiguration'
{
AnomalyDetectorConfiguration -> Maybe [Range]
excludedTimeRanges :: Prelude.Maybe [Range],
AnomalyDetectorConfiguration -> Maybe Text
metricTimezone :: Prelude.Maybe Prelude.Text
}
deriving (AnomalyDetectorConfiguration
-> AnomalyDetectorConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyDetectorConfiguration
-> AnomalyDetectorConfiguration -> Bool
$c/= :: AnomalyDetectorConfiguration
-> AnomalyDetectorConfiguration -> Bool
== :: AnomalyDetectorConfiguration
-> AnomalyDetectorConfiguration -> Bool
$c== :: AnomalyDetectorConfiguration
-> AnomalyDetectorConfiguration -> Bool
Prelude.Eq, ReadPrec [AnomalyDetectorConfiguration]
ReadPrec AnomalyDetectorConfiguration
Int -> ReadS AnomalyDetectorConfiguration
ReadS [AnomalyDetectorConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyDetectorConfiguration]
$creadListPrec :: ReadPrec [AnomalyDetectorConfiguration]
readPrec :: ReadPrec AnomalyDetectorConfiguration
$creadPrec :: ReadPrec AnomalyDetectorConfiguration
readList :: ReadS [AnomalyDetectorConfiguration]
$creadList :: ReadS [AnomalyDetectorConfiguration]
readsPrec :: Int -> ReadS AnomalyDetectorConfiguration
$creadsPrec :: Int -> ReadS AnomalyDetectorConfiguration
Prelude.Read, Int -> AnomalyDetectorConfiguration -> ShowS
[AnomalyDetectorConfiguration] -> ShowS
AnomalyDetectorConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyDetectorConfiguration] -> ShowS
$cshowList :: [AnomalyDetectorConfiguration] -> ShowS
show :: AnomalyDetectorConfiguration -> String
$cshow :: AnomalyDetectorConfiguration -> String
showsPrec :: Int -> AnomalyDetectorConfiguration -> ShowS
$cshowsPrec :: Int -> AnomalyDetectorConfiguration -> ShowS
Prelude.Show, forall x.
Rep AnomalyDetectorConfiguration x -> AnomalyDetectorConfiguration
forall x.
AnomalyDetectorConfiguration -> Rep AnomalyDetectorConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnomalyDetectorConfiguration x -> AnomalyDetectorConfiguration
$cfrom :: forall x.
AnomalyDetectorConfiguration -> Rep AnomalyDetectorConfiguration x
Prelude.Generic)
newAnomalyDetectorConfiguration ::
AnomalyDetectorConfiguration
newAnomalyDetectorConfiguration :: AnomalyDetectorConfiguration
newAnomalyDetectorConfiguration =
AnomalyDetectorConfiguration'
{ $sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: Maybe [Range]
excludedTimeRanges =
forall a. Maybe a
Prelude.Nothing,
$sel:metricTimezone:AnomalyDetectorConfiguration' :: Maybe Text
metricTimezone = forall a. Maybe a
Prelude.Nothing
}
anomalyDetectorConfiguration_excludedTimeRanges :: Lens.Lens' AnomalyDetectorConfiguration (Prelude.Maybe [Range])
anomalyDetectorConfiguration_excludedTimeRanges :: Lens' AnomalyDetectorConfiguration (Maybe [Range])
anomalyDetectorConfiguration_excludedTimeRanges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorConfiguration' {Maybe [Range]
excludedTimeRanges :: Maybe [Range]
$sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe [Range]
excludedTimeRanges} -> Maybe [Range]
excludedTimeRanges) (\s :: AnomalyDetectorConfiguration
s@AnomalyDetectorConfiguration' {} Maybe [Range]
a -> AnomalyDetectorConfiguration
s {$sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: Maybe [Range]
excludedTimeRanges = Maybe [Range]
a} :: AnomalyDetectorConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
anomalyDetectorConfiguration_metricTimezone :: Lens.Lens' AnomalyDetectorConfiguration (Prelude.Maybe Prelude.Text)
anomalyDetectorConfiguration_metricTimezone :: Lens' AnomalyDetectorConfiguration (Maybe Text)
anomalyDetectorConfiguration_metricTimezone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorConfiguration' {Maybe Text
metricTimezone :: Maybe Text
$sel:metricTimezone:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe Text
metricTimezone} -> Maybe Text
metricTimezone) (\s :: AnomalyDetectorConfiguration
s@AnomalyDetectorConfiguration' {} Maybe Text
a -> AnomalyDetectorConfiguration
s {$sel:metricTimezone:AnomalyDetectorConfiguration' :: Maybe Text
metricTimezone = Maybe Text
a} :: AnomalyDetectorConfiguration)
instance Data.FromXML AnomalyDetectorConfiguration where
parseXML :: [Node] -> Either String AnomalyDetectorConfiguration
parseXML [Node]
x =
Maybe [Range] -> Maybe Text -> AnomalyDetectorConfiguration
AnomalyDetectorConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ExcludedTimeRanges"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MetricTimezone")
instance
Prelude.Hashable
AnomalyDetectorConfiguration
where
hashWithSalt :: Int -> AnomalyDetectorConfiguration -> Int
hashWithSalt Int
_salt AnomalyDetectorConfiguration' {Maybe [Range]
Maybe Text
metricTimezone :: Maybe Text
excludedTimeRanges :: Maybe [Range]
$sel:metricTimezone:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe Text
$sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe [Range]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Range]
excludedTimeRanges
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metricTimezone
instance Prelude.NFData AnomalyDetectorConfiguration where
rnf :: AnomalyDetectorConfiguration -> ()
rnf AnomalyDetectorConfiguration' {Maybe [Range]
Maybe Text
metricTimezone :: Maybe Text
excludedTimeRanges :: Maybe [Range]
$sel:metricTimezone:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe Text
$sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe [Range]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Range]
excludedTimeRanges
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricTimezone
instance Data.ToQuery AnomalyDetectorConfiguration where
toQuery :: AnomalyDetectorConfiguration -> QueryString
toQuery AnomalyDetectorConfiguration' {Maybe [Range]
Maybe Text
metricTimezone :: Maybe Text
excludedTimeRanges :: Maybe [Range]
$sel:metricTimezone:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe Text
$sel:excludedTimeRanges:AnomalyDetectorConfiguration' :: AnomalyDetectorConfiguration -> Maybe [Range]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"ExcludedTimeRanges"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member"
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Range]
excludedTimeRanges
),
ByteString
"MetricTimezone" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
metricTimezone
]