{-# 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.GetMetricStatistics
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets statistics for the specified metric.
--
-- The maximum number of data points returned from a single call is 1,440.
-- If you request more than 1,440 data points, CloudWatch returns an error.
-- To reduce the number of data points, you can narrow the specified time
-- range and make multiple requests across adjacent time ranges, or you can
-- increase the specified period. Data points are not returned in
-- chronological order.
--
-- CloudWatch aggregates data points based on the length of the period that
-- you specify. For example, if you request statistics with a one-hour
-- period, CloudWatch aggregates all data points with time stamps that fall
-- within each one-hour period. Therefore, the number of values aggregated
-- by CloudWatch is larger than the number of data points returned.
--
-- CloudWatch needs raw data points to calculate percentile statistics. If
-- you publish data using a statistic set instead, you can only retrieve
-- percentile statistics for this data if one of the following conditions
-- is true:
--
-- -   The SampleCount value of the statistic set is 1.
--
-- -   The Min and the Max values of the statistic set are equal.
--
-- Percentile statistics are not available for metrics when any of the
-- metric values are negative numbers.
--
-- Amazon CloudWatch retains metric data as follows:
--
-- -   Data points with a period of less than 60 seconds are available for
--     3 hours. These data points are high-resolution metrics and are
--     available only for custom metrics that have been defined with a
--     @StorageResolution@ of 1.
--
-- -   Data points with a period of 60 seconds (1-minute) are available for
--     15 days.
--
-- -   Data points with a period of 300 seconds (5-minute) are available
--     for 63 days.
--
-- -   Data points with a period of 3600 seconds (1 hour) are available for
--     455 days (15 months).
--
-- Data points that are initially published with a shorter period are
-- aggregated together for long-term storage. For example, if you collect
-- data using a period of 1 minute, the data remains available for 15 days
-- with 1-minute resolution. After 15 days, this data is still available,
-- but is aggregated and retrievable only with a resolution of 5 minutes.
-- After 63 days, the data is further aggregated and is available with a
-- resolution of 1 hour.
--
-- CloudWatch started retaining 5-minute and 1-hour metric data as of July
-- 9, 2016.
--
-- For information about metrics and dimensions supported by Amazon Web
-- Services services, see the
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html Amazon CloudWatch Metrics and Dimensions Reference>
-- in the /Amazon CloudWatch User Guide/.
module Amazonka.CloudWatch.GetMetricStatistics
  ( -- * Creating a Request
    GetMetricStatistics (..),
    newGetMetricStatistics,

    -- * Request Lenses
    getMetricStatistics_dimensions,
    getMetricStatistics_extendedStatistics,
    getMetricStatistics_statistics,
    getMetricStatistics_unit,
    getMetricStatistics_namespace,
    getMetricStatistics_metricName,
    getMetricStatistics_startTime,
    getMetricStatistics_endTime,
    getMetricStatistics_period,

    -- * Destructuring the Response
    GetMetricStatisticsResponse (..),
    newGetMetricStatisticsResponse,

    -- * Response Lenses
    getMetricStatisticsResponse_datapoints,
    getMetricStatisticsResponse_label,
    getMetricStatisticsResponse_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:/ 'newGetMetricStatistics' smart constructor.
data GetMetricStatistics = GetMetricStatistics'
  { -- | The dimensions. If the metric contains multiple dimensions, you must
    -- include a value for each dimension. CloudWatch treats each unique
    -- combination of dimensions as a separate metric. If a specific
    -- combination of dimensions was not published, you can\'t retrieve
    -- statistics for it. You must specify the same dimensions that were used
    -- when the metrics were created. For an example, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations Dimension Combinations>
    -- in the /Amazon CloudWatch User Guide/. For more information about
    -- specifying dimensions, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html Publishing Metrics>
    -- in the /Amazon CloudWatch User Guide/.
    GetMetricStatistics -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | The percentile statistics. Specify values between p0.0 and p100. When
    -- calling @GetMetricStatistics@, you must specify either @Statistics@ or
    -- @ExtendedStatistics@, but not both. Percentile statistics are not
    -- available for metrics when any of the metric values are negative
    -- numbers.
    GetMetricStatistics -> Maybe (NonEmpty Text)
extendedStatistics :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The metric statistics, other than percentile. For percentile statistics,
    -- use @ExtendedStatistics@. When calling @GetMetricStatistics@, you must
    -- specify either @Statistics@ or @ExtendedStatistics@, but not both.
    GetMetricStatistics -> Maybe (NonEmpty Statistic)
statistics :: Prelude.Maybe (Prelude.NonEmpty Statistic),
    -- | The unit for a given metric. If you omit @Unit@, all data that was
    -- collected with any unit is returned, along with the corresponding units
    -- that were specified when the data was reported to CloudWatch. If you
    -- specify a unit, the operation returns only data that was collected with
    -- that unit specified. If you specify a unit that does not match the data
    -- collected, the results of the operation are null. CloudWatch does not
    -- perform unit conversions.
    GetMetricStatistics -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
    -- | The namespace of the metric, with or without spaces.
    GetMetricStatistics -> Text
namespace :: Prelude.Text,
    -- | The name of the metric, with or without spaces.
    GetMetricStatistics -> Text
metricName :: Prelude.Text,
    -- | The time stamp that determines the first data point to return. Start
    -- times are evaluated relative to the time that CloudWatch receives the
    -- request.
    --
    -- The value specified is inclusive; results include data points with the
    -- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
    -- 8601 UTC format (for example, 2016-10-03T23:00:00Z).
    --
    -- CloudWatch rounds the specified time stamp as follows:
    --
    -- -   Start time less than 15 days ago - Round down to the nearest whole
    --     minute. For example, 12:32:34 is rounded down to 12:32:00.
    --
    -- -   Start time between 15 and 63 days ago - Round down to the nearest
    --     5-minute clock interval. For example, 12:32:34 is rounded down to
    --     12:30:00.
    --
    -- -   Start time greater than 63 days ago - Round down to the nearest
    --     1-hour clock interval. For example, 12:32:34 is rounded down to
    --     12:00:00.
    --
    -- If you set @Period@ to 5, 10, or 30, the start time of your request is
    -- rounded down to the nearest time that corresponds to even 5-, 10-, or
    -- 30-second divisions of a minute. For example, if you make a query at
    -- (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of
    -- your request is rounded down and you receive data from 01:05:10 to
    -- 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of
    -- data, using a period of 5 seconds, you receive data timestamped between
    -- 15:02:15 and 15:07:15.
    GetMetricStatistics -> ISO8601
startTime :: Data.ISO8601,
    -- | The time stamp that determines the last data point to return.
    --
    -- The value specified is exclusive; results include data points up to the
    -- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
    -- 8601 UTC format (for example, 2016-10-10T23:00:00Z).
    GetMetricStatistics -> ISO8601
endTime :: Data.ISO8601,
    -- | The granularity, in seconds, of the returned data points. For metrics
    -- with regular resolution, a period can be as short as one minute (60
    -- seconds) and must be a multiple of 60. For high-resolution metrics that
    -- are collected at intervals of less than one minute, the period can be 1,
    -- 5, 10, 30, 60, or any multiple of 60. High-resolution metrics are those
    -- metrics stored by a @PutMetricData@ call that includes a
    -- @StorageResolution@ of 1 second.
    --
    -- If the @StartTime@ parameter specifies a time stamp that is greater than
    -- 3 hours ago, you must specify the period as follows or no data points in
    -- that time range is returned:
    --
    -- -   Start time between 3 hours and 15 days ago - Use a multiple of 60
    --     seconds (1 minute).
    --
    -- -   Start time between 15 and 63 days ago - Use a multiple of 300
    --     seconds (5 minutes).
    --
    -- -   Start time greater than 63 days ago - Use a multiple of 3600 seconds
    --     (1 hour).
    GetMetricStatistics -> Natural
period :: Prelude.Natural
  }
  deriving (GetMetricStatistics -> GetMetricStatistics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricStatistics -> GetMetricStatistics -> Bool
$c/= :: GetMetricStatistics -> GetMetricStatistics -> Bool
== :: GetMetricStatistics -> GetMetricStatistics -> Bool
$c== :: GetMetricStatistics -> GetMetricStatistics -> Bool
Prelude.Eq, ReadPrec [GetMetricStatistics]
ReadPrec GetMetricStatistics
Int -> ReadS GetMetricStatistics
ReadS [GetMetricStatistics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricStatistics]
$creadListPrec :: ReadPrec [GetMetricStatistics]
readPrec :: ReadPrec GetMetricStatistics
$creadPrec :: ReadPrec GetMetricStatistics
readList :: ReadS [GetMetricStatistics]
$creadList :: ReadS [GetMetricStatistics]
readsPrec :: Int -> ReadS GetMetricStatistics
$creadsPrec :: Int -> ReadS GetMetricStatistics
Prelude.Read, Int -> GetMetricStatistics -> ShowS
[GetMetricStatistics] -> ShowS
GetMetricStatistics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricStatistics] -> ShowS
$cshowList :: [GetMetricStatistics] -> ShowS
show :: GetMetricStatistics -> String
$cshow :: GetMetricStatistics -> String
showsPrec :: Int -> GetMetricStatistics -> ShowS
$cshowsPrec :: Int -> GetMetricStatistics -> ShowS
Prelude.Show, forall x. Rep GetMetricStatistics x -> GetMetricStatistics
forall x. GetMetricStatistics -> Rep GetMetricStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricStatistics x -> GetMetricStatistics
$cfrom :: forall x. GetMetricStatistics -> Rep GetMetricStatistics x
Prelude.Generic)

-- |
-- Create a value of 'GetMetricStatistics' 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', 'getMetricStatistics_dimensions' - The dimensions. If the metric contains multiple dimensions, you must
-- include a value for each dimension. CloudWatch treats each unique
-- combination of dimensions as a separate metric. If a specific
-- combination of dimensions was not published, you can\'t retrieve
-- statistics for it. You must specify the same dimensions that were used
-- when the metrics were created. For an example, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations Dimension Combinations>
-- in the /Amazon CloudWatch User Guide/. For more information about
-- specifying dimensions, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html Publishing Metrics>
-- in the /Amazon CloudWatch User Guide/.
--
-- 'extendedStatistics', 'getMetricStatistics_extendedStatistics' - The percentile statistics. Specify values between p0.0 and p100. When
-- calling @GetMetricStatistics@, you must specify either @Statistics@ or
-- @ExtendedStatistics@, but not both. Percentile statistics are not
-- available for metrics when any of the metric values are negative
-- numbers.
--
-- 'statistics', 'getMetricStatistics_statistics' - The metric statistics, other than percentile. For percentile statistics,
-- use @ExtendedStatistics@. When calling @GetMetricStatistics@, you must
-- specify either @Statistics@ or @ExtendedStatistics@, but not both.
--
-- 'unit', 'getMetricStatistics_unit' - The unit for a given metric. If you omit @Unit@, all data that was
-- collected with any unit is returned, along with the corresponding units
-- that were specified when the data was reported to CloudWatch. If you
-- specify a unit, the operation returns only data that was collected with
-- that unit specified. If you specify a unit that does not match the data
-- collected, the results of the operation are null. CloudWatch does not
-- perform unit conversions.
--
-- 'namespace', 'getMetricStatistics_namespace' - The namespace of the metric, with or without spaces.
--
-- 'metricName', 'getMetricStatistics_metricName' - The name of the metric, with or without spaces.
--
-- 'startTime', 'getMetricStatistics_startTime' - The time stamp that determines the first data point to return. Start
-- times are evaluated relative to the time that CloudWatch receives the
-- request.
--
-- The value specified is inclusive; results include data points with the
-- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
-- 8601 UTC format (for example, 2016-10-03T23:00:00Z).
--
-- CloudWatch rounds the specified time stamp as follows:
--
-- -   Start time less than 15 days ago - Round down to the nearest whole
--     minute. For example, 12:32:34 is rounded down to 12:32:00.
--
-- -   Start time between 15 and 63 days ago - Round down to the nearest
--     5-minute clock interval. For example, 12:32:34 is rounded down to
--     12:30:00.
--
-- -   Start time greater than 63 days ago - Round down to the nearest
--     1-hour clock interval. For example, 12:32:34 is rounded down to
--     12:00:00.
--
-- If you set @Period@ to 5, 10, or 30, the start time of your request is
-- rounded down to the nearest time that corresponds to even 5-, 10-, or
-- 30-second divisions of a minute. For example, if you make a query at
-- (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of
-- your request is rounded down and you receive data from 01:05:10 to
-- 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of
-- data, using a period of 5 seconds, you receive data timestamped between
-- 15:02:15 and 15:07:15.
--
-- 'endTime', 'getMetricStatistics_endTime' - The time stamp that determines the last data point to return.
--
-- The value specified is exclusive; results include data points up to the
-- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
-- 8601 UTC format (for example, 2016-10-10T23:00:00Z).
--
-- 'period', 'getMetricStatistics_period' - The granularity, in seconds, of the returned data points. For metrics
-- with regular resolution, a period can be as short as one minute (60
-- seconds) and must be a multiple of 60. For high-resolution metrics that
-- are collected at intervals of less than one minute, the period can be 1,
-- 5, 10, 30, 60, or any multiple of 60. High-resolution metrics are those
-- metrics stored by a @PutMetricData@ call that includes a
-- @StorageResolution@ of 1 second.
--
-- If the @StartTime@ parameter specifies a time stamp that is greater than
-- 3 hours ago, you must specify the period as follows or no data points in
-- that time range is returned:
--
-- -   Start time between 3 hours and 15 days ago - Use a multiple of 60
--     seconds (1 minute).
--
-- -   Start time between 15 and 63 days ago - Use a multiple of 300
--     seconds (5 minutes).
--
-- -   Start time greater than 63 days ago - Use a multiple of 3600 seconds
--     (1 hour).
newGetMetricStatistics ::
  -- | 'namespace'
  Prelude.Text ->
  -- | 'metricName'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'period'
  Prelude.Natural ->
  GetMetricStatistics
newGetMetricStatistics :: Text
-> Text -> UTCTime -> UTCTime -> Natural -> GetMetricStatistics
newGetMetricStatistics
  Text
pNamespace_
  Text
pMetricName_
  UTCTime
pStartTime_
  UTCTime
pEndTime_
  Natural
pPeriod_ =
    GetMetricStatistics'
      { $sel:dimensions:GetMetricStatistics' :: Maybe [Dimension]
dimensions = forall a. Maybe a
Prelude.Nothing,
        $sel:extendedStatistics:GetMetricStatistics' :: Maybe (NonEmpty Text)
extendedStatistics = forall a. Maybe a
Prelude.Nothing,
        $sel:statistics:GetMetricStatistics' :: Maybe (NonEmpty Statistic)
statistics = forall a. Maybe a
Prelude.Nothing,
        $sel:unit:GetMetricStatistics' :: Maybe StandardUnit
unit = forall a. Maybe a
Prelude.Nothing,
        $sel:namespace:GetMetricStatistics' :: Text
namespace = Text
pNamespace_,
        $sel:metricName:GetMetricStatistics' :: Text
metricName = Text
pMetricName_,
        $sel:startTime:GetMetricStatistics' :: ISO8601
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:endTime:GetMetricStatistics' :: ISO8601
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
        $sel:period:GetMetricStatistics' :: Natural
period = Natural
pPeriod_
      }

-- | The dimensions. If the metric contains multiple dimensions, you must
-- include a value for each dimension. CloudWatch treats each unique
-- combination of dimensions as a separate metric. If a specific
-- combination of dimensions was not published, you can\'t retrieve
-- statistics for it. You must specify the same dimensions that were used
-- when the metrics were created. For an example, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations Dimension Combinations>
-- in the /Amazon CloudWatch User Guide/. For more information about
-- specifying dimensions, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html Publishing Metrics>
-- in the /Amazon CloudWatch User Guide/.
getMetricStatistics_dimensions :: Lens.Lens' GetMetricStatistics (Prelude.Maybe [Dimension])
getMetricStatistics_dimensions :: Lens' GetMetricStatistics (Maybe [Dimension])
getMetricStatistics_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe [Dimension]
a -> GetMetricStatistics
s {$sel:dimensions:GetMetricStatistics' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: GetMetricStatistics) 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 statistics. Specify values between p0.0 and p100. When
-- calling @GetMetricStatistics@, you must specify either @Statistics@ or
-- @ExtendedStatistics@, but not both. Percentile statistics are not
-- available for metrics when any of the metric values are negative
-- numbers.
getMetricStatistics_extendedStatistics :: Lens.Lens' GetMetricStatistics (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
getMetricStatistics_extendedStatistics :: Lens' GetMetricStatistics (Maybe (NonEmpty Text))
getMetricStatistics_extendedStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe (NonEmpty Text)
extendedStatistics :: Maybe (NonEmpty Text)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Text)
extendedStatistics} -> Maybe (NonEmpty Text)
extendedStatistics) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe (NonEmpty Text)
a -> GetMetricStatistics
s {$sel:extendedStatistics:GetMetricStatistics' :: Maybe (NonEmpty Text)
extendedStatistics = Maybe (NonEmpty Text)
a} :: GetMetricStatistics) 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 metric statistics, other than percentile. For percentile statistics,
-- use @ExtendedStatistics@. When calling @GetMetricStatistics@, you must
-- specify either @Statistics@ or @ExtendedStatistics@, but not both.
getMetricStatistics_statistics :: Lens.Lens' GetMetricStatistics (Prelude.Maybe (Prelude.NonEmpty Statistic))
getMetricStatistics_statistics :: Lens' GetMetricStatistics (Maybe (NonEmpty Statistic))
getMetricStatistics_statistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe (NonEmpty Statistic)
statistics :: Maybe (NonEmpty Statistic)
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
statistics} -> Maybe (NonEmpty Statistic)
statistics) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe (NonEmpty Statistic)
a -> GetMetricStatistics
s {$sel:statistics:GetMetricStatistics' :: Maybe (NonEmpty Statistic)
statistics = Maybe (NonEmpty Statistic)
a} :: GetMetricStatistics) 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 unit for a given metric. If you omit @Unit@, all data that was
-- collected with any unit is returned, along with the corresponding units
-- that were specified when the data was reported to CloudWatch. If you
-- specify a unit, the operation returns only data that was collected with
-- that unit specified. If you specify a unit that does not match the data
-- collected, the results of the operation are null. CloudWatch does not
-- perform unit conversions.
getMetricStatistics_unit :: Lens.Lens' GetMetricStatistics (Prelude.Maybe StandardUnit)
getMetricStatistics_unit :: Lens' GetMetricStatistics (Maybe StandardUnit)
getMetricStatistics_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe StandardUnit
a -> GetMetricStatistics
s {$sel:unit:GetMetricStatistics' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: GetMetricStatistics)

-- | The namespace of the metric, with or without spaces.
getMetricStatistics_namespace :: Lens.Lens' GetMetricStatistics Prelude.Text
getMetricStatistics_namespace :: Lens' GetMetricStatistics Text
getMetricStatistics_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Text
namespace :: Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
namespace} -> Text
namespace) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Text
a -> GetMetricStatistics
s {$sel:namespace:GetMetricStatistics' :: Text
namespace = Text
a} :: GetMetricStatistics)

