{-# 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.DescribeAlarmsForMetric
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the alarms for the specified metric. To filter the results,
-- specify a statistic, period, or unit.
--
-- This operation retrieves only standard alarms that are based on the
-- specified metric. It does not return alarms based on math expressions
-- that use the specified metric, or composite alarms that use the
-- specified metric.
module Amazonka.CloudWatch.DescribeAlarmsForMetric
  ( -- * Creating a Request
    DescribeAlarmsForMetric (..),
    newDescribeAlarmsForMetric,

    -- * Request Lenses
    describeAlarmsForMetric_dimensions,
    describeAlarmsForMetric_extendedStatistic,
    describeAlarmsForMetric_period,
    describeAlarmsForMetric_statistic,
    describeAlarmsForMetric_unit,
    describeAlarmsForMetric_metricName,
    describeAlarmsForMetric_namespace,

    -- * Destructuring the Response
    DescribeAlarmsForMetricResponse (..),
    newDescribeAlarmsForMetricResponse,

    -- * Response Lenses
    describeAlarmsForMetricResponse_metricAlarms,
    describeAlarmsForMetricResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeAlarmsForMetric' smart constructor.
data DescribeAlarmsForMetric = DescribeAlarmsForMetric'
  { -- | The dimensions associated with the metric. If the metric has any
    -- associated dimensions, you must specify them in order for the call to
    -- succeed.
    DescribeAlarmsForMetric -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | The percentile statistic for the metric. Specify a value between p0.0
    -- and p100.
    DescribeAlarmsForMetric -> Maybe Text
extendedStatistic :: Prelude.Maybe Prelude.Text,
    -- | The period, in seconds, over which the statistic is applied.
    DescribeAlarmsForMetric -> Maybe Natural
period :: Prelude.Maybe Prelude.Natural,
    -- | The statistic for the metric, other than percentiles. For percentile
    -- statistics, use @ExtendedStatistics@.
    DescribeAlarmsForMetric -> Maybe Statistic
statistic :: Prelude.Maybe Statistic,
    -- | The unit for the metric.
    DescribeAlarmsForMetric -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
    -- | The name of the metric.
    DescribeAlarmsForMetric -> Text
metricName :: Prelude.Text,
    -- | The namespace of the metric.
    DescribeAlarmsForMetric -> Text
namespace :: Prelude.Text
  }
  deriving (DescribeAlarmsForMetric -> DescribeAlarmsForMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlarmsForMetric -> DescribeAlarmsForMetric -> Bool
$c/= :: DescribeAlarmsForMetric -> DescribeAlarmsForMetric -> Bool
== :: DescribeAlarmsForMetric -> DescribeAlarmsForMetric -> Bool
$c== :: DescribeAlarmsForMetric -> DescribeAlarmsForMetric -> Bool
Prelude.Eq, ReadPrec [DescribeAlarmsForMetric]
ReadPrec DescribeAlarmsForMetric
Int -> ReadS DescribeAlarmsForMetric
ReadS [DescribeAlarmsForMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlarmsForMetric]
$creadListPrec :: ReadPrec [DescribeAlarmsForMetric]
readPrec :: ReadPrec DescribeAlarmsForMetric
$creadPrec :: ReadPrec DescribeAlarmsForMetric
readList :: ReadS [DescribeAlarmsForMetric]
$creadList :: ReadS [DescribeAlarmsForMetric]
readsPrec :: Int -> ReadS DescribeAlarmsForMetric
$creadsPrec :: Int -> ReadS DescribeAlarmsForMetric
Prelude.Read, Int -> DescribeAlarmsForMetric -> ShowS
[DescribeAlarmsForMetric] -> ShowS
DescribeAlarmsForMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlarmsForMetric] -> ShowS
$cshowList :: [DescribeAlarmsForMetric] -> ShowS
show :: DescribeAlarmsForMetric -> String
$cshow :: DescribeAlarmsForMetric -> String
showsPrec :: Int -> DescribeAlarmsForMetric -> ShowS
$cshowsPrec :: Int -> DescribeAlarmsForMetric -> ShowS
Prelude.Show, forall x. Rep DescribeAlarmsForMetric x -> DescribeAlarmsForMetric
forall x. DescribeAlarmsForMetric -> Rep DescribeAlarmsForMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlarmsForMetric x -> DescribeAlarmsForMetric
$cfrom :: forall x. DescribeAlarmsForMetric -> Rep DescribeAlarmsForMetric x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlarmsForMetric' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'dimensions', 'describeAlarmsForMetric_dimensions' - The dimensions associated with the metric. If the metric has any
-- associated dimensions, you must specify them in order for the call to
-- succeed.
--
-- 'extendedStatistic', 'describeAlarmsForMetric_extendedStatistic' - The percentile statistic for the metric. Specify a value between p0.0
-- and p100.
--
-- 'period', 'describeAlarmsForMetric_period' - The period, in seconds, over which the statistic is applied.
--
-- 'statistic', 'describeAlarmsForMetric_statistic' - The statistic for the metric, other than percentiles. For percentile
-- statistics, use @ExtendedStatistics@.
--
-- 'unit', 'describeAlarmsForMetric_unit' - The unit for the metric.
--
-- 'metricName', 'describeAlarmsForMetric_metricName' - The name of the metric.
--
-- 'namespace', 'describeAlarmsForMetric_namespace' - The namespace of the metric.
newDescribeAlarmsForMetric ::
  -- | 'metricName'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  DescribeAlarmsForMetric
newDescribeAlarmsForMetric :: Text -> Text -> DescribeAlarmsForMetric
newDescribeAlarmsForMetric Text
pMetricName_ Text
pNamespace_ =
  DescribeAlarmsForMetric'
    { $sel:dimensions:DescribeAlarmsForMetric' :: Maybe [Dimension]
dimensions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:extendedStatistic:DescribeAlarmsForMetric' :: Maybe Text
extendedStatistic = forall a. Maybe a
Prelude.Nothing,
      $sel:period:DescribeAlarmsForMetric' :: Maybe Natural
period = forall a. Maybe a
Prelude.Nothing,
      $sel:statistic:DescribeAlarmsForMetric' :: Maybe Statistic
statistic = forall a. Maybe a
Prelude.Nothing,
      $sel:unit:DescribeAlarmsForMetric' :: Maybe StandardUnit
unit = forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:DescribeAlarmsForMetric' :: Text
metricName = Text
pMetricName_,
      $sel:namespace:DescribeAlarmsForMetric' :: Text
namespace = Text
pNamespace_
    }

-- | The dimensions associated with the metric. If the metric has any
-- associated dimensions, you must specify them in order for the call to
-- succeed.
describeAlarmsForMetric_dimensions :: Lens.Lens' DescribeAlarmsForMetric (Prelude.Maybe [Dimension])
describeAlarmsForMetric_dimensions :: Lens' DescribeAlarmsForMetric (Maybe [Dimension])
describeAlarmsForMetric_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Maybe [Dimension]
a -> DescribeAlarmsForMetric
s {$sel:dimensions:DescribeAlarmsForMetric' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: DescribeAlarmsForMetric) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The percentile statistic for the metric. Specify a value between p0.0
-- and p100.
describeAlarmsForMetric_extendedStatistic :: Lens.Lens' DescribeAlarmsForMetric (Prelude.Maybe Prelude.Text)
describeAlarmsForMetric_extendedStatistic :: Lens' DescribeAlarmsForMetric (Maybe Text)
describeAlarmsForMetric_extendedStatistic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Maybe Text
extendedStatistic :: Maybe Text
$sel:extendedStatistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Text
extendedStatistic} -> Maybe Text
extendedStatistic) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Maybe Text
a -> DescribeAlarmsForMetric
s {$sel:extendedStatistic:DescribeAlarmsForMetric' :: Maybe Text
extendedStatistic = Maybe Text
a} :: DescribeAlarmsForMetric)

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

