{-# 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.CloudWatch.Types.CompositeAlarm
-- 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.CloudWatch.Types.CompositeAlarm where

import Amazonka.CloudWatch.Types.StateValue
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details about a composite alarm.
--
-- /See:/ 'newCompositeAlarm' smart constructor.
data CompositeAlarm = CompositeAlarm'
  { -- | The name of the alarm.
    CompositeAlarm -> Maybe Text
alarmName :: Prelude.Maybe Prelude.Text,
    -- | The time stamp of the last update to the alarm state.
    CompositeAlarm -> Maybe ISO8601
stateUpdatedTimestamp :: Prelude.Maybe Core.ISO8601,
    -- | The description of the alarm.
    CompositeAlarm -> Maybe Text
alarmDescription :: Prelude.Maybe Prelude.Text,
    -- | The rule that this alarm uses to evaluate its alarm state.
    CompositeAlarm -> Maybe Text
alarmRule :: Prelude.Maybe Prelude.Text,
    -- | The actions to execute when this alarm transitions to the OK state from
    -- any other state. Each action is specified as an Amazon Resource Name
    -- (ARN).
    CompositeAlarm -> Maybe [Text]
oKActions :: Prelude.Maybe [Prelude.Text],
    -- | The state value for the alarm.
    CompositeAlarm -> Maybe StateValue
stateValue :: Prelude.Maybe StateValue,
    -- | The time stamp of the last update to the alarm configuration.
    CompositeAlarm -> Maybe ISO8601
alarmConfigurationUpdatedTimestamp :: Prelude.Maybe Core.ISO8601,
    -- | Indicates whether actions should be executed during any changes to the
    -- alarm state.
    CompositeAlarm -> Maybe Bool
actionsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The actions to execute when this alarm transitions to the
    -- INSUFFICIENT_DATA state from any other state. Each action is specified
    -- as an Amazon Resource Name (ARN).
    CompositeAlarm -> Maybe [Text]
insufficientDataActions :: Prelude.Maybe [Prelude.Text],
    -- | An explanation for the alarm state, in text format.
    CompositeAlarm -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | An explanation for the alarm state, in JSON format.
    CompositeAlarm -> Maybe Text
stateReasonData :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the alarm.
    CompositeAlarm -> Maybe Text
alarmArn :: Prelude.Maybe Prelude.Text,
    -- | The actions to execute when this alarm transitions to the ALARM state
    -- from any other state. Each action is specified as an Amazon Resource
    -- Name (ARN).
    CompositeAlarm -> Maybe [Text]
alarmActions :: Prelude.Maybe [Prelude.Text]
  }
  deriving (CompositeAlarm -> CompositeAlarm -> Bool
(CompositeAlarm -> CompositeAlarm -> Bool)
-> (CompositeAlarm -> CompositeAlarm -> Bool) -> Eq CompositeAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompositeAlarm -> CompositeAlarm -> Bool
$c/= :: CompositeAlarm -> CompositeAlarm -> Bool
== :: CompositeAlarm -> CompositeAlarm -> Bool
$c== :: CompositeAlarm -> CompositeAlarm -> Bool
Prelude.Eq, ReadPrec [CompositeAlarm]
ReadPrec CompositeAlarm
Int -> ReadS CompositeAlarm
ReadS [CompositeAlarm]
(Int -> ReadS CompositeAlarm)
-> ReadS [CompositeAlarm]
-> ReadPrec CompositeAlarm
-> ReadPrec [CompositeAlarm]
-> Read CompositeAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompositeAlarm]
$creadListPrec :: ReadPrec [CompositeAlarm]
readPrec :: ReadPrec CompositeAlarm
$creadPrec :: ReadPrec CompositeAlarm
readList :: ReadS [CompositeAlarm]
$creadList :: ReadS [CompositeAlarm]
readsPrec :: Int -> ReadS CompositeAlarm
$creadsPrec :: Int -> ReadS CompositeAlarm
Prelude.Read, Int -> CompositeAlarm -> ShowS
[CompositeAlarm] -> ShowS
CompositeAlarm -> String
(Int -> CompositeAlarm -> ShowS)
-> (CompositeAlarm -> String)
-> ([CompositeAlarm] -> ShowS)
-> Show CompositeAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompositeAlarm] -> ShowS
$cshowList :: [CompositeAlarm] -> ShowS
show :: CompositeAlarm -> String
$cshow :: CompositeAlarm -> String
showsPrec :: Int -> CompositeAlarm -> ShowS
$cshowsPrec :: Int -> CompositeAlarm -> ShowS
Prelude.Show, (forall x. CompositeAlarm -> Rep CompositeAlarm x)
-> (forall x. Rep CompositeAlarm x -> CompositeAlarm)
-> Generic CompositeAlarm
forall x. Rep CompositeAlarm x -> CompositeAlarm
forall x. CompositeAlarm -> Rep CompositeAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompositeAlarm x -> CompositeAlarm
$cfrom :: forall x. CompositeAlarm -> Rep CompositeAlarm x
Prelude.Generic)

