{-# 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.Lightsail.Types.Alarm
-- 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.Lightsail.Types.Alarm where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AlarmState
import Amazonka.Lightsail.Types.ComparisonOperator
import Amazonka.Lightsail.Types.ContactProtocol
import Amazonka.Lightsail.Types.MetricName
import Amazonka.Lightsail.Types.MetricStatistic
import Amazonka.Lightsail.Types.MetricUnit
import Amazonka.Lightsail.Types.MonitoredResourceInfo
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceType
import Amazonka.Lightsail.Types.TreatMissingData
import qualified Amazonka.Prelude as Prelude

-- | Describes an alarm.
--
-- An alarm is a way to monitor your Lightsail resource metrics. For more
-- information, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-alarms Alarms in Amazon Lightsail>.
--
-- /See:/ 'newAlarm' smart constructor.
data Alarm = Alarm'
  { -- | The current state of the alarm.
    --
    -- An alarm has the following possible states:
    --
    -- -   @ALARM@ - The metric is outside of the defined threshold.
    --
    -- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
    --     available, or not enough data is available for the metric to
    --     determine the alarm state.
    --
    -- -   @OK@ - The metric is within the defined threshold.
    Alarm -> Maybe AlarmState
state :: Prelude.Maybe AlarmState,
    -- | Specifies how the alarm handles missing data points.
    --
    -- An alarm can treat missing data in the following ways:
    --
    -- -   @breaching@ - Assume the missing data is not within the threshold.
    --     Missing data counts towards the number of times the metric is not
    --     within the threshold.
    --
    -- -   @notBreaching@ - Assume the missing data is within the threshold.
    --     Missing data does not count towards the number of times the metric
    --     is not within the threshold.
    --
    -- -   @ignore@ - Ignore the missing data. Maintains the current alarm
    --     state.
    --
    -- -   @missing@ - Missing data is treated as missing.
    Alarm -> Maybe TreatMissingData
treatMissingData :: Prelude.Maybe TreatMissingData,
    -- | The Lightsail resource type (e.g., @Alarm@).
    Alarm -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The Amazon Resource Name (ARN) of the alarm.
    Alarm -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the alarm was created.
    Alarm -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | An object that lists information about the location of the alarm.
    Alarm -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | The contact protocols for the alarm, such as @Email@, @SMS@ (text
    -- messaging), or both.
    Alarm -> Maybe [ContactProtocol]
contactProtocols :: Prelude.Maybe [ContactProtocol],
    -- | The period, in seconds, over which the statistic is applied.
    Alarm -> Maybe Natural
period :: Prelude.Maybe Prelude.Natural,
    -- | The number of periods over which data is compared to the specified
    -- threshold.
    Alarm -> Maybe Int
evaluationPeriods :: Prelude.Maybe Prelude.Int,
    -- | The name of the metric associated with the alarm.
    Alarm -> Maybe MetricName
metricName :: Prelude.Maybe MetricName,
    -- | The arithmetic operation used when comparing the specified statistic and
    -- threshold.
    Alarm -> Maybe ComparisonOperator
comparisonOperator :: Prelude.Maybe ComparisonOperator,
    -- | The name of the alarm.
    Alarm -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The value against which the specified statistic is compared.
    Alarm -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | The number of data points that must not within the specified threshold
    -- to trigger the alarm.
    Alarm -> Maybe Int
datapointsToAlarm :: Prelude.Maybe Prelude.Int,
    -- | The support code. Include this code in your email to support when you
    -- have questions about your Lightsail alarm. This code enables our support
    -- team to look up your Lightsail information more easily.
    Alarm -> Maybe Text
supportCode :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the alarm is enabled.
    Alarm -> Maybe Bool
notificationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The alarm states that trigger a notification.
    Alarm -> Maybe [AlarmState]
notificationTriggers :: Prelude.Maybe [AlarmState],
    -- | The statistic for the metric associated with the alarm.
    --
    -- The following statistics are available:
    --
    -- -   @Minimum@ - The lowest value observed during the specified period.
    --     Use this value to determine low volumes of activity for your
    --     application.
    --
    -- -   @Maximum@ - The highest value observed during the specified period.
    --     Use this value to determine high volumes of activity for your
    --     application.
    --
    -- -   @Sum@ - All values submitted for the matching metric added together.
    --     You can use this statistic to determine the total volume of a
    --     metric.
    --
    -- -   @Average@ - The value of Sum \/ SampleCount during the specified
    --     period. By comparing this statistic with the Minimum and Maximum
    --     values, you can determine the full scope of a metric and how close
    --     the average use is to the Minimum and Maximum values. This
    --     comparison helps you to know when to increase or decrease your
    --     resources.
    --
    -- -   @SampleCount@ - The count, or number, of data points used for the
    --     statistical calculation.
    Alarm -> Maybe MetricStatistic
statistic :: Prelude.Maybe MetricStatistic,
    -- | The unit of the metric associated with the alarm.
    Alarm -> Maybe MetricUnit
unit :: Prelude.Maybe MetricUnit,
    -- | An object that lists information about the resource monitored by the
    -- alarm.
    Alarm -> Maybe MonitoredResourceInfo
monitoredResourceInfo :: Prelude.Maybe MonitoredResourceInfo
  }
  deriving (Alarm -> Alarm -> Bool
(Alarm -> Alarm -> Bool) -> (Alarm -> Alarm -> Bool) -> Eq Alarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Alarm -> Alarm -> Bool
$c/= :: Alarm -> Alarm -> Bool
== :: Alarm -> Alarm -> Bool
$c== :: Alarm -> Alarm -> Bool
Prelude.Eq, ReadPrec [Alarm]
ReadPrec Alarm
Int -> ReadS Alarm
ReadS [Alarm]
(Int -> ReadS Alarm)
-> ReadS [Alarm]
-> ReadPrec Alarm
-> ReadPrec [Alarm]
-> Read Alarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Alarm]
$creadListPrec :: ReadPrec [Alarm]
readPrec :: ReadPrec Alarm
$creadPrec :: ReadPrec Alarm
readList :: ReadS [Alarm]
$creadList :: ReadS [Alarm]
readsPrec :: Int -> ReadS Alarm
$creadsPrec :: Int -> ReadS Alarm
Prelude.Read, Int -> Alarm -> ShowS
[Alarm] -> ShowS
Alarm -> String
(Int -> Alarm -> ShowS)
-> (Alarm -> String) -> ([Alarm] -> ShowS) -> Show Alarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Alarm] -> ShowS
$cshowList :: [Alarm] -> ShowS
show :: Alarm -> String
$cshow :: Alarm -> String
showsPrec :: Int -> Alarm -> ShowS
$cshowsPrec :: Int -> Alarm -> ShowS
Prelude.Show, (forall x. Alarm -> Rep Alarm x)
-> (forall x. Rep Alarm x -> Alarm) -> Generic Alarm
forall x. Rep Alarm x -> Alarm
forall x. Alarm -> Rep Alarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Alarm x -> Alarm
$cfrom :: forall x. Alarm -> Rep Alarm x
Prelude.Generic)

-- |
-- Create a value of 'Alarm' 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:
--
-- 'state', 'alarm_state' - The current state of the alarm.
--
-- An alarm has the following possible states:
--
-- -   @ALARM@ - The metric is outside of the defined threshold.
--
-- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
--     available, or not enough data is available for the metric to
--     determine the alarm state.
--
-- -   @OK@ - The metric is within the defined threshold.
--
-- 'treatMissingData', 'alarm_treatMissingData' - Specifies how the alarm handles missing data points.
--
-- An alarm can treat missing data in the following ways:
--
-- -   @breaching@ - Assume the missing data is not within the threshold.
--     Missing data counts towards the number of times the metric is not
--     within the threshold.
--
-- -   @notBreaching@ - Assume the missing data is within the threshold.
--     Missing data does not count towards the number of times the metric
--     is not within the threshold.
--
-- -   @ignore@ - Ignore the missing data. Maintains the current alarm
--     state.
--
-- -   @missing@ - Missing data is treated as missing.
--
-- 'resourceType', 'alarm_resourceType' - The Lightsail resource type (e.g., @Alarm@).
--
-- 'arn', 'alarm_arn' - The Amazon Resource Name (ARN) of the alarm.
--
-- 'createdAt', 'alarm_createdAt' - The timestamp when the alarm was created.
--
-- 'location', 'alarm_location' - An object that lists information about the location of the alarm.
--
-- 'contactProtocols', 'alarm_contactProtocols' - The contact protocols for the alarm, such as @Email@, @SMS@ (text
-- messaging), or both.
--
-- 'period', 'alarm_period' - The period, in seconds, over which the statistic is applied.
--
-- 'evaluationPeriods', 'alarm_evaluationPeriods' - The number of periods over which data is compared to the specified
-- threshold.
--
-- 'metricName', 'alarm_metricName' - The name of the metric associated with the alarm.
--
-- 'comparisonOperator', 'alarm_comparisonOperator' - The arithmetic operation used when comparing the specified statistic and
-- threshold.
--
-- 'name', 'alarm_name' - The name of the alarm.
--
-- 'threshold', 'alarm_threshold' - The value against which the specified statistic is compared.
--
-- 'datapointsToAlarm', 'alarm_datapointsToAlarm' - The number of data points that must not within the specified threshold
-- to trigger the alarm.
--
-- 'supportCode', 'alarm_supportCode' - The support code. Include this code in your email to support when you
-- have questions about your Lightsail alarm. This code enables our support
-- team to look up your Lightsail information more easily.
--
-- 'notificationEnabled', 'alarm_notificationEnabled' - Indicates whether the alarm is enabled.
--
-- 'notificationTriggers', 'alarm_notificationTriggers' - The alarm states that trigger a notification.
--
-- 'statistic', 'alarm_statistic' - The statistic for the metric associated with the alarm.
--
-- The following statistics are available:
--
-- -   @Minimum@ - The lowest value observed during the specified period.
--     Use this value to determine low volumes of activity for your
--     application.
--
-- -   @Maximum@ - The highest value observed during the specified period.
--     Use this value to determine high volumes of activity for your
--     application.
--
-- -   @Sum@ - All values submitted for the matching metric added together.
--     You can use this statistic to determine the total volume of a
--     metric.
--
-- -   @Average@ - The value of Sum \/ SampleCount during the specified
--     period. By comparing this statistic with the Minimum and Maximum
--     values, you can determine the full scope of a metric and how close
--     the average use is to the Minimum and Maximum values. This
--     comparison helps you to know when to increase or decrease your
--     resources.
--
-- -   @SampleCount@ - The count, or number, of data points used for the
--     statistical calculation.
--
-- 'unit', 'alarm_unit' - The unit of the metric associated with the alarm.
--
-- 'monitoredResourceInfo', 'alarm_monitoredResourceInfo' - An object that lists information about the resource monitored by the
-- alarm.
newAlarm ::
  Alarm