-- | The statistic for the metric, other than percentiles. For percentile
-- statistics, use @ExtendedStatistics@.
describeAlarmsForMetric_statistic :: Lens.Lens' DescribeAlarmsForMetric (Prelude.Maybe Statistic)
describeAlarmsForMetric_statistic :: Lens' DescribeAlarmsForMetric (Maybe Statistic)
describeAlarmsForMetric_statistic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Maybe Statistic
statistic :: Maybe Statistic
$sel:statistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Statistic
statistic} -> Maybe Statistic
statistic) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Maybe Statistic
a -> DescribeAlarmsForMetric
s {$sel:statistic:DescribeAlarmsForMetric' :: Maybe Statistic
statistic = Maybe Statistic
a} :: DescribeAlarmsForMetric)

-- | The unit for the metric.
describeAlarmsForMetric_unit :: Lens.Lens' DescribeAlarmsForMetric (Prelude.Maybe StandardUnit)
describeAlarmsForMetric_unit :: Lens' DescribeAlarmsForMetric (Maybe StandardUnit)
describeAlarmsForMetric_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Maybe StandardUnit
a -> DescribeAlarmsForMetric
s {$sel:unit:DescribeAlarmsForMetric' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: DescribeAlarmsForMetric)

-- | The name of the metric.
describeAlarmsForMetric_metricName :: Lens.Lens' DescribeAlarmsForMetric Prelude.Text
describeAlarmsForMetric_metricName :: Lens' DescribeAlarmsForMetric Text
describeAlarmsForMetric_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Text
metricName :: Text
$sel:metricName:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
metricName} -> Text
metricName) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Text
a -> DescribeAlarmsForMetric
s {$sel:metricName:DescribeAlarmsForMetric' :: Text
metricName = Text
a} :: DescribeAlarmsForMetric)