-- |
-- Create a value of 'CompositeAlarm' 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:
--
-- 'alarmName', 'compositeAlarm_alarmName' - The name of the alarm.
--
-- 'stateUpdatedTimestamp', 'compositeAlarm_stateUpdatedTimestamp' - The time stamp of the last update to the alarm state.
--
-- 'alarmDescription', 'compositeAlarm_alarmDescription' - The description of the alarm.
--
-- 'alarmRule', 'compositeAlarm_alarmRule' - The rule that this alarm uses to evaluate its alarm state.
--
-- 'oKActions', 'compositeAlarm_oKActions' - The actions to execute when this alarm transitions to the OK state from
-- any other state. Each action is specified as an Amazon Resource Name
-- (ARN).
--
-- 'stateValue', 'compositeAlarm_stateValue' - The state value for the alarm.
--
-- 'alarmConfigurationUpdatedTimestamp', 'compositeAlarm_alarmConfigurationUpdatedTimestamp' - The time stamp of the last update to the alarm configuration.
--
-- 'actionsEnabled', 'compositeAlarm_actionsEnabled' - Indicates whether actions should be executed during any changes to the
-- alarm state.
--
-- 'insufficientDataActions', 'compositeAlarm_insufficientDataActions' - The actions to execute when this alarm transitions to the
-- INSUFFICIENT_DATA state from any other state. Each action is specified
-- as an Amazon Resource Name (ARN).
--
-- 'stateReason', 'compositeAlarm_stateReason' - An explanation for the alarm state, in text format.
--
-- 'stateReasonData', 'compositeAlarm_stateReasonData' - An explanation for the alarm state, in JSON format.
--
-- 'alarmArn', 'compositeAlarm_alarmArn' - The Amazon Resource Name (ARN) of the alarm.
--
-- 'alarmActions', 'compositeAlarm_alarmActions' - The actions to execute when this alarm transitions to the ALARM state
-- from any other state. Each action is specified as an Amazon Resource
-- Name (ARN).
newCompositeAlarm ::
  CompositeAlarm
newCompositeAlarm :: CompositeAlarm
newCompositeAlarm =
  CompositeAlarm' :: Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe StateValue
-> Maybe ISO8601
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> CompositeAlarm
CompositeAlarm'
    { $sel:alarmName:CompositeAlarm' :: Maybe Text
alarmName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateUpdatedTimestamp:CompositeAlarm' :: Maybe ISO8601
stateUpdatedTimestamp = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmDescription:CompositeAlarm' :: Maybe Text
alarmDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmRule:CompositeAlarm' :: Maybe Text
alarmRule = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:oKActions:CompositeAlarm' :: Maybe [Text]
oKActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:stateValue:CompositeAlarm' :: Maybe StateValue
stateValue = Maybe StateValue
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmConfigurationUpdatedTimestamp:CompositeAlarm' :: Maybe ISO8601
alarmConfigurationUpdatedTimestamp = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:actionsEnabled:CompositeAlarm' :: Maybe Bool
actionsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:insufficientDataActions:CompositeAlarm' :: Maybe [Text]
insufficientDataActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:CompositeAlarm' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReasonData:CompositeAlarm' :: Maybe Text
stateReasonData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmArn:CompositeAlarm' :: Maybe Text
alarmArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmActions:CompositeAlarm' :: Maybe [Text]
alarmActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The time stamp of the last update to the alarm state.
compositeAlarm_stateUpdatedTimestamp :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.UTCTime)
compositeAlarm_stateUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_stateUpdatedTimestamp = (CompositeAlarm -> Maybe ISO8601)
-> (CompositeAlarm -> Maybe ISO8601 -> CompositeAlarm)
-> Lens
     CompositeAlarm CompositeAlarm (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe ISO8601
stateUpdatedTimestamp :: Maybe ISO8601
$sel:stateUpdatedTimestamp:CompositeAlarm' :: CompositeAlarm -> Maybe ISO8601
stateUpdatedTimestamp} -> Maybe ISO8601
stateUpdatedTimestamp) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe ISO8601
a -> CompositeAlarm
s {$sel:stateUpdatedTimestamp:CompositeAlarm' :: Maybe ISO8601
stateUpdatedTimestamp = Maybe ISO8601
a} :: CompositeAlarm) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> CompositeAlarm -> f CompositeAlarm)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CompositeAlarm
-> f CompositeAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

-- | The rule that this alarm uses to evaluate its alarm state.
compositeAlarm_alarmRule :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.Text)
compositeAlarm_alarmRule :: (Maybe Text -> f (Maybe Text))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_alarmRule = (CompositeAlarm -> Maybe Text)
-> (CompositeAlarm -> Maybe Text -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe Text
alarmRule :: Maybe Text
$sel:alarmRule:CompositeAlarm' :: CompositeAlarm -> Maybe Text
alarmRule} -> Maybe Text
alarmRule) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe Text
a -> CompositeAlarm
s {$sel:alarmRule:CompositeAlarm' :: Maybe Text
alarmRule = Maybe Text
a} :: CompositeAlarm)

-- | The actions to execute when this alarm transitions to the OK state from
-- any other state. Each action is specified as an Amazon Resource Name
-- (ARN).
compositeAlarm_oKActions :: Lens.Lens' CompositeAlarm (Prelude.Maybe [Prelude.Text])
compositeAlarm_oKActions :: (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_oKActions = (CompositeAlarm -> Maybe [Text])
-> (CompositeAlarm -> Maybe [Text] -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe [Text]
oKActions :: Maybe [Text]
$sel:oKActions:CompositeAlarm' :: CompositeAlarm -> Maybe [Text]
oKActions} -> Maybe [Text]
oKActions) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe [Text]
a -> CompositeAlarm
s {$sel:oKActions:CompositeAlarm' :: Maybe [Text]
oKActions = Maybe [Text]
a} :: CompositeAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> CompositeAlarm -> f CompositeAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm
-> f CompositeAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The state value for the alarm.
compositeAlarm_stateValue :: Lens.Lens' CompositeAlarm (Prelude.Maybe StateValue)
compositeAlarm_stateValue :: (Maybe StateValue -> f (Maybe StateValue))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_stateValue = (CompositeAlarm -> Maybe StateValue)
-> (CompositeAlarm -> Maybe StateValue -> CompositeAlarm)
-> Lens
     CompositeAlarm CompositeAlarm (Maybe StateValue) (Maybe StateValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe StateValue
stateValue :: Maybe StateValue
$sel:stateValue:CompositeAlarm' :: CompositeAlarm -> Maybe StateValue
stateValue} -> Maybe StateValue
stateValue) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe StateValue
a -> CompositeAlarm
s {$sel:stateValue:CompositeAlarm' :: Maybe StateValue
stateValue = Maybe StateValue
a} :: CompositeAlarm)

-- | The time stamp of the last update to the alarm configuration.
compositeAlarm_alarmConfigurationUpdatedTimestamp :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.UTCTime)
compositeAlarm_alarmConfigurationUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_alarmConfigurationUpdatedTimestamp = (CompositeAlarm -> Maybe ISO8601)
-> (CompositeAlarm -> Maybe ISO8601 -> CompositeAlarm)
-> Lens
     CompositeAlarm CompositeAlarm (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe ISO8601
alarmConfigurationUpdatedTimestamp :: Maybe ISO8601
$sel:alarmConfigurationUpdatedTimestamp:CompositeAlarm' :: CompositeAlarm -> Maybe ISO8601
alarmConfigurationUpdatedTimestamp} -> Maybe ISO8601
alarmConfigurationUpdatedTimestamp) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe ISO8601
a -> CompositeAlarm
s {$sel:alarmConfigurationUpdatedTimestamp:CompositeAlarm' :: Maybe ISO8601
alarmConfigurationUpdatedTimestamp = Maybe ISO8601
a} :: CompositeAlarm) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> CompositeAlarm -> f CompositeAlarm)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CompositeAlarm
-> f CompositeAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indicates whether actions should be executed during any changes to the
-- alarm state.
compositeAlarm_actionsEnabled :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.Bool)
compositeAlarm_actionsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_actionsEnabled = (CompositeAlarm -> Maybe Bool)
-> (CompositeAlarm -> Maybe Bool -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe Bool
actionsEnabled :: Maybe Bool
$sel:actionsEnabled:CompositeAlarm' :: CompositeAlarm -> Maybe Bool
actionsEnabled} -> Maybe Bool
actionsEnabled) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe Bool
a -> CompositeAlarm
s {$sel:actionsEnabled:CompositeAlarm' :: Maybe Bool
actionsEnabled = Maybe Bool
a} :: CompositeAlarm)

-- | The actions to execute when this alarm transitions to the
-- INSUFFICIENT_DATA state from any other state. Each action is specified
-- as an Amazon Resource Name (ARN).
compositeAlarm_insufficientDataActions :: Lens.Lens' CompositeAlarm (Prelude.Maybe [Prelude.Text])
compositeAlarm_insufficientDataActions :: (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_insufficientDataActions = (CompositeAlarm -> Maybe [Text])
-> (CompositeAlarm -> Maybe [Text] -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe [Text]
insufficientDataActions :: Maybe [Text]
$sel:insufficientDataActions:CompositeAlarm' :: CompositeAlarm -> Maybe [Text]
insufficientDataActions} -> Maybe [Text]
insufficientDataActions) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe [Text]
a -> CompositeAlarm
s {$sel:insufficientDataActions:CompositeAlarm' :: Maybe [Text]
insufficientDataActions = Maybe [Text]
a} :: CompositeAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> CompositeAlarm -> f CompositeAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm
-> f CompositeAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An explanation for the alarm state, in text format.
compositeAlarm_stateReason :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.Text)
compositeAlarm_stateReason :: (Maybe Text -> f (Maybe Text))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_stateReason = (CompositeAlarm -> Maybe Text)
-> (CompositeAlarm -> Maybe Text -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:CompositeAlarm' :: CompositeAlarm -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe Text
a -> CompositeAlarm
s {$sel:stateReason:CompositeAlarm' :: Maybe Text
stateReason = Maybe Text
a} :: CompositeAlarm)

-- | An explanation for the alarm state, in JSON format.
compositeAlarm_stateReasonData :: Lens.Lens' CompositeAlarm (Prelude.Maybe Prelude.Text)
compositeAlarm_stateReasonData :: (Maybe Text -> f (Maybe Text))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_stateReasonData = (CompositeAlarm -> Maybe Text)
-> (CompositeAlarm -> Maybe Text -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe Text
stateReasonData :: Maybe Text
$sel:stateReasonData:CompositeAlarm' :: CompositeAlarm -> Maybe Text
stateReasonData} -> Maybe Text
stateReasonData) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe Text
a -> CompositeAlarm
s {$sel:stateReasonData:CompositeAlarm' :: Maybe Text
stateReasonData = Maybe Text
a} :: CompositeAlarm)

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

-- | The actions to execute when this alarm transitions to the ALARM state
-- from any other state. Each action is specified as an Amazon Resource
-- Name (ARN).
compositeAlarm_alarmActions :: Lens.Lens' CompositeAlarm (Prelude.Maybe [Prelude.Text])
compositeAlarm_alarmActions :: (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm -> f CompositeAlarm
compositeAlarm_alarmActions = (CompositeAlarm -> Maybe [Text])
-> (CompositeAlarm -> Maybe [Text] -> CompositeAlarm)
-> Lens CompositeAlarm CompositeAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeAlarm' {Maybe [Text]
alarmActions :: Maybe [Text]
$sel:alarmActions:CompositeAlarm' :: CompositeAlarm -> Maybe [Text]
alarmActions} -> Maybe [Text]
alarmActions) (\s :: CompositeAlarm
s@CompositeAlarm' {} Maybe [Text]
a -> CompositeAlarm
s {$sel:alarmActions:CompositeAlarm' :: Maybe [Text]
alarmActions = Maybe [Text]
a} :: CompositeAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> CompositeAlarm -> f CompositeAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CompositeAlarm
-> f CompositeAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML CompositeAlarm where
  parseXML :: [Node] -> Either String CompositeAlarm
parseXML [Node]
x =
    Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe StateValue
-> Maybe ISO8601
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> CompositeAlarm
CompositeAlarm'
      (Maybe Text
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe StateValue
 -> Maybe ISO8601
 -> Maybe Bool
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe StateValue
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmName")
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe StateValue
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe StateValue
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StateUpdatedTimestamp")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe StateValue
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [Text]
      -> Maybe StateValue
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmDescription")
      Either
  String
  (Maybe Text
   -> Maybe [Text]
   -> Maybe StateValue
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Text]
      -> Maybe StateValue
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmRule")
      Either
  String
  (Maybe [Text]
   -> Maybe StateValue
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe StateValue
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OKActions" 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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe StateValue
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe StateValue)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe StateValue)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StateValue")
      Either
  String
  (Maybe ISO8601
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmConfigurationUpdatedTimestamp")
      Either
  String
  (Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActionsEnabled")
      Either
  String
  (Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> CompositeAlarm)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe [Text] -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"InsufficientDataActions"
                      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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe [Text] -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Maybe [Text] -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StateReason")
      Either
  String (Maybe Text -> Maybe Text -> Maybe [Text] -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe [Text] -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StateReasonData")
      Either String (Maybe Text -> Maybe [Text] -> CompositeAlarm)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> CompositeAlarm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmArn")
      Either String (Maybe [Text] -> CompositeAlarm)
-> Either String (Maybe [Text]) -> Either String CompositeAlarm
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AlarmActions" 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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )

instance Prelude.Hashable CompositeAlarm

instance Prelude.NFData CompositeAlarm