-- | The name of the metric, with or without spaces.
getMetricStatistics_metricName :: Lens.Lens' GetMetricStatistics Prelude.Text
getMetricStatistics_metricName :: Lens' GetMetricStatistics Text
getMetricStatistics_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Text
metricName :: Text
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
metricName} -> Text
metricName) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Text
a -> GetMetricStatistics
s {$sel:metricName:GetMetricStatistics' :: Text
metricName = Text
a} :: GetMetricStatistics)

-- | The time stamp that determines the first data point to return. Start
-- times are evaluated relative to the time that CloudWatch receives the
-- request.
--
-- The value specified is inclusive; results include data points with the
-- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
-- 8601 UTC format (for example, 2016-10-03T23:00:00Z).
--
-- CloudWatch rounds the specified time stamp as follows:
--
-- -   Start time less than 15 days ago - Round down to the nearest whole
--     minute. For example, 12:32:34 is rounded down to 12:32:00.
--
-- -   Start time between 15 and 63 days ago - Round down to the nearest
--     5-minute clock interval. For example, 12:32:34 is rounded down to
--     12:30:00.
--
-- -   Start time greater than 63 days ago - Round down to the nearest
--     1-hour clock interval. For example, 12:32:34 is rounded down to
--     12:00:00.
--
-- If you set @Period@ to 5, 10, or 30, the start time of your request is
-- rounded down to the nearest time that corresponds to even 5-, 10-, or
-- 30-second divisions of a minute. For example, if you make a query at
-- (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of
-- your request is rounded down and you receive data from 01:05:10 to
-- 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of
-- data, using a period of 5 seconds, you receive data timestamped between
-- 15:02:15 and 15:07:15.
getMetricStatistics_startTime :: Lens.Lens' GetMetricStatistics Prelude.UTCTime
getMetricStatistics_startTime :: Lens' GetMetricStatistics UTCTime
getMetricStatistics_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {ISO8601
startTime :: ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
startTime} -> ISO8601
startTime) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} ISO8601
a -> GetMetricStatistics
s {$sel:startTime:GetMetricStatistics' :: ISO8601
startTime = ISO8601
a} :: GetMetricStatistics) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time stamp that determines the last data point to return.
--
-- The value specified is exclusive; results include data points up to the
-- specified time stamp. In a raw HTTP query, the time stamp must be in ISO
-- 8601 UTC format (for example, 2016-10-10T23:00:00Z).
getMetricStatistics_endTime :: Lens.Lens' GetMetricStatistics Prelude.UTCTime
getMetricStatistics_endTime :: Lens' GetMetricStatistics UTCTime
getMetricStatistics_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {ISO8601
endTime :: ISO8601
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
endTime} -> ISO8601
endTime) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} ISO8601
a -> GetMetricStatistics
s {$sel:endTime:GetMetricStatistics' :: ISO8601
endTime = ISO8601
a} :: GetMetricStatistics) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The granularity, in seconds, of the returned data points. For metrics
-- with regular resolution, a period can be as short as one minute (60
-- seconds) and must be a multiple of 60. For high-resolution metrics that
-- are collected at intervals of less than one minute, the period can be 1,
-- 5, 10, 30, 60, or any multiple of 60. High-resolution metrics are those
-- metrics stored by a @PutMetricData@ call that includes a
-- @StorageResolution@ of 1 second.
--
-- If the @StartTime@ parameter specifies a time stamp that is greater than
-- 3 hours ago, you must specify the period as follows or no data points in
-- that time range is returned:
--
-- -   Start time between 3 hours and 15 days ago - Use a multiple of 60
--     seconds (1 minute).
--
-- -   Start time between 15 and 63 days ago - Use a multiple of 300
--     seconds (5 minutes).
--
-- -   Start time greater than 63 days ago - Use a multiple of 3600 seconds
--     (1 hour).
getMetricStatistics_period :: Lens.Lens' GetMetricStatistics Prelude.Natural
getMetricStatistics_period :: Lens' GetMetricStatistics Natural
getMetricStatistics_period = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Natural
period :: Natural
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
period} -> Natural
period) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Natural
a -> GetMetricStatistics
s {$sel:period:GetMetricStatistics' :: Natural
period = Natural
a} :: GetMetricStatistics)