newAlarm :: Alarm
newAlarm =
  Alarm' :: Maybe AlarmState
-> Maybe TreatMissingData
-> Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe [ContactProtocol]
-> Maybe Natural
-> Maybe Int
-> Maybe MetricName
-> Maybe ComparisonOperator
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe [AlarmState]
-> Maybe MetricStatistic
-> Maybe MetricUnit
-> Maybe MonitoredResourceInfo
-> Alarm
Alarm'
    { $sel:state:Alarm' :: Maybe AlarmState
state = Maybe AlarmState
forall a. Maybe a
Prelude.Nothing,
      $sel:treatMissingData:Alarm' :: Maybe TreatMissingData
treatMissingData = Maybe TreatMissingData
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Alarm' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Alarm' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Alarm' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:location:Alarm' :: Maybe ResourceLocation
location = Maybe ResourceLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:contactProtocols:Alarm' :: Maybe [ContactProtocol]
contactProtocols = Maybe [ContactProtocol]
forall a. Maybe a
Prelude.Nothing,
      $sel:period:Alarm' :: Maybe Natural
period = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationPeriods:Alarm' :: Maybe Int
evaluationPeriods = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:Alarm' :: Maybe MetricName
metricName = Maybe MetricName
forall a. Maybe a
Prelude.Nothing,
      $sel:comparisonOperator:Alarm' :: Maybe ComparisonOperator
comparisonOperator = Maybe ComparisonOperator
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Alarm' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:Alarm' :: Maybe Double
threshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:datapointsToAlarm:Alarm' :: Maybe Int
datapointsToAlarm = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:supportCode:Alarm' :: Maybe Text
supportCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationEnabled:Alarm' :: Maybe Bool
notificationEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationTriggers:Alarm' :: Maybe [AlarmState]
notificationTriggers = Maybe [AlarmState]
forall a. Maybe a
Prelude.Nothing,
      $sel:statistic:Alarm' :: Maybe MetricStatistic
statistic = Maybe MetricStatistic
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:Alarm' :: Maybe MetricUnit
unit = Maybe MetricUnit
forall a. Maybe a
Prelude.Nothing,
      $sel:monitoredResourceInfo:Alarm' :: Maybe MonitoredResourceInfo
monitoredResourceInfo = Maybe MonitoredResourceInfo
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the alarm.
--
-- An alarm has the following possible states:
--
-- -   @ALARM@ - The metric is outside of the defined threshold.
--
-- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
--     available, or not enough data is available for the metric to
--     determine the alarm state.
--
-- -   @OK@ - The metric is within the defined threshold.
alarm_state :: Lens.Lens' Alarm (Prelude.Maybe AlarmState)
alarm_state :: (Maybe AlarmState -> f (Maybe AlarmState)) -> Alarm -> f Alarm
alarm_state = (Alarm -> Maybe AlarmState)
-> (Alarm -> Maybe AlarmState -> Alarm)
-> Lens Alarm Alarm (Maybe AlarmState) (Maybe AlarmState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe AlarmState
state :: Maybe AlarmState
$sel:state:Alarm' :: Alarm -> Maybe AlarmState
state} -> Maybe AlarmState
state) (\s :: Alarm
s@Alarm' {} Maybe AlarmState
a -> Alarm
s {$sel:state:Alarm' :: Maybe AlarmState
state = Maybe AlarmState
a} :: Alarm)

-- | Specifies how the alarm handles missing data points.
--
-- An alarm can treat missing data in the following ways:
--
-- -   @breaching@ - Assume the missing data is not within the threshold.
--     Missing data counts towards the number of times the metric is not
--     within the threshold.
--
-- -   @notBreaching@ - Assume the missing data is within the threshold.
--     Missing data does not count towards the number of times the metric
--     is not within the threshold.
--
-- -   @ignore@ - Ignore the missing data. Maintains the current alarm
--     state.
--
-- -   @missing@ - Missing data is treated as missing.
alarm_treatMissingData :: Lens.Lens' Alarm (Prelude.Maybe TreatMissingData)
alarm_treatMissingData :: (Maybe TreatMissingData -> f (Maybe TreatMissingData))
-> Alarm -> f Alarm
alarm_treatMissingData = (Alarm -> Maybe TreatMissingData)
-> (Alarm -> Maybe TreatMissingData -> Alarm)
-> Lens
     Alarm Alarm (Maybe TreatMissingData) (Maybe TreatMissingData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe TreatMissingData
treatMissingData :: Maybe TreatMissingData
$sel:treatMissingData:Alarm' :: Alarm -> Maybe TreatMissingData
treatMissingData} -> Maybe TreatMissingData
treatMissingData) (\s :: Alarm
s@Alarm' {} Maybe TreatMissingData
a -> Alarm
s {$sel:treatMissingData:Alarm' :: Maybe TreatMissingData
treatMissingData = Maybe TreatMissingData
a} :: Alarm)

-- | The Lightsail resource type (e.g., @Alarm@).
alarm_resourceType :: Lens.Lens' Alarm (Prelude.Maybe ResourceType)
alarm_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType)) -> Alarm -> f Alarm
alarm_resourceType = (Alarm -> Maybe ResourceType)
-> (Alarm -> Maybe ResourceType -> Alarm)
-> Lens Alarm Alarm (Maybe ResourceType) (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:Alarm' :: Alarm -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: Alarm
s@Alarm' {} Maybe ResourceType
a -> Alarm
s {$sel:resourceType:Alarm' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: Alarm)

-- | The Amazon Resource Name (ARN) of the alarm.
alarm_arn :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_arn :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_arn = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
arn :: Maybe Text
$sel:arn:Alarm' :: Alarm -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:arn:Alarm' :: Maybe Text
arn = Maybe Text
a} :: Alarm)

-- | The timestamp when the alarm was created.
alarm_createdAt :: Lens.Lens' Alarm (Prelude.Maybe Prelude.UTCTime)
alarm_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alarm -> f Alarm
alarm_createdAt = (Alarm -> Maybe POSIX)
-> (Alarm -> Maybe POSIX -> Alarm)
-> Lens Alarm Alarm (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Alarm' :: Alarm -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Alarm
s@Alarm' {} Maybe POSIX
a -> Alarm
s {$sel:createdAt:Alarm' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Alarm) ((Maybe POSIX -> f (Maybe POSIX)) -> Alarm -> f Alarm)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alarm
-> f Alarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An object that lists information about the location of the alarm.
alarm_location :: Lens.Lens' Alarm (Prelude.Maybe ResourceLocation)
alarm_location :: (Maybe ResourceLocation -> f (Maybe ResourceLocation))
-> Alarm -> f Alarm
alarm_location = (Alarm -> Maybe ResourceLocation)
-> (Alarm -> Maybe ResourceLocation -> Alarm)
-> Lens
     Alarm Alarm (Maybe ResourceLocation) (Maybe ResourceLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:Alarm' :: Alarm -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: Alarm
s@Alarm' {} Maybe ResourceLocation
a -> Alarm
s {$sel:location:Alarm' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: Alarm)

-- | The contact protocols for the alarm, such as @Email@, @SMS@ (text
-- messaging), or both.
alarm_contactProtocols :: Lens.Lens' Alarm (Prelude.Maybe [ContactProtocol])
alarm_contactProtocols :: (Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> Alarm -> f Alarm
alarm_contactProtocols = (Alarm -> Maybe [ContactProtocol])
-> (Alarm -> Maybe [ContactProtocol] -> Alarm)
-> Lens
     Alarm Alarm (Maybe [ContactProtocol]) (Maybe [ContactProtocol])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe [ContactProtocol]
contactProtocols :: Maybe [ContactProtocol]
$sel:contactProtocols:Alarm' :: Alarm -> Maybe [ContactProtocol]
contactProtocols} -> Maybe [ContactProtocol]
contactProtocols) (\s :: Alarm
s@Alarm' {} Maybe [ContactProtocol]
a -> Alarm
s {$sel:contactProtocols:Alarm' :: Maybe [ContactProtocol]
contactProtocols = Maybe [ContactProtocol]
a} :: Alarm) ((Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
 -> Alarm -> f Alarm)
-> ((Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
    -> Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> (Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> Alarm
-> f Alarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContactProtocol]
  [ContactProtocol]
  [ContactProtocol]
  [ContactProtocol]
-> Iso
     (Maybe [ContactProtocol])
     (Maybe [ContactProtocol])
     (Maybe [ContactProtocol])
     (Maybe [ContactProtocol])
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
  [ContactProtocol]
  [ContactProtocol]
  [ContactProtocol]
  [ContactProtocol]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The period, in seconds, over which the statistic is applied.
alarm_period :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Natural)
alarm_period :: (Maybe Natural -> f (Maybe Natural)) -> Alarm -> f Alarm
alarm_period = (Alarm -> Maybe Natural)
-> (Alarm -> Maybe Natural -> Alarm)
-> Lens Alarm Alarm (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Natural
period :: Maybe Natural
$sel:period:Alarm' :: Alarm -> Maybe Natural
period} -> Maybe Natural
period) (\s :: Alarm
s@Alarm' {} Maybe Natural
a -> Alarm
s {$sel:period:Alarm' :: Maybe Natural
period = Maybe Natural
a} :: Alarm)

-- | The number of periods over which data is compared to the specified
-- threshold.
alarm_evaluationPeriods :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Int)
alarm_evaluationPeriods :: (Maybe Int -> f (Maybe Int)) -> Alarm -> f Alarm
alarm_evaluationPeriods = (Alarm -> Maybe Int)
-> (Alarm -> Maybe Int -> Alarm)
-> Lens Alarm Alarm (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Int
evaluationPeriods :: Maybe Int
$sel:evaluationPeriods:Alarm' :: Alarm -> Maybe Int
evaluationPeriods} -> Maybe Int
evaluationPeriods) (\s :: Alarm
s@Alarm' {} Maybe Int
a -> Alarm
s {$sel:evaluationPeriods:Alarm' :: Maybe Int
evaluationPeriods = Maybe Int
a} :: Alarm)

-- | The name of the metric associated with the alarm.
alarm_metricName :: Lens.Lens' Alarm (Prelude.Maybe MetricName)
alarm_metricName :: (Maybe MetricName -> f (Maybe MetricName)) -> Alarm -> f Alarm
alarm_metricName = (Alarm -> Maybe MetricName)
-> (Alarm -> Maybe MetricName -> Alarm)
-> Lens Alarm Alarm (Maybe MetricName) (Maybe MetricName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe MetricName
metricName :: Maybe MetricName
$sel:metricName:Alarm' :: Alarm -> Maybe MetricName
metricName} -> Maybe MetricName
metricName) (\s :: Alarm
s@Alarm' {} Maybe MetricName
a -> Alarm
s {$sel:metricName:Alarm' :: Maybe MetricName
metricName = Maybe MetricName
a} :: Alarm)

-- | The arithmetic operation used when comparing the specified statistic and
-- threshold.
alarm_comparisonOperator :: Lens.Lens' Alarm (Prelude.Maybe ComparisonOperator)
alarm_comparisonOperator :: (Maybe ComparisonOperator -> f (Maybe ComparisonOperator))
-> Alarm -> f Alarm
alarm_comparisonOperator = (Alarm -> Maybe ComparisonOperator)
-> (Alarm -> Maybe ComparisonOperator -> Alarm)
-> Lens
     Alarm Alarm (Maybe ComparisonOperator) (Maybe ComparisonOperator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe ComparisonOperator
comparisonOperator :: Maybe ComparisonOperator
$sel:comparisonOperator:Alarm' :: Alarm -> Maybe ComparisonOperator
comparisonOperator} -> Maybe ComparisonOperator
comparisonOperator) (\s :: Alarm
s@Alarm' {} Maybe ComparisonOperator
a -> Alarm
s {$sel:comparisonOperator:Alarm' :: Maybe ComparisonOperator
comparisonOperator = Maybe ComparisonOperator
a} :: Alarm)

-- | The name of the alarm.
alarm_name :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_name :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_name = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
name :: Maybe Text
$sel:name:Alarm' :: Alarm -> Maybe Text
name} -> Maybe Text
name) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:name:Alarm' :: Maybe Text
name = Maybe Text
a} :: Alarm)

-- | The value against which the specified statistic is compared.
alarm_threshold :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Double)
alarm_threshold :: (Maybe Double -> f (Maybe Double)) -> Alarm -> f Alarm
alarm_threshold = (Alarm -> Maybe Double)
-> (Alarm -> Maybe Double -> Alarm)
-> Lens Alarm Alarm (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Double
threshold :: Maybe Double
$sel:threshold:Alarm' :: Alarm -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: Alarm
s@Alarm' {} Maybe Double
a -> Alarm
s {$sel:threshold:Alarm' :: Maybe Double
threshold = Maybe Double
a} :: Alarm)

-- | The number of data points that must not within the specified threshold
-- to trigger the alarm.
alarm_datapointsToAlarm :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Int)
alarm_datapointsToAlarm :: (Maybe Int -> f (Maybe Int)) -> Alarm -> f Alarm
alarm_datapointsToAlarm = (Alarm -> Maybe Int)
-> (Alarm -> Maybe Int -> Alarm)
-> Lens Alarm Alarm (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Int
datapointsToAlarm :: Maybe Int
$sel:datapointsToAlarm:Alarm' :: Alarm -> Maybe Int
datapointsToAlarm} -> Maybe Int
datapointsToAlarm) (\s :: Alarm
s@Alarm' {} Maybe Int
a -> Alarm
s {$sel:datapointsToAlarm:Alarm' :: Maybe Int
datapointsToAlarm = Maybe Int
a} :: Alarm)

-- | The support code. Include this code in your email to support when you
-- have questions about your Lightsail alarm. This code enables our support
-- team to look up your Lightsail information more easily.
alarm_supportCode :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_supportCode :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_supportCode = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
supportCode :: Maybe Text
$sel:supportCode:Alarm' :: Alarm -> Maybe Text
supportCode} -> Maybe Text
supportCode) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:supportCode:Alarm' :: Maybe Text
supportCode = Maybe Text
a} :: Alarm)

-- | Indicates whether the alarm is enabled.
alarm_notificationEnabled :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Bool)
alarm_notificationEnabled :: (Maybe Bool -> f (Maybe Bool)) -> Alarm -> f Alarm
alarm_notificationEnabled = (Alarm -> Maybe Bool)
-> (Alarm -> Maybe Bool -> Alarm)
-> Lens Alarm Alarm (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Bool
notificationEnabled :: Maybe Bool
$sel:notificationEnabled:Alarm' :: Alarm -> Maybe Bool
notificationEnabled} -> Maybe Bool
notificationEnabled) (\s :: Alarm
s@Alarm' {} Maybe Bool
a -> Alarm
s {$sel:notificationEnabled:Alarm' :: Maybe Bool
notificationEnabled = Maybe Bool
a} :: Alarm)

-- | The alarm states that trigger a notification.
alarm_notificationTriggers :: Lens.Lens' Alarm (Prelude.Maybe [AlarmState])
alarm_notificationTriggers :: (Maybe [AlarmState] -> f (Maybe [AlarmState])) -> Alarm -> f Alarm
alarm_notificationTriggers = (Alarm -> Maybe [AlarmState])
-> (Alarm -> Maybe [AlarmState] -> Alarm)
-> Lens Alarm Alarm (Maybe [AlarmState]) (Maybe [AlarmState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe [AlarmState]
notificationTriggers :: Maybe [AlarmState]
$sel:notificationTriggers:Alarm' :: Alarm -> Maybe [AlarmState]
notificationTriggers} -> Maybe [AlarmState]
notificationTriggers) (\s :: Alarm
s@Alarm' {} Maybe [AlarmState]
a -> Alarm
s {$sel:notificationTriggers:Alarm' :: Maybe [AlarmState]
notificationTriggers = Maybe [AlarmState]
a} :: Alarm) ((Maybe [AlarmState] -> f (Maybe [AlarmState]))
 -> Alarm -> f Alarm)
-> ((Maybe [AlarmState] -> f (Maybe [AlarmState]))
    -> Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> (Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> Alarm
-> f Alarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AlarmState] [AlarmState] [AlarmState] [AlarmState]
-> Iso
     (Maybe [AlarmState])
     (Maybe [AlarmState])
     (Maybe [AlarmState])
     (Maybe [AlarmState])
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 [AlarmState] [AlarmState] [AlarmState] [AlarmState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The statistic for the metric associated with the alarm.
--
-- The following statistics are available:
--
-- -   @Minimum@ - The lowest value observed during the specified period.
--     Use this value to determine low volumes of activity for your
--     application.
--
-- -   @Maximum@ - The highest value observed during the specified period.
--     Use this value to determine high volumes of activity for your
--     application.
--
-- -   @Sum@ - All values submitted for the matching metric added together.
--     You can use this statistic to determine the total volume of a
--     metric.
--
-- -   @Average@ - The value of Sum \/ SampleCount during the specified
--     period. By comparing this statistic with the Minimum and Maximum
--     values, you can determine the full scope of a metric and how close
--     the average use is to the Minimum and Maximum values. This
--     comparison helps you to know when to increase or decrease your
--     resources.
--
-- -   @SampleCount@ - The count, or number, of data points used for the
--     statistical calculation.
alarm_statistic :: Lens.Lens' Alarm (Prelude.Maybe MetricStatistic)
alarm_statistic :: (Maybe MetricStatistic -> f (Maybe MetricStatistic))
-> Alarm -> f Alarm
alarm_statistic = (Alarm -> Maybe MetricStatistic)
-> (Alarm -> Maybe MetricStatistic -> Alarm)
-> Lens Alarm Alarm (Maybe MetricStatistic) (Maybe MetricStatistic)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe MetricStatistic
statistic :: Maybe MetricStatistic
$sel:statistic:Alarm' :: Alarm -> Maybe MetricStatistic
statistic} -> Maybe MetricStatistic
statistic) (\s :: Alarm
s@Alarm' {} Maybe MetricStatistic
a -> Alarm
s {$sel:statistic:Alarm' :: Maybe MetricStatistic
statistic = Maybe MetricStatistic
a} :: Alarm)

-- | The unit of the metric associated with the alarm.
alarm_unit :: Lens.Lens' Alarm (Prelude.Maybe MetricUnit)
alarm_unit :: (Maybe MetricUnit -> f (Maybe MetricUnit)) -> Alarm -> f Alarm
alarm_unit = (Alarm -> Maybe MetricUnit)
-> (Alarm -> Maybe MetricUnit -> Alarm)
-> Lens Alarm Alarm (Maybe MetricUnit) (Maybe MetricUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe MetricUnit
unit :: Maybe MetricUnit
$sel:unit:Alarm' :: Alarm -> Maybe MetricUnit
unit} -> Maybe MetricUnit
unit) (\s :: Alarm
s@Alarm' {} Maybe MetricUnit
a -> Alarm
s {$sel:unit:Alarm' :: Maybe MetricUnit
unit = Maybe MetricUnit
a} :: Alarm)

-- | An object that lists information about the resource monitored by the
-- alarm.
alarm_monitoredResourceInfo :: Lens.Lens' Alarm (Prelude.Maybe MonitoredResourceInfo)
alarm_monitoredResourceInfo :: (Maybe MonitoredResourceInfo -> f (Maybe MonitoredResourceInfo))
-> Alarm -> f Alarm
alarm_monitoredResourceInfo = (Alarm -> Maybe MonitoredResourceInfo)
-> (Alarm -> Maybe MonitoredResourceInfo -> Alarm)
-> Lens
     Alarm
     Alarm
     (Maybe MonitoredResourceInfo)
     (Maybe MonitoredResourceInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe MonitoredResourceInfo
monitoredResourceInfo :: Maybe MonitoredResourceInfo
$sel:monitoredResourceInfo:Alarm' :: Alarm -> Maybe MonitoredResourceInfo
monitoredResourceInfo} -> Maybe MonitoredResourceInfo
monitoredResourceInfo) (\s :: Alarm
s@Alarm' {} Maybe MonitoredResourceInfo
a -> Alarm
s {$sel:monitoredResourceInfo:Alarm' :: Maybe MonitoredResourceInfo
monitoredResourceInfo = Maybe MonitoredResourceInfo
a} :: Alarm)

instance Core.FromJSON Alarm where
  parseJSON :: Value -> Parser Alarm
parseJSON =
    String -> (Object -> Parser Alarm) -> Value -> Parser Alarm
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Alarm"
      ( \Object
x ->
          Maybe AlarmState
-> Maybe TreatMissingData
-> Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe [ContactProtocol]
-> Maybe Natural
-> Maybe Int
-> Maybe MetricName
-> Maybe ComparisonOperator
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe [AlarmState]
-> Maybe MetricStatistic
-> Maybe MetricUnit
-> Maybe MonitoredResourceInfo
-> Alarm
Alarm'
            (Maybe AlarmState
 -> Maybe TreatMissingData
 -> Maybe ResourceType
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe ResourceLocation
 -> Maybe [ContactProtocol]
 -> Maybe Natural
 -> Maybe Int
 -> Maybe MetricName
 -> Maybe ComparisonOperator
 -> Maybe Text
 -> Maybe Double
 -> Maybe Int
 -> Maybe Text
 -> Maybe Bool
 -> Maybe [AlarmState]
 -> Maybe MetricStatistic
 -> Maybe MetricUnit
 -> Maybe MonitoredResourceInfo
 -> Alarm)
-> Parser (Maybe AlarmState)
-> Parser
     (Maybe TreatMissingData
      -> Maybe ResourceType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AlarmState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe TreatMissingData
   -> Maybe ResourceType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe TreatMissingData)
-> Parser
     (Maybe ResourceType
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TreatMissingData)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"treatMissingData")
            Parser
  (Maybe ResourceType
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe ResourceType)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
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
"arn")
            Parser
  (Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ResourceLocation
      -> Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe ResourceLocation
   -> Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe ResourceLocation)
-> Parser
     (Maybe [ContactProtocol]
      -> Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"location")
            Parser
  (Maybe [ContactProtocol]
   -> Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe [ContactProtocol])
-> Parser
     (Maybe Natural
      -> Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ContactProtocol]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"contactProtocols"
                            Parser (Maybe (Maybe [ContactProtocol]))
-> Maybe [ContactProtocol] -> Parser (Maybe [ContactProtocol])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ContactProtocol]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Natural
   -> Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Int
      -> Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"period")
            Parser
  (Maybe Int
   -> Maybe MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Int)
-> Parser
     (Maybe MetricName
      -> Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => 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 MetricName
   -> Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe MetricName)
-> Parser
     (Maybe ComparisonOperator
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metricName")
            Parser
  (Maybe ComparisonOperator
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe ComparisonOperator)
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComparisonOperator)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"comparisonOperator")
            Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
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
"name")
            Parser
  (Maybe Double
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"threshold")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => 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
"datapointsToAlarm")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
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
"supportCode")
            Parser
  (Maybe Bool
   -> Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [AlarmState]
      -> Maybe MetricStatistic
      -> Maybe MetricUnit
      -> Maybe MonitoredResourceInfo
      -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"notificationEnabled")
            Parser
  (Maybe [AlarmState]
   -> Maybe MetricStatistic
   -> Maybe MetricUnit
   -> Maybe MonitoredResourceInfo
   -> Alarm)
-> Parser (Maybe [AlarmState])
-> Parser
     (Maybe MetricStatistic
      -> Maybe MetricUnit -> Maybe MonitoredResourceInfo -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AlarmState]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"notificationTriggers"
                            Parser (Maybe (Maybe [AlarmState]))
-> Maybe [AlarmState] -> Parser (Maybe [AlarmState])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AlarmState]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe MetricStatistic
   -> Maybe MetricUnit -> Maybe MonitoredResourceInfo -> Alarm)
-> Parser (Maybe MetricStatistic)
-> Parser
     (Maybe MetricUnit -> Maybe MonitoredResourceInfo -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricStatistic)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"statistic")
            Parser (Maybe MetricUnit -> Maybe MonitoredResourceInfo -> Alarm)
-> Parser (Maybe MetricUnit)
-> Parser (Maybe MonitoredResourceInfo -> Alarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricUnit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unit")
            Parser (Maybe MonitoredResourceInfo -> Alarm)
-> Parser (Maybe MonitoredResourceInfo) -> Parser Alarm
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MonitoredResourceInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"monitoredResourceInfo")
      )

instance Prelude.Hashable Alarm

instance Prelude.NFData Alarm