{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeAlarms
-- 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)
--
-- Retrieves the specified alarms. You can filter the results by specifying
-- a prefix for the alarm name, the alarm state, or a prefix for any
-- action.
--
-- This operation returns paginated results.
module Amazonka.CloudWatch.DescribeAlarms
  ( -- * Creating a Request
    DescribeAlarms (..),
    newDescribeAlarms,

    -- * Request Lenses
    describeAlarms_alarmNamePrefix,
    describeAlarms_alarmTypes,
    describeAlarms_actionPrefix,
    describeAlarms_nextToken,
    describeAlarms_stateValue,
    describeAlarms_alarmNames,
    describeAlarms_maxRecords,
    describeAlarms_parentsOfAlarmName,
    describeAlarms_childrenOfAlarmName,

    -- * Destructuring the Response
    DescribeAlarmsResponse (..),
    newDescribeAlarmsResponse,

    -- * Response Lenses
    describeAlarmsResponse_metricAlarms,
    describeAlarmsResponse_compositeAlarms,
    describeAlarmsResponse_nextToken,
    describeAlarmsResponse_httpStatus,
  )
where

import Amazonka.CloudWatch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeAlarms' smart constructor.
data DescribeAlarms = DescribeAlarms'
  { -- | An alarm name prefix. If you specify this parameter, you receive
    -- information about all alarms that have names that start with this
    -- prefix.
    --
    -- If this parameter is specified, you cannot specify @AlarmNames@.
    DescribeAlarms -> Maybe Text
alarmNamePrefix :: Prelude.Maybe Prelude.Text,
    -- | Use this parameter to specify whether you want the operation to return
    -- metric alarms or composite alarms. If you omit this parameter, only
    -- metric alarms are returned.
    DescribeAlarms -> Maybe [AlarmType]
alarmTypes :: Prelude.Maybe [AlarmType],
    -- | Use this parameter to filter the results of the operation to only those
    -- alarms that use a certain alarm action. For example, you could specify
    -- the ARN of an SNS topic to find all alarms that send notifications to
    -- that topic.
    DescribeAlarms -> Maybe Text
actionPrefix :: Prelude.Maybe Prelude.Text,
    -- | The token returned by a previous call to indicate that there is more
    -- data available.
    DescribeAlarms -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Specify this parameter to receive information only about alarms that are
    -- currently in the state that you specify.
    DescribeAlarms -> Maybe StateValue
stateValue :: Prelude.Maybe StateValue,
    -- | The names of the alarms to retrieve information about.
    DescribeAlarms -> Maybe [Text]
alarmNames :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of alarm descriptions to retrieve.
    DescribeAlarms -> Maybe Natural
maxRecords :: Prelude.Maybe Prelude.Natural,
    -- | If you use this parameter and specify the name of a metric or composite
    -- alarm, the operation returns information about the \"parent\" alarms of
    -- the alarm you specify. These are the composite alarms that have
    -- @AlarmRule@ parameters that reference the alarm named in
    -- @ParentsOfAlarmName@. Information about the alarm that you specify in
    -- @ParentsOfAlarmName@ is not returned.
    --
    -- If you specify @ParentsOfAlarmName@, you cannot specify any other
    -- parameters in the request except for @MaxRecords@ and @NextToken@. If
    -- you do so, you receive a validation error.
    --
    -- Only the Alarm Name and ARN are returned by this operation when you use
    -- this parameter. To get complete information about these alarms, perform
    -- another @DescribeAlarms@ operation and specify the parent alarm names in
    -- the @AlarmNames@ parameter.
    DescribeAlarms -> Maybe Text
parentsOfAlarmName :: Prelude.Maybe Prelude.Text,
    -- | If you use this parameter and specify the name of a composite alarm, the
    -- operation returns information about the \"children\" alarms of the alarm
    -- you specify. These are the metric alarms and composite alarms referenced
    -- in the @AlarmRule@ field of the composite alarm that you specify in
    -- @ChildrenOfAlarmName@. Information about the composite alarm that you
    -- name in @ChildrenOfAlarmName@ is not returned.
    --
    -- If you specify @ChildrenOfAlarmName@, you cannot specify any other
    -- parameters in the request except for @MaxRecords@ and @NextToken@. If
    -- you do so, you receive a validation error.
    --
    -- Only the @Alarm Name@, @ARN@, @StateValue@
    -- (OK\/ALARM\/INSUFFICIENT_DATA), and @StateUpdatedTimestamp@ information
    -- are returned by this operation when you use this parameter. To get
    -- complete information about these alarms, perform another
    -- @DescribeAlarms@ operation and specify the parent alarm names in the
    -- @AlarmNames@ parameter.
    DescribeAlarms -> Maybe Text
childrenOfAlarmName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeAlarms -> DescribeAlarms -> Bool
(DescribeAlarms -> DescribeAlarms -> Bool)
-> (DescribeAlarms -> DescribeAlarms -> Bool) -> Eq DescribeAlarms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlarms -> DescribeAlarms -> Bool
$c/= :: DescribeAlarms -> DescribeAlarms -> Bool
== :: DescribeAlarms -> DescribeAlarms -> Bool
$c== :: DescribeAlarms -> DescribeAlarms -> Bool
Prelude.Eq, ReadPrec [DescribeAlarms]
ReadPrec DescribeAlarms
Int -> ReadS DescribeAlarms
ReadS [DescribeAlarms]
(Int -> ReadS DescribeAlarms)
-> ReadS [DescribeAlarms]
-> ReadPrec DescribeAlarms
-> ReadPrec [DescribeAlarms]
-> Read DescribeAlarms
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlarms]
$creadListPrec :: ReadPrec [DescribeAlarms]
readPrec :: ReadPrec DescribeAlarms
$creadPrec :: ReadPrec DescribeAlarms
readList :: ReadS [DescribeAlarms]
$creadList :: ReadS [DescribeAlarms]
readsPrec :: Int -> ReadS DescribeAlarms
$creadsPrec :: Int -> ReadS DescribeAlarms
Prelude.Read, Int -> DescribeAlarms -> ShowS
[DescribeAlarms] -> ShowS
DescribeAlarms -> String
(Int -> DescribeAlarms -> ShowS)
-> (DescribeAlarms -> String)
-> ([DescribeAlarms] -> ShowS)
-> Show DescribeAlarms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlarms] -> ShowS
$cshowList :: [DescribeAlarms] -> ShowS
show :: DescribeAlarms -> String
$cshow :: DescribeAlarms -> String
showsPrec :: Int -> DescribeAlarms -> ShowS
$cshowsPrec :: Int -> DescribeAlarms -> ShowS
Prelude.Show, (forall x. DescribeAlarms -> Rep DescribeAlarms x)
-> (forall x. Rep DescribeAlarms x -> DescribeAlarms)
-> Generic DescribeAlarms
forall x. Rep DescribeAlarms x -> DescribeAlarms
forall x. DescribeAlarms -> Rep DescribeAlarms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlarms x -> DescribeAlarms
$cfrom :: forall x. DescribeAlarms -> Rep DescribeAlarms x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlarms' 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:
--
-- 'alarmNamePrefix', 'describeAlarms_alarmNamePrefix' - An alarm name prefix. If you specify this parameter, you receive
-- information about all alarms that have names that start with this
-- prefix.
--
-- If this parameter is specified, you cannot specify @AlarmNames@.
--
-- 'alarmTypes', 'describeAlarms_alarmTypes' - Use this parameter to specify whether you want the operation to return
-- metric alarms or composite alarms. If you omit this parameter, only
-- metric alarms are returned.
--
-- 'actionPrefix', 'describeAlarms_actionPrefix' - Use this parameter to filter the results of the operation to only those
-- alarms that use a certain alarm action. For example, you could specify
-- the ARN of an SNS topic to find all alarms that send notifications to
-- that topic.
--
-- 'nextToken', 'describeAlarms_nextToken' - The token returned by a previous call to indicate that there is more
-- data available.
--
-- 'stateValue', 'describeAlarms_stateValue' - Specify this parameter to receive information only about alarms that are
-- currently in the state that you specify.
--
-- 'alarmNames', 'describeAlarms_alarmNames' - The names of the alarms to retrieve information about.
--
-- 'maxRecords', 'describeAlarms_maxRecords' - The maximum number of alarm descriptions to retrieve.
--
-- 'parentsOfAlarmName', 'describeAlarms_parentsOfAlarmName' - If you use this parameter and specify the name of a metric or composite
-- alarm, the operation returns information about the \"parent\" alarms of
-- the alarm you specify. These are the composite alarms that have
-- @AlarmRule@ parameters that reference the alarm named in
-- @ParentsOfAlarmName@. Information about the alarm that you specify in
-- @ParentsOfAlarmName@ is not returned.
--
-- If you specify @ParentsOfAlarmName@, you cannot specify any other
-- parameters in the request except for @MaxRecords@ and @NextToken@. If
-- you do so, you receive a validation error.
--
-- Only the Alarm Name and ARN are returned by this operation when you use
-- this parameter. To get complete information about these alarms, perform
-- another @DescribeAlarms@ operation and specify the parent alarm names in
-- the @AlarmNames@ parameter.
--
-- 'childrenOfAlarmName', 'describeAlarms_childrenOfAlarmName' - If you use this parameter and specify the name of a composite alarm, the
-- operation returns information about the \"children\" alarms of the alarm
-- you specify. These are the metric alarms and composite alarms referenced
-- in the @AlarmRule@ field of the composite alarm that you specify in
-- @ChildrenOfAlarmName@. Information about the composite alarm that you
-- name in @ChildrenOfAlarmName@ is not returned.
--
-- If you specify @ChildrenOfAlarmName@, you cannot specify any other
-- parameters in the request except for @MaxRecords@ and @NextToken@. If
-- you do so, you receive a validation error.
--
-- Only the @Alarm Name@, @ARN@, @StateValue@
-- (OK\/ALARM\/INSUFFICIENT_DATA), and @StateUpdatedTimestamp@ information
-- are returned by this operation when you use this parameter. To get
-- complete information about these alarms, perform another
-- @DescribeAlarms@ operation and specify the parent alarm names in the
-- @AlarmNames@ parameter.
newDescribeAlarms ::
  DescribeAlarms
newDescribeAlarms :: DescribeAlarms
newDescribeAlarms =
  DescribeAlarms' :: Maybe Text
-> Maybe [AlarmType]
-> Maybe Text
-> Maybe Text
-> Maybe StateValue
-> Maybe [Text]
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> DescribeAlarms
DescribeAlarms'
    { $sel:alarmNamePrefix:DescribeAlarms' :: Maybe Text
alarmNamePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmTypes:DescribeAlarms' :: Maybe [AlarmType]
alarmTypes = Maybe [AlarmType]
forall a. Maybe a
Prelude.Nothing,
      $sel:actionPrefix:DescribeAlarms' :: Maybe Text
actionPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAlarms' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateValue:DescribeAlarms' :: Maybe StateValue
stateValue = Maybe StateValue
forall a. Maybe a
Prelude.Nothing,
      $sel:alarmNames:DescribeAlarms' :: Maybe [Text]
alarmNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeAlarms' :: Maybe Natural
maxRecords = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:parentsOfAlarmName:DescribeAlarms' :: Maybe Text
parentsOfAlarmName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:childrenOfAlarmName:DescribeAlarms' :: Maybe Text
childrenOfAlarmName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An alarm name prefix. If you specify this parameter, you receive
-- information about all alarms that have names that start with this
-- prefix.
--
-- If this parameter is specified, you cannot specify @AlarmNames@.
describeAlarms_alarmNamePrefix :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Text)
describeAlarms_alarmNamePrefix :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_alarmNamePrefix = (DescribeAlarms -> Maybe Text)
-> (DescribeAlarms -> Maybe Text -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Text
alarmNamePrefix :: Maybe Text
$sel:alarmNamePrefix:DescribeAlarms' :: DescribeAlarms -> Maybe Text
alarmNamePrefix} -> Maybe Text
alarmNamePrefix) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Text
a -> DescribeAlarms
s {$sel:alarmNamePrefix:DescribeAlarms' :: Maybe Text
alarmNamePrefix = Maybe Text
a} :: DescribeAlarms)

-- | Use this parameter to specify whether you want the operation to return
-- metric alarms or composite alarms. If you omit this parameter, only
-- metric alarms are returned.
describeAlarms_alarmTypes :: Lens.Lens' DescribeAlarms (Prelude.Maybe [AlarmType])
describeAlarms_alarmTypes :: (Maybe [AlarmType] -> f (Maybe [AlarmType]))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_alarmTypes = (DescribeAlarms -> Maybe [AlarmType])
-> (DescribeAlarms -> Maybe [AlarmType] -> DescribeAlarms)
-> Lens
     DescribeAlarms
     DescribeAlarms
     (Maybe [AlarmType])
     (Maybe [AlarmType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe [AlarmType]
alarmTypes :: Maybe [AlarmType]
$sel:alarmTypes:DescribeAlarms' :: DescribeAlarms -> Maybe [AlarmType]
alarmTypes} -> Maybe [AlarmType]
alarmTypes) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe [AlarmType]
a -> DescribeAlarms
s {$sel:alarmTypes:DescribeAlarms' :: Maybe [AlarmType]
alarmTypes = Maybe [AlarmType]
a} :: DescribeAlarms) ((Maybe [AlarmType] -> f (Maybe [AlarmType]))
 -> DescribeAlarms -> f DescribeAlarms)
-> ((Maybe [AlarmType] -> f (Maybe [AlarmType]))
    -> Maybe [AlarmType] -> f (Maybe [AlarmType]))
-> (Maybe [AlarmType] -> f (Maybe [AlarmType]))
-> DescribeAlarms
-> f DescribeAlarms
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AlarmType] [AlarmType] [AlarmType] [AlarmType]
-> Iso
     (Maybe [AlarmType])
     (Maybe [AlarmType])
     (Maybe [AlarmType])
     (Maybe [AlarmType])
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 [AlarmType] [AlarmType] [AlarmType] [AlarmType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Use this parameter to filter the results of the operation to only those
-- alarms that use a certain alarm action. For example, you could specify
-- the ARN of an SNS topic to find all alarms that send notifications to
-- that topic.
describeAlarms_actionPrefix :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Text)
describeAlarms_actionPrefix :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_actionPrefix = (DescribeAlarms -> Maybe Text)
-> (DescribeAlarms -> Maybe Text -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Text
actionPrefix :: Maybe Text
$sel:actionPrefix:DescribeAlarms' :: DescribeAlarms -> Maybe Text
actionPrefix} -> Maybe Text
actionPrefix) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Text
a -> DescribeAlarms
s {$sel:actionPrefix:DescribeAlarms' :: Maybe Text
actionPrefix = Maybe Text
a} :: DescribeAlarms)

-- | The token returned by a previous call to indicate that there is more
-- data available.
describeAlarms_nextToken :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Text)
describeAlarms_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_nextToken = (DescribeAlarms -> Maybe Text)
-> (DescribeAlarms -> Maybe Text -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAlarms' :: DescribeAlarms -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Text
a -> DescribeAlarms
s {$sel:nextToken:DescribeAlarms' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAlarms)

-- | Specify this parameter to receive information only about alarms that are
-- currently in the state that you specify.
describeAlarms_stateValue :: Lens.Lens' DescribeAlarms (Prelude.Maybe StateValue)
describeAlarms_stateValue :: (Maybe StateValue -> f (Maybe StateValue))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_stateValue = (DescribeAlarms -> Maybe StateValue)
-> (DescribeAlarms -> Maybe StateValue -> DescribeAlarms)
-> Lens
     DescribeAlarms DescribeAlarms (Maybe StateValue) (Maybe StateValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe StateValue
stateValue :: Maybe StateValue
$sel:stateValue:DescribeAlarms' :: DescribeAlarms -> Maybe StateValue
stateValue} -> Maybe StateValue
stateValue) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe StateValue
a -> DescribeAlarms
s {$sel:stateValue:DescribeAlarms' :: Maybe StateValue
stateValue = Maybe StateValue
a} :: DescribeAlarms)

-- | The names of the alarms to retrieve information about.
describeAlarms_alarmNames :: Lens.Lens' DescribeAlarms (Prelude.Maybe [Prelude.Text])
describeAlarms_alarmNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_alarmNames = (DescribeAlarms -> Maybe [Text])
-> (DescribeAlarms -> Maybe [Text] -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe [Text]
alarmNames :: Maybe [Text]
$sel:alarmNames:DescribeAlarms' :: DescribeAlarms -> Maybe [Text]
alarmNames} -> Maybe [Text]
alarmNames) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe [Text]
a -> DescribeAlarms
s {$sel:alarmNames:DescribeAlarms' :: Maybe [Text]
alarmNames = Maybe [Text]
a} :: DescribeAlarms) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeAlarms -> f DescribeAlarms)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAlarms
-> f DescribeAlarms
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 maximum number of alarm descriptions to retrieve.
describeAlarms_maxRecords :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Natural)
describeAlarms_maxRecords :: (Maybe Natural -> f (Maybe Natural))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_maxRecords = (DescribeAlarms -> Maybe Natural)
-> (DescribeAlarms -> Maybe Natural -> DescribeAlarms)
-> Lens
     DescribeAlarms DescribeAlarms (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Natural
maxRecords :: Maybe Natural
$sel:maxRecords:DescribeAlarms' :: DescribeAlarms -> Maybe Natural
maxRecords} -> Maybe Natural
maxRecords) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Natural
a -> DescribeAlarms
s {$sel:maxRecords:DescribeAlarms' :: Maybe Natural
maxRecords = Maybe Natural
a} :: DescribeAlarms)

-- | If you use this parameter and specify the name of a metric or composite
-- alarm, the operation returns information about the \"parent\" alarms of
-- the alarm you specify. These are the composite alarms that have
-- @AlarmRule@ parameters that reference the alarm named in
-- @ParentsOfAlarmName@. Information about the alarm that you specify in
-- @ParentsOfAlarmName@ is not returned.
--
-- If you specify @ParentsOfAlarmName@, you cannot specify any other
-- parameters in the request except for @MaxRecords@ and @NextToken@. If
-- you do so, you receive a validation error.
--
-- Only the Alarm Name and ARN are returned by this operation when you use
-- this parameter. To get complete information about these alarms, perform
-- another @DescribeAlarms@ operation and specify the parent alarm names in
-- the @AlarmNames@ parameter.
describeAlarms_parentsOfAlarmName :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Text)
describeAlarms_parentsOfAlarmName :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_parentsOfAlarmName = (DescribeAlarms -> Maybe Text)
-> (DescribeAlarms -> Maybe Text -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Text
parentsOfAlarmName :: Maybe Text
$sel:parentsOfAlarmName:DescribeAlarms' :: DescribeAlarms -> Maybe Text
parentsOfAlarmName} -> Maybe Text
parentsOfAlarmName) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Text
a -> DescribeAlarms
s {$sel:parentsOfAlarmName:DescribeAlarms' :: Maybe Text
parentsOfAlarmName = Maybe Text
a} :: DescribeAlarms)

-- | If you use this parameter and specify the name of a composite alarm, the
-- operation returns information about the \"children\" alarms of the alarm
-- you specify. These are the metric alarms and composite alarms referenced
-- in the @AlarmRule@ field of the composite alarm that you specify in
-- @ChildrenOfAlarmName@. Information about the composite alarm that you
-- name in @ChildrenOfAlarmName@ is not returned.
--
-- If you specify @ChildrenOfAlarmName@, you cannot specify any other
-- parameters in the request except for @MaxRecords@ and @NextToken@. If
-- you do so, you receive a validation error.
--
-- Only the @Alarm Name@, @ARN@, @StateValue@
-- (OK\/ALARM\/INSUFFICIENT_DATA), and @StateUpdatedTimestamp@ information
-- are returned by this operation when you use this parameter. To get
-- complete information about these alarms, perform another
-- @DescribeAlarms@ operation and specify the parent alarm names in the
-- @AlarmNames@ parameter.
describeAlarms_childrenOfAlarmName :: Lens.Lens' DescribeAlarms (Prelude.Maybe Prelude.Text)
describeAlarms_childrenOfAlarmName :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarms -> f DescribeAlarms
describeAlarms_childrenOfAlarmName = (DescribeAlarms -> Maybe Text)
-> (DescribeAlarms -> Maybe Text -> DescribeAlarms)
-> Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarms' {Maybe Text
childrenOfAlarmName :: Maybe Text
$sel:childrenOfAlarmName:DescribeAlarms' :: DescribeAlarms -> Maybe Text
childrenOfAlarmName} -> Maybe Text
childrenOfAlarmName) (\s :: DescribeAlarms
s@DescribeAlarms' {} Maybe Text
a -> DescribeAlarms
s {$sel:childrenOfAlarmName:DescribeAlarms' :: Maybe Text
childrenOfAlarmName = Maybe Text
a} :: DescribeAlarms)