-- | The namespace of the metric.
describeAlarmsForMetric_namespace :: Lens.Lens' DescribeAlarmsForMetric Prelude.Text
describeAlarmsForMetric_namespace :: Lens' DescribeAlarmsForMetric Text
describeAlarmsForMetric_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetric' {Text
namespace :: Text
$sel:namespace:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
namespace} -> Text
namespace) (\s :: DescribeAlarmsForMetric
s@DescribeAlarmsForMetric' {} Text
a -> DescribeAlarmsForMetric
s {$sel:namespace:DescribeAlarmsForMetric' :: Text
namespace = Text
a} :: DescribeAlarmsForMetric)

instance Core.AWSRequest DescribeAlarmsForMetric where
  type
    AWSResponse DescribeAlarmsForMetric =
      DescribeAlarmsForMetricResponse
  request :: (Service -> Service)
-> DescribeAlarmsForMetric -> Request DescribeAlarmsForMetric
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeAlarmsForMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAlarmsForMetric)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeAlarmsForMetricResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [MetricAlarm] -> Int -> DescribeAlarmsForMetricResponse
DescribeAlarmsForMetricResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MetricAlarms"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeAlarmsForMetric where
  hashWithSalt :: Int -> DescribeAlarmsForMetric -> Int
hashWithSalt Int
_salt DescribeAlarmsForMetric' {Maybe Natural
Maybe [Dimension]
Maybe Text
Maybe StandardUnit
Maybe Statistic
Text
namespace :: Text
metricName :: Text
unit :: Maybe StandardUnit
statistic :: Maybe Statistic
period :: Maybe Natural
extendedStatistic :: Maybe Text
dimensions :: Maybe [Dimension]
$sel:namespace:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:metricName:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:unit:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe StandardUnit
$sel:statistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Statistic
$sel:period:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Natural
$sel:extendedStatistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Text
$sel:dimensions:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe [Dimension]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Dimension]
dimensions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
extendedStatistic
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
period
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Statistic
statistic
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StandardUnit
unit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
namespace

instance Prelude.NFData DescribeAlarmsForMetric where
  rnf :: DescribeAlarmsForMetric -> ()
rnf DescribeAlarmsForMetric' {Maybe Natural
Maybe [Dimension]
Maybe Text
Maybe StandardUnit
Maybe Statistic
Text
namespace :: Text
metricName :: Text
unit :: Maybe StandardUnit
statistic :: Maybe Statistic
period :: Maybe Natural
extendedStatistic :: Maybe Text
dimensions :: Maybe [Dimension]
$sel:namespace:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:metricName:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:unit:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe StandardUnit
$sel:statistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Statistic
$sel:period:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Natural
$sel:extendedStatistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Text
$sel:dimensions:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe [Dimension]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Dimension]
dimensions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
extendedStatistic
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
period
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Statistic
statistic
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StandardUnit
unit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
metricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
namespace

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

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

instance Data.ToQuery DescribeAlarmsForMetric where
  toQuery :: DescribeAlarmsForMetric -> QueryString
toQuery DescribeAlarmsForMetric' {Maybe Natural
Maybe [Dimension]
Maybe Text
Maybe StandardUnit
Maybe Statistic
Text
namespace :: Text
metricName :: Text
unit :: Maybe StandardUnit
statistic :: Maybe Statistic
period :: Maybe Natural
extendedStatistic :: Maybe Text
dimensions :: Maybe [Dimension]
$sel:namespace:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:metricName:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Text
$sel:unit:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe StandardUnit
$sel:statistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Statistic
$sel:period:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Natural
$sel:extendedStatistic:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe Text
$sel:dimensions:DescribeAlarmsForMetric' :: DescribeAlarmsForMetric -> Maybe [Dimension]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeAlarmsForMetric" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"Dimensions"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
        ByteString
"ExtendedStatistic" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
extendedStatistic,
        ByteString
"Period" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
period,
        ByteString
"Statistic" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Statistic
statistic,
        ByteString
"Unit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe StandardUnit
unit,
        ByteString
"MetricName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
metricName,
        ByteString
"Namespace" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
namespace
      ]

