{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53.Types.CloudWatchAlarmConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53.Types.CloudWatchAlarmConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal
import Amazonka.Route53.Types.ComparisonOperator
import Amazonka.Route53.Types.Dimension
import Amazonka.Route53.Types.Statistic

-- | A complex type that contains information about the CloudWatch alarm that
-- Amazon Route 53 is monitoring for this health check.
--
-- /See:/ 'newCloudWatchAlarmConfiguration' smart constructor.
data CloudWatchAlarmConfiguration = CloudWatchAlarmConfiguration'
  { -- | For the metric that the CloudWatch alarm is associated with, a complex
    -- type that contains information about the dimensions for the metric. For
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
    -- in the /Amazon CloudWatch User Guide/.
    CloudWatchAlarmConfiguration -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | For the metric that the CloudWatch alarm is associated with, the number
    -- of periods that the metric is compared to the threshold.
    CloudWatchAlarmConfiguration -> Natural
evaluationPeriods :: Prelude.Natural,
    -- | For the metric that the CloudWatch alarm is associated with, the value
    -- the metric is compared with.
    CloudWatchAlarmConfiguration -> Double
threshold :: Prelude.Double,
    -- | For the metric that the CloudWatch alarm is associated with, the
    -- arithmetic operation that is used for the comparison.
    CloudWatchAlarmConfiguration -> ComparisonOperator
comparisonOperator :: ComparisonOperator,
    -- | For the metric that the CloudWatch alarm is associated with, the
    -- duration of one evaluation period in seconds.
    CloudWatchAlarmConfiguration -> Natural
period :: Prelude.Natural,
    -- | The name of the CloudWatch metric that the alarm is associated with.
    CloudWatchAlarmConfiguration -> Text
metricName :: Prelude.Text,
    -- | The namespace of the metric that the alarm is associated with. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
    -- in the /Amazon CloudWatch User Guide/.
    CloudWatchAlarmConfiguration -> Text
namespace :: Prelude.Text,
    -- | For the metric that the CloudWatch alarm is associated with, the
    -- statistic that is applied to the metric.
    CloudWatchAlarmConfiguration -> Statistic
statistic :: Statistic
  }
  deriving (CloudWatchAlarmConfiguration
-> CloudWatchAlarmConfiguration -> Bool
(CloudWatchAlarmConfiguration
 -> CloudWatchAlarmConfiguration -> Bool)
-> (CloudWatchAlarmConfiguration
    -> CloudWatchAlarmConfiguration -> Bool)
-> Eq CloudWatchAlarmConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchAlarmConfiguration
-> CloudWatchAlarmConfiguration -> Bool
$c/= :: CloudWatchAlarmConfiguration
-> CloudWatchAlarmConfiguration -> Bool
== :: CloudWatchAlarmConfiguration
-> CloudWatchAlarmConfiguration -> Bool
$c== :: CloudWatchAlarmConfiguration
-> CloudWatchAlarmConfiguration -> Bool
Prelude.Eq, ReadPrec [CloudWatchAlarmConfiguration]
ReadPrec CloudWatchAlarmConfiguration
Int -> ReadS CloudWatchAlarmConfiguration
ReadS [CloudWatchAlarmConfiguration]
(Int -> ReadS CloudWatchAlarmConfiguration)
-> ReadS [CloudWatchAlarmConfiguration]
-> ReadPrec CloudWatchAlarmConfiguration
-> ReadPrec [CloudWatchAlarmConfiguration]
-> Read CloudWatchAlarmConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchAlarmConfiguration]
$creadListPrec :: ReadPrec [CloudWatchAlarmConfiguration]
readPrec :: ReadPrec CloudWatchAlarmConfiguration
$creadPrec :: ReadPrec CloudWatchAlarmConfiguration
readList :: ReadS [CloudWatchAlarmConfiguration]
$creadList :: ReadS [CloudWatchAlarmConfiguration]
readsPrec :: Int -> ReadS CloudWatchAlarmConfiguration
$creadsPrec :: Int -> ReadS CloudWatchAlarmConfiguration
Prelude.Read, Int -> CloudWatchAlarmConfiguration -> ShowS
[CloudWatchAlarmConfiguration] -> ShowS
CloudWatchAlarmConfiguration -> String
(Int -> CloudWatchAlarmConfiguration -> ShowS)
-> (CloudWatchAlarmConfiguration -> String)
-> ([CloudWatchAlarmConfiguration] -> ShowS)
-> Show CloudWatchAlarmConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchAlarmConfiguration] -> ShowS
$cshowList :: [CloudWatchAlarmConfiguration] -> ShowS
show :: CloudWatchAlarmConfiguration -> String
$cshow :: CloudWatchAlarmConfiguration -> String
showsPrec :: Int -> CloudWatchAlarmConfiguration -> ShowS
$cshowsPrec :: Int -> CloudWatchAlarmConfiguration -> ShowS
Prelude.Show, (forall x.
 CloudWatchAlarmConfiguration -> Rep CloudWatchAlarmConfiguration x)
-> (forall x.
    Rep CloudWatchAlarmConfiguration x -> CloudWatchAlarmConfiguration)
-> Generic CloudWatchAlarmConfiguration
forall x.
Rep CloudWatchAlarmConfiguration x -> CloudWatchAlarmConfiguration
forall x.
CloudWatchAlarmConfiguration -> Rep CloudWatchAlarmConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchAlarmConfiguration x -> CloudWatchAlarmConfiguration
$cfrom :: forall x.
CloudWatchAlarmConfiguration -> Rep CloudWatchAlarmConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchAlarmConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'dimensions', 'cloudWatchAlarmConfiguration_dimensions' - For the metric that the CloudWatch alarm is associated with, a complex
-- type that contains information about the dimensions for the metric. For
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
-- in the /Amazon CloudWatch User Guide/.
--
-- 'evaluationPeriods', 'cloudWatchAlarmConfiguration_evaluationPeriods' - For the metric that the CloudWatch alarm is associated with, the number
-- of periods that the metric is compared to the threshold.
--
-- 'threshold', 'cloudWatchAlarmConfiguration_threshold' - For the metric that the CloudWatch alarm is associated with, the value
-- the metric is compared with.
--
-- 'comparisonOperator', 'cloudWatchAlarmConfiguration_comparisonOperator' - For the metric that the CloudWatch alarm is associated with, the
-- arithmetic operation that is used for the comparison.
--
-- 'period', 'cloudWatchAlarmConfiguration_period' - For the metric that the CloudWatch alarm is associated with, the
-- duration of one evaluation period in seconds.
--
-- 'metricName', 'cloudWatchAlarmConfiguration_metricName' - The name of the CloudWatch metric that the alarm is associated with.
--
-- 'namespace', 'cloudWatchAlarmConfiguration_namespace' - The namespace of the metric that the alarm is associated with. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
-- in the /Amazon CloudWatch User Guide/.
--
-- 'statistic', 'cloudWatchAlarmConfiguration_statistic' - For the metric that the CloudWatch alarm is associated with, the
-- statistic that is applied to the metric.
newCloudWatchAlarmConfiguration ::
  -- | 'evaluationPeriods'
  Prelude.Natural ->
  -- | 'threshold'
  Prelude.Double ->
  -- | 'comparisonOperator'
  ComparisonOperator ->
  -- | 'period'
  Prelude.Natural ->
  -- | 'metricName'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  -- | 'statistic'
  Statistic ->
  CloudWatchAlarmConfiguration
newCloudWatchAlarmConfiguration :: Natural
-> Double
-> ComparisonOperator
-> Natural
-> Text
-> Text
-> Statistic
-> CloudWatchAlarmConfiguration
newCloudWatchAlarmConfiguration
  Natural
pEvaluationPeriods_
  Double
pThreshold_
  ComparisonOperator
pComparisonOperator_
  Natural
pPeriod_
  Text
pMetricName_
  Text
pNamespace_
  Statistic
pStatistic_ =
    CloudWatchAlarmConfiguration' :: Maybe [Dimension]
-> Natural
-> Double
-> ComparisonOperator
-> Natural
-> Text
-> Text
-> Statistic
-> CloudWatchAlarmConfiguration
CloudWatchAlarmConfiguration'
      { $sel:dimensions:CloudWatchAlarmConfiguration' :: Maybe [Dimension]
dimensions =
          Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
        $sel:evaluationPeriods:CloudWatchAlarmConfiguration' :: Natural
evaluationPeriods = Natural
pEvaluationPeriods_,
        $sel:threshold:CloudWatchAlarmConfiguration' :: Double
threshold = Double
pThreshold_,
        $sel:comparisonOperator:CloudWatchAlarmConfiguration' :: ComparisonOperator
comparisonOperator = ComparisonOperator
pComparisonOperator_,
        $sel:period:CloudWatchAlarmConfiguration' :: Natural
period = Natural
pPeriod_,
        $sel:metricName:CloudWatchAlarmConfiguration' :: Text
metricName = Text
pMetricName_,
        $sel:namespace:CloudWatchAlarmConfiguration' :: Text
namespace = Text
pNamespace_,
        $sel:statistic:CloudWatchAlarmConfiguration' :: Statistic
statistic = Statistic
pStatistic_
      }

-- | For the metric that the CloudWatch alarm is associated with, a complex
-- type that contains information about the dimensions for the metric. For
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
-- in the /Amazon CloudWatch User Guide/.
cloudWatchAlarmConfiguration_dimensions :: Lens.Lens' CloudWatchAlarmConfiguration (Prelude.Maybe [Dimension])
cloudWatchAlarmConfiguration_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_dimensions = (CloudWatchAlarmConfiguration -> Maybe [Dimension])
-> (CloudWatchAlarmConfiguration
    -> Maybe [Dimension] -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     (Maybe [Dimension])
     (Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Maybe [Dimension]
a -> CloudWatchAlarmConfiguration
s {$sel:dimensions:CloudWatchAlarmConfiguration' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: CloudWatchAlarmConfiguration) ((Maybe [Dimension] -> f (Maybe [Dimension]))
 -> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
    -> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> CloudWatchAlarmConfiguration
-> f CloudWatchAlarmConfiguration
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

-- | For the metric that the CloudWatch alarm is associated with, the number
-- of periods that the metric is compared to the threshold.
cloudWatchAlarmConfiguration_evaluationPeriods :: Lens.Lens' CloudWatchAlarmConfiguration Prelude.Natural
cloudWatchAlarmConfiguration_evaluationPeriods :: (Natural -> f Natural)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_evaluationPeriods = (CloudWatchAlarmConfiguration -> Natural)
-> (CloudWatchAlarmConfiguration
    -> Natural -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Natural
evaluationPeriods :: Natural
$sel:evaluationPeriods:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Natural
evaluationPeriods} -> Natural
evaluationPeriods) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Natural
a -> CloudWatchAlarmConfiguration
s {$sel:evaluationPeriods:CloudWatchAlarmConfiguration' :: Natural
evaluationPeriods = Natural
a} :: CloudWatchAlarmConfiguration)

-- | For the metric that the CloudWatch alarm is associated with, the value
-- the metric is compared with.
cloudWatchAlarmConfiguration_threshold :: Lens.Lens' CloudWatchAlarmConfiguration Prelude.Double
cloudWatchAlarmConfiguration_threshold :: (Double -> f Double)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_threshold = (CloudWatchAlarmConfiguration -> Double)
-> (CloudWatchAlarmConfiguration
    -> Double -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     Double
     Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Double
threshold :: Double
$sel:threshold:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Double
threshold} -> Double
threshold) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Double
a -> CloudWatchAlarmConfiguration
s {$sel:threshold:CloudWatchAlarmConfiguration' :: Double
threshold = Double
a} :: CloudWatchAlarmConfiguration)

-- | For the metric that the CloudWatch alarm is associated with, the
-- arithmetic operation that is used for the comparison.
cloudWatchAlarmConfiguration_comparisonOperator :: Lens.Lens' CloudWatchAlarmConfiguration ComparisonOperator
cloudWatchAlarmConfiguration_comparisonOperator :: (ComparisonOperator -> f ComparisonOperator)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_comparisonOperator = (CloudWatchAlarmConfiguration -> ComparisonOperator)
-> (CloudWatchAlarmConfiguration
    -> ComparisonOperator -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     ComparisonOperator
     ComparisonOperator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {ComparisonOperator
comparisonOperator :: ComparisonOperator
$sel:comparisonOperator:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> ComparisonOperator
comparisonOperator} -> ComparisonOperator
comparisonOperator) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} ComparisonOperator
a -> CloudWatchAlarmConfiguration
s {$sel:comparisonOperator:CloudWatchAlarmConfiguration' :: ComparisonOperator
comparisonOperator = ComparisonOperator
a} :: CloudWatchAlarmConfiguration)

-- | For the metric that the CloudWatch alarm is associated with, the
-- duration of one evaluation period in seconds.
cloudWatchAlarmConfiguration_period :: Lens.Lens' CloudWatchAlarmConfiguration Prelude.Natural
cloudWatchAlarmConfiguration_period :: (Natural -> f Natural)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_period = (CloudWatchAlarmConfiguration -> Natural)
-> (CloudWatchAlarmConfiguration
    -> Natural -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Natural
period :: Natural
$sel:period:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Natural
period} -> Natural
period) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Natural
a -> CloudWatchAlarmConfiguration
s {$sel:period:CloudWatchAlarmConfiguration' :: Natural
period = Natural
a} :: CloudWatchAlarmConfiguration)

-- | The name of the CloudWatch metric that the alarm is associated with.
cloudWatchAlarmConfiguration_metricName :: Lens.Lens' CloudWatchAlarmConfiguration Prelude.Text
cloudWatchAlarmConfiguration_metricName :: (Text -> f Text)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_metricName = (CloudWatchAlarmConfiguration -> Text)
-> (CloudWatchAlarmConfiguration
    -> Text -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration CloudWatchAlarmConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Text
metricName :: Text
$sel:metricName:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Text
metricName} -> Text
metricName) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Text
a -> CloudWatchAlarmConfiguration
s {$sel:metricName:CloudWatchAlarmConfiguration' :: Text
metricName = Text
a} :: CloudWatchAlarmConfiguration)

-- | The namespace of the metric that the alarm is associated with. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference>
-- in the /Amazon CloudWatch User Guide/.
cloudWatchAlarmConfiguration_namespace :: Lens.Lens' CloudWatchAlarmConfiguration Prelude.Text
cloudWatchAlarmConfiguration_namespace :: (Text -> f Text)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_namespace = (CloudWatchAlarmConfiguration -> Text)
-> (CloudWatchAlarmConfiguration
    -> Text -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration CloudWatchAlarmConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Text
namespace :: Text
$sel:namespace:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Text
namespace} -> Text
namespace) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Text
a -> CloudWatchAlarmConfiguration
s {$sel:namespace:CloudWatchAlarmConfiguration' :: Text
namespace = Text
a} :: CloudWatchAlarmConfiguration)

-- | For the metric that the CloudWatch alarm is associated with, the
-- statistic that is applied to the metric.
cloudWatchAlarmConfiguration_statistic :: Lens.Lens' CloudWatchAlarmConfiguration Statistic
cloudWatchAlarmConfiguration_statistic :: (Statistic -> f Statistic)
-> CloudWatchAlarmConfiguration -> f CloudWatchAlarmConfiguration
cloudWatchAlarmConfiguration_statistic = (CloudWatchAlarmConfiguration -> Statistic)
-> (CloudWatchAlarmConfiguration
    -> Statistic -> CloudWatchAlarmConfiguration)
-> Lens
     CloudWatchAlarmConfiguration
     CloudWatchAlarmConfiguration
     Statistic
     Statistic
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchAlarmConfiguration' {Statistic
statistic :: Statistic
$sel:statistic:CloudWatchAlarmConfiguration' :: CloudWatchAlarmConfiguration -> Statistic
statistic} -> Statistic
statistic) (\s :: CloudWatchAlarmConfiguration
s@CloudWatchAlarmConfiguration' {} Statistic
a -> CloudWatchAlarmConfiguration
s {$sel:statistic:CloudWatchAlarmConfiguration' :: Statistic
statistic = Statistic
a} :: CloudWatchAlarmConfiguration)

instance Core.FromXML CloudWatchAlarmConfiguration where
  parseXML :: [Node] -> Either String CloudWatchAlarmConfiguration
parseXML [Node]
x =
    Maybe [Dimension]
-> Natural
-> Double
-> ComparisonOperator
-> Natural
-> Text
-> Text
-> Statistic
-> CloudWatchAlarmConfiguration
CloudWatchAlarmConfiguration'
      (Maybe [Dimension]
 -> Natural
 -> Double
 -> ComparisonOperator
 -> Natural
 -> Text
 -> Text
 -> Statistic
 -> CloudWatchAlarmConfiguration)
-> Either String (Maybe [Dimension])
-> Either
     String
     (Natural
      -> Double
      -> ComparisonOperator
      -> Natural
      -> Text
      -> Text
      -> Statistic
      -> CloudWatchAlarmConfiguration)
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
"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
"Dimension")
                  )
      Either
  String
  (Natural
   -> Double
   -> ComparisonOperator
   -> Natural
   -> Text
   -> Text
   -> Statistic
   -> CloudWatchAlarmConfiguration)
-> Either String Natural
-> Either
     String
     (Double
      -> ComparisonOperator
      -> Natural
      -> Text
      -> Text
      -> Statistic
      -> CloudWatchAlarmConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EvaluationPeriods")
      Either
  String
  (Double
   -> ComparisonOperator
   -> Natural
   -> Text
   -> Text
   -> Statistic
   -> CloudWatchAlarmConfiguration)
-> Either String Double
-> Either
     String
     (ComparisonOperator
      -> Natural
      -> Text
      -> Text
      -> Statistic
      -> CloudWatchAlarmConfiguration)
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
"Threshold")
      Either
  String
  (ComparisonOperator
   -> Natural
   -> Text
   -> Text
   -> Statistic
   -> CloudWatchAlarmConfiguration)
-> Either String ComparisonOperator
-> Either
     String
     (Natural
      -> Text -> Text -> Statistic -> CloudWatchAlarmConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ComparisonOperator
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ComparisonOperator")
      Either
  String
  (Natural
   -> Text -> Text -> Statistic -> CloudWatchAlarmConfiguration)
-> Either String Natural
-> Either
     String (Text -> Text -> Statistic -> CloudWatchAlarmConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Period")
      Either
  String (Text -> Text -> Statistic -> CloudWatchAlarmConfiguration)
-> Either String Text
-> Either
     String (Text -> Statistic -> CloudWatchAlarmConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MetricName")
      Either String (Text -> Statistic -> CloudWatchAlarmConfiguration)
-> Either String Text
-> Either String (Statistic -> CloudWatchAlarmConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Namespace")
      Either String (Statistic -> CloudWatchAlarmConfiguration)
-> Either String Statistic
-> Either String CloudWatchAlarmConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Statistic
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Statistic")

instance
  Prelude.Hashable
    CloudWatchAlarmConfiguration

instance Prelude.NFData CloudWatchAlarmConfiguration