instance Core.AWSPager DescribeAlarms where
  page :: DescribeAlarms
-> AWSResponse DescribeAlarms -> Maybe DescribeAlarms
page DescribeAlarms
rq AWSResponse DescribeAlarms
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAlarms
DescribeAlarmsResponse
rs
            DescribeAlarmsResponse
-> Getting (First Text) DescribeAlarmsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeAlarmsResponse
-> Const (First Text) DescribeAlarmsResponse
Lens' DescribeAlarmsResponse (Maybe Text)
describeAlarmsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeAlarmsResponse
 -> Const (First Text) DescribeAlarmsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeAlarmsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeAlarms
forall a. Maybe a
Prelude.Nothing
    | Maybe [MetricAlarm] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAlarms
DescribeAlarmsResponse
rs
            DescribeAlarmsResponse
-> Getting
     (First [MetricAlarm]) DescribeAlarmsResponse [MetricAlarm]
-> Maybe [MetricAlarm]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [MetricAlarm]
 -> Const (First [MetricAlarm]) (Maybe [MetricAlarm]))
-> DescribeAlarmsResponse
-> Const (First [MetricAlarm]) DescribeAlarmsResponse
Lens' DescribeAlarmsResponse (Maybe [MetricAlarm])
describeAlarmsResponse_metricAlarms
              ((Maybe [MetricAlarm]
  -> Const (First [MetricAlarm]) (Maybe [MetricAlarm]))
 -> DescribeAlarmsResponse
 -> Const (First [MetricAlarm]) DescribeAlarmsResponse)
-> (([MetricAlarm] -> Const (First [MetricAlarm]) [MetricAlarm])
    -> Maybe [MetricAlarm]
    -> Const (First [MetricAlarm]) (Maybe [MetricAlarm]))
-> Getting
     (First [MetricAlarm]) DescribeAlarmsResponse [MetricAlarm]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MetricAlarm] -> Const (First [MetricAlarm]) [MetricAlarm])
-> Maybe [MetricAlarm]
-> Const (First [MetricAlarm]) (Maybe [MetricAlarm])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeAlarms
forall a. Maybe a
Prelude.Nothing
    | Maybe [CompositeAlarm] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAlarms
DescribeAlarmsResponse
rs
            DescribeAlarmsResponse
-> Getting
     (First [CompositeAlarm]) DescribeAlarmsResponse [CompositeAlarm]
-> Maybe [CompositeAlarm]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [CompositeAlarm]
 -> Const (First [CompositeAlarm]) (Maybe [CompositeAlarm]))
-> DescribeAlarmsResponse
-> Const (First [CompositeAlarm]) DescribeAlarmsResponse
Lens' DescribeAlarmsResponse (Maybe [CompositeAlarm])
describeAlarmsResponse_compositeAlarms
              ((Maybe [CompositeAlarm]
  -> Const (First [CompositeAlarm]) (Maybe [CompositeAlarm]))
 -> DescribeAlarmsResponse
 -> Const (First [CompositeAlarm]) DescribeAlarmsResponse)
-> (([CompositeAlarm]
     -> Const (First [CompositeAlarm]) [CompositeAlarm])
    -> Maybe [CompositeAlarm]
    -> Const (First [CompositeAlarm]) (Maybe [CompositeAlarm]))
-> Getting
     (First [CompositeAlarm]) DescribeAlarmsResponse [CompositeAlarm]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CompositeAlarm]
 -> Const (First [CompositeAlarm]) [CompositeAlarm])
-> Maybe [CompositeAlarm]
-> Const (First [CompositeAlarm]) (Maybe [CompositeAlarm])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeAlarms
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeAlarms -> Maybe DescribeAlarms
forall a. a -> Maybe a
Prelude.Just (DescribeAlarms -> Maybe DescribeAlarms)
-> DescribeAlarms -> Maybe DescribeAlarms
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeAlarms
rq
          DescribeAlarms
-> (DescribeAlarms -> DescribeAlarms) -> DescribeAlarms
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeAlarms -> Identity DescribeAlarms
Lens DescribeAlarms DescribeAlarms (Maybe Text) (Maybe Text)
describeAlarms_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeAlarms -> Identity DescribeAlarms)
-> Maybe Text -> DescribeAlarms -> DescribeAlarms
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeAlarms
DescribeAlarmsResponse
rs
          DescribeAlarmsResponse
-> Getting (First Text) DescribeAlarmsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeAlarmsResponse
-> Const (First Text) DescribeAlarmsResponse
Lens' DescribeAlarmsResponse (Maybe Text)
describeAlarmsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeAlarmsResponse
 -> Const (First Text) DescribeAlarmsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeAlarmsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeAlarms where
  type
    AWSResponse DescribeAlarms =
      DescribeAlarmsResponse
  request :: DescribeAlarms -> Request DescribeAlarms
request = Service -> DescribeAlarms -> Request DescribeAlarms
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAlarms)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeAlarms))
-> Logger
-> Service
-> Proxy DescribeAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAlarms)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeAlarmsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [MetricAlarm]
-> Maybe [CompositeAlarm]
-> Maybe Text
-> Int
-> DescribeAlarmsResponse
DescribeAlarmsResponse'
            (Maybe [MetricAlarm]
 -> Maybe [CompositeAlarm]
 -> Maybe Text
 -> Int
 -> DescribeAlarmsResponse)
-> Either String (Maybe [MetricAlarm])
-> Either
     String
     (Maybe [CompositeAlarm]
      -> Maybe Text -> Int -> DescribeAlarmsResponse)
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
"MetricAlarms" 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 [MetricAlarm]))
-> Either String (Maybe [MetricAlarm])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [MetricAlarm])
-> [Node] -> Either String (Maybe [MetricAlarm])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [MetricAlarm]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe [CompositeAlarm]
   -> Maybe Text -> Int -> DescribeAlarmsResponse)
-> Either String (Maybe [CompositeAlarm])
-> Either String (Maybe Text -> Int -> DescribeAlarmsResponse)
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
"CompositeAlarms" 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 [CompositeAlarm]))
-> Either String (Maybe [CompositeAlarm])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [CompositeAlarm])
-> [Node] -> Either String (Maybe [CompositeAlarm])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [CompositeAlarm]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Maybe Text -> Int -> DescribeAlarmsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeAlarmsResponse)
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
"NextToken")
            Either String (Int -> DescribeAlarmsResponse)
-> Either String Int -> Either String DescribeAlarmsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeAlarms

instance Prelude.NFData DescribeAlarms

instance Core.ToHeaders DescribeAlarms where
  toHeaders :: DescribeAlarms -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeAlarms -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DescribeAlarms where
  toPath :: DescribeAlarms -> ByteString
toPath = ByteString -> DescribeAlarms -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeAlarms where
  toQuery :: DescribeAlarms -> QueryString
toQuery DescribeAlarms' {Maybe Natural
Maybe [Text]
Maybe [AlarmType]
Maybe Text
Maybe StateValue
childrenOfAlarmName :: Maybe Text
parentsOfAlarmName :: Maybe Text
maxRecords :: Maybe Natural
alarmNames :: Maybe [Text]
stateValue :: Maybe StateValue
nextToken :: Maybe Text
actionPrefix :: Maybe Text
alarmTypes :: Maybe [AlarmType]
alarmNamePrefix :: Maybe Text
$sel:childrenOfAlarmName:DescribeAlarms' :: DescribeAlarms -> Maybe Text
$sel:parentsOfAlarmName:DescribeAlarms' :: DescribeAlarms -> Maybe Text
$sel:maxRecords:DescribeAlarms' :: DescribeAlarms -> Maybe Natural
$sel:alarmNames:DescribeAlarms' :: DescribeAlarms -> Maybe [Text]
$sel:stateValue:DescribeAlarms' :: DescribeAlarms -> Maybe StateValue
$sel:nextToken:DescribeAlarms' :: DescribeAlarms -> Maybe Text
$sel:actionPrefix:DescribeAlarms' :: DescribeAlarms -> Maybe Text
$sel:alarmTypes:DescribeAlarms' :: DescribeAlarms -> Maybe [AlarmType]
$sel:alarmNamePrefix:DescribeAlarms' :: DescribeAlarms -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeAlarms" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"AlarmNamePrefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
alarmNamePrefix,
        ByteString
"AlarmTypes"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [AlarmType] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([AlarmType] -> QueryString)
-> Maybe [AlarmType] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AlarmType]
alarmTypes),
        ByteString
"ActionPrefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
actionPrefix,
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"StateValue" ByteString -> Maybe StateValue -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StateValue
stateValue,
        ByteString
"AlarmNames"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
alarmNames),
        ByteString
"MaxRecords" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxRecords,
        ByteString
"ParentsOfAlarmName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
parentsOfAlarmName,
        ByteString
"ChildrenOfAlarmName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
childrenOfAlarmName
      ]

-- | /See:/ 'newDescribeAlarmsResponse' smart constructor.
data DescribeAlarmsResponse = DescribeAlarmsResponse'
  { -- | The information about any metric alarms returned by the operation.
    DescribeAlarmsResponse -> Maybe [MetricAlarm]
metricAlarms :: Prelude.Maybe [MetricAlarm],
    -- | The information about any composite alarms returned by the operation.
    DescribeAlarmsResponse -> Maybe [CompositeAlarm]
compositeAlarms :: Prelude.Maybe [CompositeAlarm],
    -- | The token that marks the start of the next batch of returned results.
    DescribeAlarmsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAlarmsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool
(DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool)
-> (DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool)
-> Eq DescribeAlarmsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool
$c/= :: DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool
== :: DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool
$c== :: DescribeAlarmsResponse -> DescribeAlarmsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAlarmsResponse]
ReadPrec DescribeAlarmsResponse
Int -> ReadS DescribeAlarmsResponse
ReadS [DescribeAlarmsResponse]
(Int -> ReadS DescribeAlarmsResponse)
-> ReadS [DescribeAlarmsResponse]
-> ReadPrec DescribeAlarmsResponse
-> ReadPrec [DescribeAlarmsResponse]
-> Read DescribeAlarmsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlarmsResponse]
$creadListPrec :: ReadPrec [DescribeAlarmsResponse]
readPrec :: ReadPrec DescribeAlarmsResponse
$creadPrec :: ReadPrec DescribeAlarmsResponse
readList :: ReadS [DescribeAlarmsResponse]
$creadList :: ReadS [DescribeAlarmsResponse]
readsPrec :: Int -> ReadS DescribeAlarmsResponse
$creadsPrec :: Int -> ReadS DescribeAlarmsResponse
Prelude.Read, Int -> DescribeAlarmsResponse -> ShowS
[DescribeAlarmsResponse] -> ShowS
DescribeAlarmsResponse -> String
(Int -> DescribeAlarmsResponse -> ShowS)
-> (DescribeAlarmsResponse -> String)
-> ([DescribeAlarmsResponse] -> ShowS)
-> Show DescribeAlarmsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlarmsResponse] -> ShowS
$cshowList :: [DescribeAlarmsResponse] -> ShowS
show :: DescribeAlarmsResponse -> String
$cshow :: DescribeAlarmsResponse -> String
showsPrec :: Int -> DescribeAlarmsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAlarmsResponse -> ShowS
Prelude.Show, (forall x. DescribeAlarmsResponse -> Rep DescribeAlarmsResponse x)
-> (forall x.
    Rep DescribeAlarmsResponse x -> DescribeAlarmsResponse)
-> Generic DescribeAlarmsResponse
forall x. Rep DescribeAlarmsResponse x -> DescribeAlarmsResponse
forall x. DescribeAlarmsResponse -> Rep DescribeAlarmsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlarmsResponse x -> DescribeAlarmsResponse
$cfrom :: forall x. DescribeAlarmsResponse -> Rep DescribeAlarmsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlarmsResponse' 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:
--
-- 'metricAlarms', 'describeAlarmsResponse_metricAlarms' - The information about any metric alarms returned by the operation.
--
-- 'compositeAlarms', 'describeAlarmsResponse_compositeAlarms' - The information about any composite alarms returned by the operation.
--
-- 'nextToken', 'describeAlarmsResponse_nextToken' - The token that marks the start of the next batch of returned results.
--
-- 'httpStatus', 'describeAlarmsResponse_httpStatus' - The response's http status code.
newDescribeAlarmsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAlarmsResponse
newDescribeAlarmsResponse :: Int -> DescribeAlarmsResponse
newDescribeAlarmsResponse Int
pHttpStatus_ =
  DescribeAlarmsResponse' :: Maybe [MetricAlarm]
-> Maybe [CompositeAlarm]
-> Maybe Text
-> Int
-> DescribeAlarmsResponse
DescribeAlarmsResponse'
    { $sel:metricAlarms:DescribeAlarmsResponse' :: Maybe [MetricAlarm]
metricAlarms =
        Maybe [MetricAlarm]
forall a. Maybe a
Prelude.Nothing,
      $sel:compositeAlarms:DescribeAlarmsResponse' :: Maybe [CompositeAlarm]
compositeAlarms = Maybe [CompositeAlarm]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAlarmsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAlarmsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The information about any metric alarms returned by the operation.
describeAlarmsResponse_metricAlarms :: Lens.Lens' DescribeAlarmsResponse (Prelude.Maybe [MetricAlarm])
describeAlarmsResponse_metricAlarms :: (Maybe [MetricAlarm] -> f (Maybe [MetricAlarm]))
-> DescribeAlarmsResponse -> f DescribeAlarmsResponse
describeAlarmsResponse_metricAlarms = (DescribeAlarmsResponse -> Maybe [MetricAlarm])
-> (DescribeAlarmsResponse
    -> Maybe [MetricAlarm] -> DescribeAlarmsResponse)
-> Lens' DescribeAlarmsResponse (Maybe [MetricAlarm])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsResponse' {Maybe [MetricAlarm]
metricAlarms :: Maybe [MetricAlarm]
$sel:metricAlarms:DescribeAlarmsResponse' :: DescribeAlarmsResponse -> Maybe [MetricAlarm]
metricAlarms} -> Maybe [MetricAlarm]
metricAlarms) (\s :: DescribeAlarmsResponse
s@DescribeAlarmsResponse' {} Maybe [MetricAlarm]
a -> DescribeAlarmsResponse
s {$sel:metricAlarms:DescribeAlarmsResponse' :: Maybe [MetricAlarm]
metricAlarms = Maybe [MetricAlarm]
a} :: DescribeAlarmsResponse) ((Maybe [MetricAlarm] -> f (Maybe [MetricAlarm]))
 -> DescribeAlarmsResponse -> f DescribeAlarmsResponse)
-> ((Maybe [MetricAlarm] -> f (Maybe [MetricAlarm]))
    -> Maybe [MetricAlarm] -> f (Maybe [MetricAlarm]))
-> (Maybe [MetricAlarm] -> f (Maybe [MetricAlarm]))
-> DescribeAlarmsResponse
-> f DescribeAlarmsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MetricAlarm] [MetricAlarm] [MetricAlarm] [MetricAlarm]
-> Iso
     (Maybe [MetricAlarm])
     (Maybe [MetricAlarm])
     (Maybe [MetricAlarm])
     (Maybe [MetricAlarm])
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 [MetricAlarm] [MetricAlarm] [MetricAlarm] [MetricAlarm]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The information about any composite alarms returned by the operation.
describeAlarmsResponse_compositeAlarms :: Lens.Lens' DescribeAlarmsResponse (Prelude.Maybe [CompositeAlarm])
describeAlarmsResponse_compositeAlarms :: (Maybe [CompositeAlarm] -> f (Maybe [CompositeAlarm]))
-> DescribeAlarmsResponse -> f DescribeAlarmsResponse
describeAlarmsResponse_compositeAlarms = (DescribeAlarmsResponse -> Maybe [CompositeAlarm])
-> (DescribeAlarmsResponse
    -> Maybe [CompositeAlarm] -> DescribeAlarmsResponse)
-> Lens' DescribeAlarmsResponse (Maybe [CompositeAlarm])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsResponse' {Maybe [CompositeAlarm]
compositeAlarms :: Maybe [CompositeAlarm]
$sel:compositeAlarms:DescribeAlarmsResponse' :: DescribeAlarmsResponse -> Maybe [CompositeAlarm]
compositeAlarms} -> Maybe [CompositeAlarm]
compositeAlarms) (\s :: DescribeAlarmsResponse
s@DescribeAlarmsResponse' {} Maybe [CompositeAlarm]
a -> DescribeAlarmsResponse
s {$sel:compositeAlarms:DescribeAlarmsResponse' :: Maybe [CompositeAlarm]
compositeAlarms = Maybe [CompositeAlarm]
a} :: DescribeAlarmsResponse) ((Maybe [CompositeAlarm] -> f (Maybe [CompositeAlarm]))
 -> DescribeAlarmsResponse -> f DescribeAlarmsResponse)
-> ((Maybe [CompositeAlarm] -> f (Maybe [CompositeAlarm]))
    -> Maybe [CompositeAlarm] -> f (Maybe [CompositeAlarm]))
-> (Maybe [CompositeAlarm] -> f (Maybe [CompositeAlarm]))
-> DescribeAlarmsResponse
-> f DescribeAlarmsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CompositeAlarm] [CompositeAlarm] [CompositeAlarm] [CompositeAlarm]
-> Iso
     (Maybe [CompositeAlarm])
     (Maybe [CompositeAlarm])
     (Maybe [CompositeAlarm])
     (Maybe [CompositeAlarm])
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
  [CompositeAlarm] [CompositeAlarm] [CompositeAlarm] [CompositeAlarm]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token that marks the start of the next batch of returned results.
describeAlarmsResponse_nextToken :: Lens.Lens' DescribeAlarmsResponse (Prelude.Maybe Prelude.Text)
describeAlarmsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAlarmsResponse -> f DescribeAlarmsResponse
describeAlarmsResponse_nextToken = (DescribeAlarmsResponse -> Maybe Text)
-> (DescribeAlarmsResponse -> Maybe Text -> DescribeAlarmsResponse)
-> Lens' DescribeAlarmsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAlarmsResponse' :: DescribeAlarmsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAlarmsResponse
s@DescribeAlarmsResponse' {} Maybe Text
a -> DescribeAlarmsResponse
s {$sel:nextToken:DescribeAlarmsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAlarmsResponse)

-- | The response's http status code.
describeAlarmsResponse_httpStatus :: Lens.Lens' DescribeAlarmsResponse Prelude.Int
describeAlarmsResponse_httpStatus :: (Int -> f Int)
-> DescribeAlarmsResponse -> f DescribeAlarmsResponse
describeAlarmsResponse_httpStatus = (DescribeAlarmsResponse -> Int)
-> (DescribeAlarmsResponse -> Int -> DescribeAlarmsResponse)
-> Lens DescribeAlarmsResponse DescribeAlarmsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAlarmsResponse' :: DescribeAlarmsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAlarmsResponse
s@DescribeAlarmsResponse' {} Int
a -> DescribeAlarmsResponse
s {$sel:httpStatus:DescribeAlarmsResponse' :: Int
httpStatus = Int
a} :: DescribeAlarmsResponse)

instance Prelude.NFData DescribeAlarmsResponse