-- | /See:/ 'newDescribeAlarmsForMetricResponse' smart constructor.
data DescribeAlarmsForMetricResponse = DescribeAlarmsForMetricResponse'
  { -- | The information for each alarm with the specified metric.
    DescribeAlarmsForMetricResponse -> Maybe [MetricAlarm]
metricAlarms :: Prelude.Maybe [MetricAlarm],
    -- | The response's http status code.
    DescribeAlarmsForMetricResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAlarmsForMetricResponse
-> DescribeAlarmsForMetricResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlarmsForMetricResponse
-> DescribeAlarmsForMetricResponse -> Bool
$c/= :: DescribeAlarmsForMetricResponse
-> DescribeAlarmsForMetricResponse -> Bool
== :: DescribeAlarmsForMetricResponse
-> DescribeAlarmsForMetricResponse -> Bool
$c== :: DescribeAlarmsForMetricResponse
-> DescribeAlarmsForMetricResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAlarmsForMetricResponse]
ReadPrec DescribeAlarmsForMetricResponse
Int -> ReadS DescribeAlarmsForMetricResponse
ReadS [DescribeAlarmsForMetricResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlarmsForMetricResponse]
$creadListPrec :: ReadPrec [DescribeAlarmsForMetricResponse]
readPrec :: ReadPrec DescribeAlarmsForMetricResponse
$creadPrec :: ReadPrec DescribeAlarmsForMetricResponse
readList :: ReadS [DescribeAlarmsForMetricResponse]
$creadList :: ReadS [DescribeAlarmsForMetricResponse]
readsPrec :: Int -> ReadS DescribeAlarmsForMetricResponse
$creadsPrec :: Int -> ReadS DescribeAlarmsForMetricResponse
Prelude.Read, Int -> DescribeAlarmsForMetricResponse -> ShowS
[DescribeAlarmsForMetricResponse] -> ShowS
DescribeAlarmsForMetricResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlarmsForMetricResponse] -> ShowS
$cshowList :: [DescribeAlarmsForMetricResponse] -> ShowS
show :: DescribeAlarmsForMetricResponse -> String
$cshow :: DescribeAlarmsForMetricResponse -> String
showsPrec :: Int -> DescribeAlarmsForMetricResponse -> ShowS
$cshowsPrec :: Int -> DescribeAlarmsForMetricResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeAlarmsForMetricResponse x
-> DescribeAlarmsForMetricResponse
forall x.
DescribeAlarmsForMetricResponse
-> Rep DescribeAlarmsForMetricResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAlarmsForMetricResponse x
-> DescribeAlarmsForMetricResponse
$cfrom :: forall x.
DescribeAlarmsForMetricResponse
-> Rep DescribeAlarmsForMetricResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlarmsForMetricResponse' 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', 'describeAlarmsForMetricResponse_metricAlarms' - The information for each alarm with the specified metric.
--
-- 'httpStatus', 'describeAlarmsForMetricResponse_httpStatus' - The response's http status code.
newDescribeAlarmsForMetricResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAlarmsForMetricResponse
newDescribeAlarmsForMetricResponse :: Int -> DescribeAlarmsForMetricResponse
newDescribeAlarmsForMetricResponse Int
pHttpStatus_ =
  DescribeAlarmsForMetricResponse'
    { $sel:metricAlarms:DescribeAlarmsForMetricResponse' :: Maybe [MetricAlarm]
metricAlarms =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAlarmsForMetricResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The information for each alarm with the specified metric.
describeAlarmsForMetricResponse_metricAlarms :: Lens.Lens' DescribeAlarmsForMetricResponse (Prelude.Maybe [MetricAlarm])
describeAlarmsForMetricResponse_metricAlarms :: Lens' DescribeAlarmsForMetricResponse (Maybe [MetricAlarm])
describeAlarmsForMetricResponse_metricAlarms = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlarmsForMetricResponse' {Maybe [MetricAlarm]
metricAlarms :: Maybe [MetricAlarm]
$sel:metricAlarms:DescribeAlarmsForMetricResponse' :: DescribeAlarmsForMetricResponse -> Maybe [MetricAlarm]
metricAlarms} -> Maybe [MetricAlarm]
metricAlarms) (\s :: DescribeAlarmsForMetricResponse
s@DescribeAlarmsForMetricResponse' {} Maybe [MetricAlarm]
a -> DescribeAlarmsForMetricResponse
s {$sel:metricAlarms:DescribeAlarmsForMetricResponse' :: Maybe [MetricAlarm]
metricAlarms = Maybe [MetricAlarm]
a} :: DescribeAlarmsForMetricResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAlarmsForMetricResponse
  where
  rnf :: DescribeAlarmsForMetricResponse -> ()
rnf DescribeAlarmsForMetricResponse' {Int
Maybe [MetricAlarm]
httpStatus :: Int
metricAlarms :: Maybe [MetricAlarm]
$sel:httpStatus:DescribeAlarmsForMetricResponse' :: DescribeAlarmsForMetricResponse -> Int
$sel:metricAlarms:DescribeAlarmsForMetricResponse' :: DescribeAlarmsForMetricResponse -> Maybe [MetricAlarm]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricAlarm]
metricAlarms
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus