{-# 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.EMR.Types.CloudWatchAlarmDefinition where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.ComparisonOperator
import Amazonka.EMR.Types.MetricDimension
import Amazonka.EMR.Types.Statistic
import Amazonka.EMR.Types.Unit
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CloudWatchAlarmDefinition = CloudWatchAlarmDefinition'
{
CloudWatchAlarmDefinition -> Maybe Int
evaluationPeriods :: Prelude.Maybe Prelude.Int,
CloudWatchAlarmDefinition -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
CloudWatchAlarmDefinition -> Maybe [MetricDimension]
dimensions :: Prelude.Maybe [MetricDimension],
CloudWatchAlarmDefinition -> Maybe Unit
unit :: Prelude.Maybe Unit,
CloudWatchAlarmDefinition -> Maybe Statistic
statistic :: Prelude.Maybe Statistic,
CloudWatchAlarmDefinition -> ComparisonOperator
comparisonOperator :: ComparisonOperator,
CloudWatchAlarmDefinition -> Text
metricName :: Prelude.Text,
CloudWatchAlarmDefinition -> Int
period :: Prelude.Int,
CloudWatchAlarmDefinition -> Double
threshold :: Prelude.Double
}
deriving (CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool
(CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool)
-> (CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool)
-> Eq CloudWatchAlarmDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool
$c/= :: CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool
== :: CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool
$c== :: CloudWatchAlarmDefinition -> CloudWatchAlarmDefinition -> Bool
Prelude.Eq, ReadPrec [CloudWatchAlarmDefinition]
ReadPrec CloudWatchAlarmDefinition
Int -> ReadS CloudWatchAlarmDefinition
ReadS [CloudWatchAlarmDefinition]
(Int -> ReadS CloudWatchAlarmDefinition)
-> ReadS [CloudWatchAlarmDefinition]
-> ReadPrec CloudWatchAlarmDefinition
-> ReadPrec [CloudWatchAlarmDefinition]
-> Read CloudWatchAlarmDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchAlarmDefinition]
$creadListPrec :: ReadPrec [CloudWatchAlarmDefinition]
readPrec :: ReadPrec CloudWatchAlarmDefinition
$creadPrec :: ReadPrec CloudWatchAlarmDefinition
readList :: ReadS [CloudWatchAlarmDefinition]
$creadList :: ReadS [CloudWatchAlarmDefinition]
readsPrec :: Int -> ReadS CloudWatchAlarmDefinition
$creadsPrec :: Int -> ReadS CloudWatchAlarmDefinition
Prelude.Read, Int -> CloudWatchAlarmDefinition -> ShowS
[CloudWatchAlarmDefinition] -> ShowS
CloudWatchAlarmDefinition -> String
(Int -> CloudWatchAlarmDefinition -> ShowS)
-> (CloudWatchAlarmDefinition -> String)
-> ([CloudWatchAlarmDefinition] -> ShowS)
-> Show CloudWatchAlarmDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchAlarmDefinition] -> ShowS
$cshowList :: [CloudWatchAlarmDefinition] -> ShowS
show :: CloudWatchAlarmDefinition -> String
$cshow :: CloudWatchAlarmDefinition -> String
showsPrec :: Int -> CloudWatchAlarmDefinition -> ShowS
$cshowsPrec :: Int -> CloudWatchAlarmDefinition -> ShowS
Prelude.Show, (forall x.
CloudWatchAlarmDefinition -> Rep CloudWatchAlarmDefinition x)
-> (forall x.
Rep CloudWatchAlarmDefinition x -> CloudWatchAlarmDefinition)
-> Generic CloudWatchAlarmDefinition
forall x.
Rep CloudWatchAlarmDefinition x -> CloudWatchAlarmDefinition
forall x.
CloudWatchAlarmDefinition -> Rep CloudWatchAlarmDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchAlarmDefinition x -> CloudWatchAlarmDefinition
$cfrom :: forall x.
CloudWatchAlarmDefinition -> Rep CloudWatchAlarmDefinition x
Prelude.Generic)
newCloudWatchAlarmDefinition ::
ComparisonOperator ->
Prelude.Text ->
Prelude.Int ->
Prelude.Double ->
CloudWatchAlarmDefinition
newCloudWatchAlarmDefinition :: ComparisonOperator
-> Text -> Int -> Double -> CloudWatchAlarmDefinition
newCloudWatchAlarmDefinition
ComparisonOperator
pComparisonOperator_
Text
pMetricName_
Int
pPeriod_
Double
pThreshold_ =
CloudWatchAlarmDefinition' :: Maybe Int
-> Maybe Text
-> Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition
CloudWatchAlarmDefinition'
{ $sel:evaluationPeriods:CloudWatchAlarmDefinition' :: Maybe Int
evaluationPeriods =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:namespace:CloudWatchAlarmDefinition' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dimensions:CloudWatchAlarmDefinition' :: Maybe [MetricDimension]
dimensions = Maybe [MetricDimension]
forall a. Maybe a
Prelude.Nothing,
$sel:unit:CloudWatchAlarmDefinition' :: Maybe Unit
unit = Maybe Unit
forall a. Maybe a
Prelude.Nothing,
$sel:statistic:CloudWatchAlarmDefinition' :: Maybe Statistic
statistic = Maybe Statistic
forall a. Maybe a
Prelude.Nothing,
$sel:comparisonOperator:CloudWatchAlarmDefinition' :: ComparisonOperator
comparisonOperator = ComparisonOperator
pComparisonOperator_,
$sel:metricName:CloudWatchAlarmDefinition' :: Text
metricName = Text
pMetricName_,
$sel:period:CloudWatchAlarmDefinition' :: Int
period = Int
pPeriod_,
$sel:threshold:CloudWatchAlarmDefinition' :: Double
threshold = Double
pThreshold_
}
cloudWatchAlarmDefinition_evaluationPeriods :: Lens.Lens' CloudWatchAlarmDefinition (Prelude.Maybe Prelude.Int)
cloudWatchAlarmDefinition_evaluationPeriods :: (Maybe Int -> f (Maybe Int))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_evaluationPeriods = (CloudWatchAlarmDefinition -> Maybe Int)
-> (CloudWatchAlarmDefinition
-> Maybe Int -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
(Maybe Int)
(Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Maybe Int
evaluationPeriods :: Maybe Int
$sel:evaluationPeriods:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Int
evaluationPeriods} -> Maybe Int
evaluationPeriods) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Maybe Int
a -> CloudWatchAlarmDefinition
s {$sel:evaluationPeriods:CloudWatchAlarmDefinition' :: Maybe Int
evaluationPeriods = Maybe Int
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_namespace :: Lens.Lens' CloudWatchAlarmDefinition (Prelude.Maybe Prelude.Text)
cloudWatchAlarmDefinition_namespace :: (Maybe Text -> f (Maybe Text))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_namespace = (CloudWatchAlarmDefinition -> Maybe Text)
-> (CloudWatchAlarmDefinition
-> Maybe Text -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Maybe Text
namespace :: Maybe Text
$sel:namespace:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Maybe Text
a -> CloudWatchAlarmDefinition
s {$sel:namespace:CloudWatchAlarmDefinition' :: Maybe Text
namespace = Maybe Text
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_dimensions :: Lens.Lens' CloudWatchAlarmDefinition (Prelude.Maybe [MetricDimension])
cloudWatchAlarmDefinition_dimensions :: (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_dimensions = (CloudWatchAlarmDefinition -> Maybe [MetricDimension])
-> (CloudWatchAlarmDefinition
-> Maybe [MetricDimension] -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
(Maybe [MetricDimension])
(Maybe [MetricDimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Maybe [MetricDimension]
dimensions :: Maybe [MetricDimension]
$sel:dimensions:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe [MetricDimension]
dimensions} -> Maybe [MetricDimension]
dimensions) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Maybe [MetricDimension]
a -> CloudWatchAlarmDefinition
s {$sel:dimensions:CloudWatchAlarmDefinition' :: Maybe [MetricDimension]
dimensions = Maybe [MetricDimension]
a} :: CloudWatchAlarmDefinition) ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition)
-> ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CloudWatchAlarmDefinition
-> f CloudWatchAlarmDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricDimension]
[MetricDimension]
[MetricDimension]
[MetricDimension]
-> Iso
(Maybe [MetricDimension])
(Maybe [MetricDimension])
(Maybe [MetricDimension])
(Maybe [MetricDimension])
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
[MetricDimension]
[MetricDimension]
[MetricDimension]
[MetricDimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
cloudWatchAlarmDefinition_unit :: Lens.Lens' CloudWatchAlarmDefinition (Prelude.Maybe Unit)
cloudWatchAlarmDefinition_unit :: (Maybe Unit -> f (Maybe Unit))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_unit = (CloudWatchAlarmDefinition -> Maybe Unit)
-> (CloudWatchAlarmDefinition
-> Maybe Unit -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
(Maybe Unit)
(Maybe Unit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Maybe Unit
unit :: Maybe Unit
$sel:unit:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Unit
unit} -> Maybe Unit
unit) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Maybe Unit
a -> CloudWatchAlarmDefinition
s {$sel:unit:CloudWatchAlarmDefinition' :: Maybe Unit
unit = Maybe Unit
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_statistic :: Lens.Lens' CloudWatchAlarmDefinition (Prelude.Maybe Statistic)
cloudWatchAlarmDefinition_statistic :: (Maybe Statistic -> f (Maybe Statistic))
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_statistic = (CloudWatchAlarmDefinition -> Maybe Statistic)
-> (CloudWatchAlarmDefinition
-> Maybe Statistic -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
(Maybe Statistic)
(Maybe Statistic)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Maybe Statistic
statistic :: Maybe Statistic
$sel:statistic:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Statistic
statistic} -> Maybe Statistic
statistic) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Maybe Statistic
a -> CloudWatchAlarmDefinition
s {$sel:statistic:CloudWatchAlarmDefinition' :: Maybe Statistic
statistic = Maybe Statistic
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_comparisonOperator :: Lens.Lens' CloudWatchAlarmDefinition ComparisonOperator
cloudWatchAlarmDefinition_comparisonOperator :: (ComparisonOperator -> f ComparisonOperator)
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_comparisonOperator = (CloudWatchAlarmDefinition -> ComparisonOperator)
-> (CloudWatchAlarmDefinition
-> ComparisonOperator -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition
CloudWatchAlarmDefinition
ComparisonOperator
ComparisonOperator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {ComparisonOperator
comparisonOperator :: ComparisonOperator
$sel:comparisonOperator:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> ComparisonOperator
comparisonOperator} -> ComparisonOperator
comparisonOperator) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} ComparisonOperator
a -> CloudWatchAlarmDefinition
s {$sel:comparisonOperator:CloudWatchAlarmDefinition' :: ComparisonOperator
comparisonOperator = ComparisonOperator
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_metricName :: Lens.Lens' CloudWatchAlarmDefinition Prelude.Text
cloudWatchAlarmDefinition_metricName :: (Text -> f Text)
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_metricName = (CloudWatchAlarmDefinition -> Text)
-> (CloudWatchAlarmDefinition -> Text -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition CloudWatchAlarmDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Text
metricName :: Text
$sel:metricName:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Text
metricName} -> Text
metricName) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Text
a -> CloudWatchAlarmDefinition
s {$sel:metricName:CloudWatchAlarmDefinition' :: Text
metricName = Text
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_period :: Lens.Lens' CloudWatchAlarmDefinition Prelude.Int
cloudWatchAlarmDefinition_period :: (Int -> f Int)
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_period = (CloudWatchAlarmDefinition -> Int)
-> (CloudWatchAlarmDefinition -> Int -> CloudWatchAlarmDefinition)
-> Lens CloudWatchAlarmDefinition CloudWatchAlarmDefinition Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Int
period :: Int
$sel:period:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Int
period} -> Int
period) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Int
a -> CloudWatchAlarmDefinition
s {$sel:period:CloudWatchAlarmDefinition' :: Int
period = Int
a} :: CloudWatchAlarmDefinition)
cloudWatchAlarmDefinition_threshold :: Lens.Lens' CloudWatchAlarmDefinition Prelude.Double
cloudWatchAlarmDefinition_threshold :: (Double -> f Double)
-> CloudWatchAlarmDefinition -> f CloudWatchAlarmDefinition
cloudWatchAlarmDefinition_threshold = (CloudWatchAlarmDefinition -> Double)
-> (CloudWatchAlarmDefinition
-> Double -> CloudWatchAlarmDefinition)
-> Lens
CloudWatchAlarmDefinition CloudWatchAlarmDefinition Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmDefinition' {Double
threshold :: Double
$sel:threshold:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Double
threshold} -> Double
threshold) (\s :: CloudWatchAlarmDefinition
s@CloudWatchAlarmDefinition' {} Double
a -> CloudWatchAlarmDefinition
s {$sel:threshold:CloudWatchAlarmDefinition' :: Double
threshold = Double
a} :: CloudWatchAlarmDefinition)
instance Core.FromJSON CloudWatchAlarmDefinition where
parseJSON :: Value -> Parser CloudWatchAlarmDefinition
parseJSON =
String
-> (Object -> Parser CloudWatchAlarmDefinition)
-> Value
-> Parser CloudWatchAlarmDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CloudWatchAlarmDefinition"
( \Object
x ->
Maybe Int
-> Maybe Text
-> Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition
CloudWatchAlarmDefinition'
(Maybe Int
-> Maybe Text
-> Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EvaluationPeriods")
Parser
(Maybe Text
-> Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
-> Parser (Maybe Text)
-> Parser
(Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Namespace")
Parser
(Maybe [MetricDimension]
-> Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
-> Parser (Maybe [MetricDimension])
-> Parser
(Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [MetricDimension]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Dimensions" Parser (Maybe (Maybe [MetricDimension]))
-> Maybe [MetricDimension] -> Parser (Maybe [MetricDimension])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricDimension]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Unit
-> Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
-> Parser (Maybe Unit)
-> Parser
(Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Unit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Unit")
Parser
(Maybe Statistic
-> ComparisonOperator
-> Text
-> Int
-> Double
-> CloudWatchAlarmDefinition)
-> Parser (Maybe Statistic)
-> Parser
(ComparisonOperator
-> Text -> Int -> Double -> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Statistic)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Statistic")
Parser
(ComparisonOperator
-> Text -> Int -> Double -> CloudWatchAlarmDefinition)
-> Parser ComparisonOperator
-> Parser (Text -> Int -> Double -> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ComparisonOperator
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ComparisonOperator")
Parser (Text -> Int -> Double -> CloudWatchAlarmDefinition)
-> Parser Text
-> Parser (Int -> Double -> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MetricName")
Parser (Int -> Double -> CloudWatchAlarmDefinition)
-> Parser Int -> Parser (Double -> CloudWatchAlarmDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Period")
Parser (Double -> CloudWatchAlarmDefinition)
-> Parser Double -> Parser CloudWatchAlarmDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Threshold")
)
instance Prelude.Hashable CloudWatchAlarmDefinition
instance Prelude.NFData CloudWatchAlarmDefinition
instance Core.ToJSON CloudWatchAlarmDefinition where
toJSON :: CloudWatchAlarmDefinition -> Value
toJSON CloudWatchAlarmDefinition' {Double
Int
Maybe Int
Maybe [MetricDimension]
Maybe Text
Maybe Statistic
Maybe Unit
Text
ComparisonOperator
threshold :: Double
period :: Int
metricName :: Text
comparisonOperator :: ComparisonOperator
statistic :: Maybe Statistic
unit :: Maybe Unit
dimensions :: Maybe [MetricDimension]
namespace :: Maybe Text
evaluationPeriods :: Maybe Int
$sel:threshold:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Double
$sel:period:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Int
$sel:metricName:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Text
$sel:comparisonOperator:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> ComparisonOperator
$sel:statistic:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Statistic
$sel:unit:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Unit
$sel:dimensions:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe [MetricDimension]
$sel:namespace:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Text
$sel:evaluationPeriods:CloudWatchAlarmDefinition' :: CloudWatchAlarmDefinition -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EvaluationPeriods" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
evaluationPeriods,
(Text
"Namespace" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
namespace,
(Text
"Dimensions" Text -> [MetricDimension] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([MetricDimension] -> Pair)
-> Maybe [MetricDimension] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetricDimension]
dimensions,
(Text
"Unit" Text -> Unit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Unit -> Pair) -> Maybe Unit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Unit
unit,
(Text
"Statistic" Text -> Statistic -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Statistic -> Pair) -> Maybe Statistic -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Statistic
statistic,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ComparisonOperator" Text -> ComparisonOperator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComparisonOperator
comparisonOperator),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Period" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
period),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Threshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
threshold)
]
)