instance Core.AWSRequest GetMetricStatistics where
  type
    AWSResponse GetMetricStatistics =
      GetMetricStatisticsResponse
  request :: (Service -> Service)
-> GetMetricStatistics -> Request GetMetricStatistics
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 GetMetricStatistics
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMetricStatistics)))
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
"GetMetricStatisticsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Datapoint]
-> Maybe Text -> Int -> GetMetricStatisticsResponse
GetMetricStatisticsResponse'
            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
"Datapoints"
                            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.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Label")
            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 GetMetricStatistics where
  hashWithSalt :: Int -> GetMetricStatistics -> Int
hashWithSalt Int
_salt GetMetricStatistics' {Natural
Maybe [Dimension]
Maybe (NonEmpty Text)
Maybe (NonEmpty Statistic)
Maybe StandardUnit
Text
ISO8601
period :: Natural
endTime :: ISO8601
startTime :: ISO8601
metricName :: Text
namespace :: Text
unit :: Maybe StandardUnit
statistics :: Maybe (NonEmpty Statistic)
extendedStatistics :: Maybe (NonEmpty Text)
dimensions :: Maybe [Dimension]
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Text)
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> 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 (NonEmpty Text)
extendedStatistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Statistic)
statistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StandardUnit
unit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
namespace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
period

instance Prelude.NFData GetMetricStatistics where
  rnf :: GetMetricStatistics -> ()
rnf GetMetricStatistics' {Natural
Maybe [Dimension]
Maybe (NonEmpty Text)
Maybe (NonEmpty Statistic)
Maybe StandardUnit
Text
ISO8601
period :: Natural
endTime :: ISO8601
startTime :: ISO8601
metricName :: Text
namespace :: Text
unit :: Maybe StandardUnit
statistics :: Maybe (NonEmpty Statistic)
extendedStatistics :: Maybe (NonEmpty Text)
dimensions :: Maybe [Dimension]
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Text)
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> 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 (NonEmpty Text)
extendedStatistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Statistic)
statistics
      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
namespace
      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 ISO8601
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
period

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

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

instance Data.ToQuery GetMetricStatistics where
  toQuery :: GetMetricStatistics -> QueryString
toQuery GetMetricStatistics' {Natural
Maybe [Dimension]
Maybe (NonEmpty Text)
Maybe (NonEmpty Statistic)
Maybe StandardUnit
Text
ISO8601
period :: Natural
endTime :: ISO8601
startTime :: ISO8601
metricName :: Text
namespace :: Text
unit :: Maybe StandardUnit
statistics :: Maybe (NonEmpty Statistic)
extendedStatistics :: Maybe (NonEmpty Text)
dimensions :: Maybe [Dimension]
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Text)
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> Maybe [Dimension]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetMetricStatistics" :: 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
"ExtendedStatistics"
          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 (NonEmpty Text)
extendedStatistics
            ),
        ByteString
"Statistics"
          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 (NonEmpty Statistic)
statistics),
        ByteString
"Unit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe StandardUnit
unit,
        ByteString
"Namespace" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
namespace,
        ByteString
"MetricName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
metricName,
        ByteString
"StartTime" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ISO8601
startTime,
        ByteString
"EndTime" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ISO8601
endTime,
        ByteString
"Period" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Natural
period
      ]

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

-- |
-- Create a value of 'GetMetricStatisticsResponse' 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:
--
-- 'datapoints', 'getMetricStatisticsResponse_datapoints' - The data points for the specified metric.
--
-- 'label', 'getMetricStatisticsResponse_label' - A label for the specified metric.
--
-- 'httpStatus', 'getMetricStatisticsResponse_httpStatus' - The response's http status code.
newGetMetricStatisticsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMetricStatisticsResponse
newGetMetricStatisticsResponse :: Int -> GetMetricStatisticsResponse
newGetMetricStatisticsResponse Int
pHttpStatus_ =
  GetMetricStatisticsResponse'
    { $sel:datapoints:GetMetricStatisticsResponse' :: Maybe [Datapoint]
datapoints =
        forall a. Maybe a
Prelude.Nothing,
      $sel:label:GetMetricStatisticsResponse' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMetricStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The data points for the specified metric.
getMetricStatisticsResponse_datapoints :: Lens.Lens' GetMetricStatisticsResponse (Prelude.Maybe [Datapoint])
getMetricStatisticsResponse_datapoints :: Lens' GetMetricStatisticsResponse (Maybe [Datapoint])
getMetricStatisticsResponse_datapoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatisticsResponse' {Maybe [Datapoint]
datapoints :: Maybe [Datapoint]
$sel:datapoints:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe [Datapoint]
datapoints} -> Maybe [Datapoint]
datapoints) (\s :: GetMetricStatisticsResponse
s@GetMetricStatisticsResponse' {} Maybe [Datapoint]
a -> GetMetricStatisticsResponse
s {$sel:datapoints:GetMetricStatisticsResponse' :: Maybe [Datapoint]
datapoints = Maybe [Datapoint]
a} :: GetMetricStatisticsResponse) 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

-- | A label for the specified metric.
getMetricStatisticsResponse_label :: Lens.Lens' GetMetricStatisticsResponse (Prelude.Maybe Prelude.Text)
getMetricStatisticsResponse_label :: Lens' GetMetricStatisticsResponse (Maybe Text)
getMetricStatisticsResponse_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatisticsResponse' {Maybe Text
label :: Maybe Text
$sel:label:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe Text
label} -> Maybe Text
label) (\s :: GetMetricStatisticsResponse
s@GetMetricStatisticsResponse' {} Maybe Text
a -> GetMetricStatisticsResponse
s {$sel:label:GetMetricStatisticsResponse' :: Maybe Text
label = Maybe Text
a} :: GetMetricStatisticsResponse)

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

instance Prelude.NFData GetMetricStatisticsResponse where
  rnf :: GetMetricStatisticsResponse -> ()
rnf GetMetricStatisticsResponse' {Int
Maybe [Datapoint]
Maybe Text
httpStatus :: Int
label :: Maybe Text
datapoints :: Maybe [Datapoint]
$sel:httpStatus:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Int
$sel:label:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe Text
$sel:datapoints:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe [Datapoint]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Datapoint]
datapoints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus