{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudWatch.Types.MetricDatum
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudWatch.Types.MetricDatum where

import Amazonka.CloudWatch.Types.Dimension
import Amazonka.CloudWatch.Types.StandardUnit
import Amazonka.CloudWatch.Types.StatisticSet
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Encapsulates the information sent to either create a metric or add new
-- values to be aggregated into an existing metric.
--
-- /See:/ 'newMetricDatum' smart constructor.
data MetricDatum = MetricDatum'
  { -- | Array of numbers representing the values for the metric during the
    -- period. Each unique value is listed just once in this array, and the
    -- corresponding number in the @Counts@ array specifies the number of times
    -- that value occurred during the period. You can include up to 150 unique
    -- values in each @PutMetricData@ action that specifies a @Values@ array.
    --
    -- Although the @Values@ array accepts numbers of type @Double@, CloudWatch
    -- rejects values that are either too small or too large. Values must be in
    -- the range of -2^360 to 2^360. In addition, special values (for example,
    -- NaN, +Infinity, -Infinity) are not supported.
    MetricDatum -> Maybe [Double]
values :: Prelude.Maybe [Prelude.Double],
    -- | Array of numbers that is used along with the @Values@ array. Each number
    -- in the @Count@ array is the number of times the corresponding value in
    -- the @Values@ array occurred during the period.
    --
    -- If you omit the @Counts@ array, the default of 1 is used as the value
    -- for each count. If you include a @Counts@ array, it must include the
    -- same amount of values as the @Values@ array.
    MetricDatum -> Maybe [Double]
counts :: Prelude.Maybe [Prelude.Double],
    -- | The value for the metric.
    --
    -- Although the parameter accepts numbers of type Double, CloudWatch
    -- rejects values that are either too small or too large. Values must be in
    -- the range of -2^360 to 2^360. In addition, special values (for example,
    -- NaN, +Infinity, -Infinity) are not supported.
    MetricDatum -> Maybe Double
value :: Prelude.Maybe Prelude.Double,
    -- | Valid values are 1 and 60. Setting this to 1 specifies this metric as a
    -- high-resolution metric, so that CloudWatch stores the metric with
    -- sub-minute resolution down to one second. Setting this to 60 specifies
    -- this metric as a regular-resolution metric, which CloudWatch stores at
    -- 1-minute resolution. Currently, high resolution is available only for
    -- custom metrics. For more information about high-resolution metrics, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics High-Resolution Metrics>
    -- in the /Amazon CloudWatch User Guide/.
    --
    -- This field is optional, if you do not specify it the default of 60 is
    -- used.
    MetricDatum -> Maybe Natural
storageResolution :: Prelude.Maybe Prelude.Natural,
    -- | The dimensions associated with the metric.
    MetricDatum -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | When you are using a @Put@ operation, this defines what unit you want to
    -- use when storing the metric.
    --
    -- In a @Get@ operation, this displays the unit that is used for the
    -- metric.
    MetricDatum -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
    -- | The time the metric data was received, expressed as the number of
    -- milliseconds since Jan 1, 1970 00:00:00 UTC.
    MetricDatum -> Maybe ISO8601
timestamp :: Prelude.Maybe Core.ISO8601,
    -- | The statistical values for the metric.
    MetricDatum -> Maybe StatisticSet
statisticValues :: Prelude.Maybe StatisticSet,
    -- | The name of the metric.
    MetricDatum -> Text
metricName :: Prelude.Text
  }
  deriving (MetricDatum -> MetricDatum -> Bool
(MetricDatum -> MetricDatum -> Bool)
-> (MetricDatum -> MetricDatum -> Bool) -> Eq MetricDatum
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricDatum -> MetricDatum -> Bool
$c/= :: MetricDatum -> MetricDatum -> Bool
== :: MetricDatum -> MetricDatum -> Bool
$c== :: MetricDatum -> MetricDatum -> Bool
Prelude.Eq, ReadPrec [MetricDatum]
ReadPrec MetricDatum
Int -> ReadS MetricDatum
ReadS [MetricDatum]
(Int -> ReadS MetricDatum)
-> ReadS [MetricDatum]
-> ReadPrec MetricDatum
-> ReadPrec [MetricDatum]
-> Read MetricDatum
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricDatum]
$creadListPrec :: ReadPrec [MetricDatum]
readPrec :: ReadPrec MetricDatum
$creadPrec :: ReadPrec MetricDatum
readList :: ReadS [MetricDatum]
$creadList :: ReadS [MetricDatum]
readsPrec :: Int -> ReadS MetricDatum
$creadsPrec :: Int -> ReadS MetricDatum
Prelude.Read, Int -> MetricDatum -> ShowS
[MetricDatum] -> ShowS
MetricDatum -> String
(Int -> MetricDatum -> ShowS)
-> (MetricDatum -> String)
-> ([MetricDatum] -> ShowS)
-> Show MetricDatum
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricDatum] -> ShowS
$cshowList :: [MetricDatum] -> ShowS
show :: MetricDatum -> String
$cshow :: MetricDatum -> String
showsPrec :: Int -> MetricDatum -> ShowS
$cshowsPrec :: Int -> MetricDatum -> ShowS
Prelude.Show, (forall x. MetricDatum -> Rep MetricDatum x)
-> (forall x. Rep MetricDatum x -> MetricDatum)
-> Generic MetricDatum
forall x. Rep MetricDatum x -> MetricDatum
forall x. MetricDatum -> Rep MetricDatum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricDatum x -> MetricDatum
$cfrom :: forall x. MetricDatum -> Rep MetricDatum x
Prelude.Generic)

-- |
-- Create a value of 'MetricDatum' 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:
--
-- 'values', 'metricDatum_values' - Array of numbers representing the values for the metric during the
-- period. Each unique value is listed just once in this array, and the
-- corresponding number in the @Counts@ array specifies the number of times
-- that value occurred during the period. You can include up to 150 unique
-- values in each @PutMetricData@ action that specifies a @Values@ array.
--
-- Although the @Values@ array accepts numbers of type @Double@, CloudWatch
-- rejects values that are either too small or too large. Values must be in
-- the range of -2^360 to 2^360. In addition, special values (for example,
-- NaN, +Infinity, -Infinity) are not supported.
--
-- 'counts', 'metricDatum_counts' - Array of numbers that is used along with the @Values@ array. Each number
-- in the @Count@ array is the number of times the corresponding value in
-- the @Values@ array occurred during the period.
--
-- If you omit the @Counts@ array, the default of 1 is used as the value
-- for each count. If you include a @Counts@ array, it must include the
-- same amount of values as the @Values@ array.
--
-- 'value', 'metricDatum_value' - The value for the metric.
--
-- Although the parameter accepts numbers of type Double, CloudWatch
-- rejects values that are either too small or too large. Values must be in
-- the range of -2^360 to 2^360. In addition, special values (for example,
-- NaN, +Infinity, -Infinity) are not supported.
--
-- 'storageResolution', 'metricDatum_storageResolution' - Valid values are 1 and 60. Setting this to 1 specifies this metric as a
-- high-resolution metric, so that CloudWatch stores the metric with
-- sub-minute resolution down to one second. Setting this to 60 specifies
-- this metric as a regular-resolution metric, which CloudWatch stores at
-- 1-minute resolution. Currently, high resolution is available only for
-- custom metrics. For more information about high-resolution metrics, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics High-Resolution Metrics>
-- in the /Amazon CloudWatch User Guide/.
--
-- This field is optional, if you do not specify it the default of 60 is
-- used.
--
-- 'dimensions', 'metricDatum_dimensions' - The dimensions associated with the metric.
--
-- 'unit', 'metricDatum_unit' - When you are using a @Put@ operation, this defines what unit you want to
-- use when storing the metric.
--
-- In a @Get@ operation, this displays the unit that is used for the
-- metric.
--
-- 'timestamp', 'metricDatum_timestamp' - The time the metric data was received, expressed as the number of
-- milliseconds since Jan 1, 1970 00:00:00 UTC.
--
-- 'statisticValues', 'metricDatum_statisticValues' - The statistical values for the metric.
--
-- 'metricName', 'metricDatum_metricName' - The name of the metric.
newMetricDatum ::
  -- | 'metricName'
  Prelude.Text ->
  MetricDatum
newMetricDatum :: Text -> MetricDatum
newMetricDatum Text
pMetricName_ =
  MetricDatum' :: Maybe [Double]
-> Maybe [Double]
-> Maybe Double
-> Maybe Natural
-> Maybe [Dimension]
-> Maybe StandardUnit
-> Maybe ISO8601
-> Maybe StatisticSet
-> Text
-> MetricDatum
MetricDatum'
    { $sel:values:MetricDatum' :: Maybe [Double]
values = Maybe [Double]
forall a. Maybe a
Prelude.Nothing,
      $sel:counts:MetricDatum' :: Maybe [Double]
counts = Maybe [Double]
forall a. Maybe a
Prelude.Nothing,
      $sel:value:MetricDatum' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:storageResolution:MetricDatum' :: Maybe Natural
storageResolution = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:dimensions:MetricDatum' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:MetricDatum' :: Maybe StandardUnit
unit = Maybe StandardUnit
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:MetricDatum' :: Maybe ISO8601
timestamp = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:statisticValues:MetricDatum' :: Maybe StatisticSet
statisticValues = Maybe StatisticSet
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:MetricDatum' :: Text
metricName = Text
pMetricName_
    }

-- | Array of numbers representing the values for the metric during the
-- period. Each unique value is listed just once in this array, and the
-- corresponding number in the @Counts@ array specifies the number of times
-- that value occurred during the period. You can include up to 150 unique
-- values in each @PutMetricData@ action that specifies a @Values@ array.
--
-- Although the @Values@ array accepts numbers of type @Double@, CloudWatch
-- rejects values that are either too small or too large. Values must be in
-- the range of -2^360 to 2^360. In addition, special values (for example,
-- NaN, +Infinity, -Infinity) are not supported.
metricDatum_values :: Lens.Lens' MetricDatum (Prelude.Maybe [Prelude.Double])
metricDatum_values :: (Maybe [Double] -> f (Maybe [Double]))
-> MetricDatum -> f MetricDatum
metricDatum_values = (MetricDatum -> Maybe [Double])
-> (MetricDatum -> Maybe [Double] -> MetricDatum)
-> Lens MetricDatum MetricDatum (Maybe [Double]) (Maybe [Double])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe [Double]
values :: Maybe [Double]
$sel:values:MetricDatum' :: MetricDatum -> Maybe [Double]
values} -> Maybe [Double]
values) (\s :: MetricDatum
s@MetricDatum' {} Maybe [Double]
a -> MetricDatum
s {$sel:values:MetricDatum' :: Maybe [Double]
values = Maybe [Double]
a} :: MetricDatum) ((Maybe [Double] -> f (Maybe [Double]))
 -> MetricDatum -> f MetricDatum)
-> ((Maybe [Double] -> f (Maybe [Double]))
    -> Maybe [Double] -> f (Maybe [Double]))
-> (Maybe [Double] -> f (Maybe [Double]))
-> MetricDatum
-> f MetricDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Double] [Double] [Double] [Double]
-> Iso
     (Maybe [Double]) (Maybe [Double]) (Maybe [Double]) (Maybe [Double])
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 [Double] [Double] [Double] [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Array of numbers that is used along with the @Values@ array. Each number
-- in the @Count@ array is the number of times the corresponding value in
-- the @Values@ array occurred during the period.
--
-- If you omit the @Counts@ array, the default of 1 is used as the value
-- for each count. If you include a @Counts@ array, it must include the
-- same amount of values as the @Values@ array.
metricDatum_counts :: Lens.Lens' MetricDatum (Prelude.Maybe [Prelude.Double])
metricDatum_counts :: (Maybe [Double] -> f (Maybe [Double]))
-> MetricDatum -> f MetricDatum
metricDatum_counts = (MetricDatum -> Maybe [Double])
-> (MetricDatum -> Maybe [Double] -> MetricDatum)
-> Lens MetricDatum MetricDatum (Maybe [Double]) (Maybe [Double])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe [Double]
counts :: Maybe [Double]
$sel:counts:MetricDatum' :: MetricDatum -> Maybe [Double]
counts} -> Maybe [Double]
counts) (\s :: MetricDatum
s@MetricDatum' {} Maybe [Double]
a -> MetricDatum
s {$sel:counts:MetricDatum' :: Maybe [Double]
counts = Maybe [Double]
a} :: MetricDatum) ((Maybe [Double] -> f (Maybe [Double]))
 -> MetricDatum -> f MetricDatum)
-> ((Maybe [Double] -> f (Maybe [Double]))
    -> Maybe [Double] -> f (Maybe [Double]))
-> (Maybe [Double] -> f (Maybe [Double]))
-> MetricDatum
-> f MetricDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Double] [Double] [Double] [Double]
-> Iso
     (Maybe [Double]) (Maybe [Double]) (Maybe [Double]) (Maybe [Double])
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 [Double] [Double] [Double] [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The value for the metric.
--
-- Although the parameter accepts numbers of type Double, CloudWatch
-- rejects values that are either too small or too large. Values must be in
-- the range of -2^360 to 2^360. In addition, special values (for example,
-- NaN, +Infinity, -Infinity) are not supported.
metricDatum_value :: Lens.Lens' MetricDatum (Prelude.Maybe Prelude.Double)
metricDatum_value :: (Maybe Double -> f (Maybe Double)) -> MetricDatum -> f MetricDatum
metricDatum_value = (MetricDatum -> Maybe Double)
-> (MetricDatum -> Maybe Double -> MetricDatum)
-> Lens MetricDatum MetricDatum (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe Double
value :: Maybe Double
$sel:value:MetricDatum' :: MetricDatum -> Maybe Double
value} -> Maybe Double
value) (\s :: MetricDatum
s@MetricDatum' {} Maybe Double
a -> MetricDatum
s {$sel:value:MetricDatum' :: Maybe Double
value = Maybe Double
a} :: MetricDatum)

-- | Valid values are 1 and 60. Setting this to 1 specifies this metric as a
-- high-resolution metric, so that CloudWatch stores the metric with
-- sub-minute resolution down to one second. Setting this to 60 specifies
-- this metric as a regular-resolution metric, which CloudWatch stores at
-- 1-minute resolution. Currently, high resolution is available only for
-- custom metrics. For more information about high-resolution metrics, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics High-Resolution Metrics>
-- in the /Amazon CloudWatch User Guide/.
--
-- This field is optional, if you do not specify it the default of 60 is
-- used.
metricDatum_storageResolution :: Lens.Lens' MetricDatum (Prelude.Maybe Prelude.Natural)
metricDatum_storageResolution :: (Maybe Natural -> f (Maybe Natural))
-> MetricDatum -> f MetricDatum
metricDatum_storageResolution = (MetricDatum -> Maybe Natural)
-> (MetricDatum -> Maybe Natural -> MetricDatum)
-> Lens MetricDatum MetricDatum (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe Natural
storageResolution :: Maybe Natural
$sel:storageResolution:MetricDatum' :: MetricDatum -> Maybe Natural
storageResolution} -> Maybe Natural
storageResolution) (\s :: MetricDatum
s@MetricDatum' {} Maybe Natural
a -> MetricDatum
s {$sel:storageResolution:MetricDatum' :: Maybe Natural
storageResolution = Maybe Natural
a} :: MetricDatum)

-- | The dimensions associated with the metric.
metricDatum_dimensions :: Lens.Lens' MetricDatum (Prelude.Maybe [Dimension])
metricDatum_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> MetricDatum -> f MetricDatum
metricDatum_dimensions = (MetricDatum -> Maybe [Dimension])
-> (MetricDatum -> Maybe [Dimension] -> MetricDatum)
-> Lens
     MetricDatum MetricDatum (Maybe [Dimension]) (Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:MetricDatum' :: MetricDatum -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: MetricDatum
s@MetricDatum' {} Maybe [Dimension]
a -> MetricDatum
s {$sel:dimensions:MetricDatum' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: MetricDatum) ((Maybe [Dimension] -> f (Maybe [Dimension]))
 -> MetricDatum -> f MetricDatum)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
    -> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> MetricDatum
-> f MetricDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When you are using a @Put@ operation, this defines what unit you want to
-- use when storing the metric.
--
-- In a @Get@ operation, this displays the unit that is used for the
-- metric.
metricDatum_unit :: Lens.Lens' MetricDatum (Prelude.Maybe StandardUnit)
metricDatum_unit :: (Maybe StandardUnit -> f (Maybe StandardUnit))
-> MetricDatum -> f MetricDatum
metricDatum_unit = (MetricDatum -> Maybe StandardUnit)
-> (MetricDatum -> Maybe StandardUnit -> MetricDatum)
-> Lens
     MetricDatum MetricDatum (Maybe StandardUnit) (Maybe StandardUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:MetricDatum' :: MetricDatum -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: MetricDatum
s@MetricDatum' {} Maybe StandardUnit
a -> MetricDatum
s {$sel:unit:MetricDatum' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: MetricDatum)

-- | The time the metric data was received, expressed as the number of
-- milliseconds since Jan 1, 1970 00:00:00 UTC.
metricDatum_timestamp :: Lens.Lens' MetricDatum (Prelude.Maybe Prelude.UTCTime)
metricDatum_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MetricDatum -> f MetricDatum
metricDatum_timestamp = (MetricDatum -> Maybe ISO8601)
-> (MetricDatum -> Maybe ISO8601 -> MetricDatum)
-> Lens MetricDatum MetricDatum (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:MetricDatum' :: MetricDatum -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: MetricDatum
s@MetricDatum' {} Maybe ISO8601
a -> MetricDatum
s {$sel:timestamp:MetricDatum' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: MetricDatum) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> MetricDatum -> f MetricDatum)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MetricDatum
-> f MetricDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The statistical values for the metric.
metricDatum_statisticValues :: Lens.Lens' MetricDatum (Prelude.Maybe StatisticSet)
metricDatum_statisticValues :: (Maybe StatisticSet -> f (Maybe StatisticSet))
-> MetricDatum -> f MetricDatum
metricDatum_statisticValues = (MetricDatum -> Maybe StatisticSet)
-> (MetricDatum -> Maybe StatisticSet -> MetricDatum)
-> Lens
     MetricDatum MetricDatum (Maybe StatisticSet) (Maybe StatisticSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDatum' {Maybe StatisticSet
statisticValues :: Maybe StatisticSet
$sel:statisticValues:MetricDatum' :: MetricDatum -> Maybe StatisticSet
statisticValues} -> Maybe StatisticSet
statisticValues) (\s :: MetricDatum
s@MetricDatum' {} Maybe StatisticSet
a -> MetricDatum
s {$sel:statisticValues:MetricDatum' :: Maybe StatisticSet
statisticValues = Maybe StatisticSet
a} :: MetricDatum)

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

instance Prelude.Hashable MetricDatum

instance Prelude.NFData MetricDatum

instance Core.ToQuery MetricDatum where
  toQuery :: MetricDatum -> QueryString
toQuery MetricDatum' {Maybe Double
Maybe Natural
Maybe [Double]
Maybe [Dimension]
Maybe ISO8601
Maybe StandardUnit
Maybe StatisticSet
Text
metricName :: Text
statisticValues :: Maybe StatisticSet
timestamp :: Maybe ISO8601
unit :: Maybe StandardUnit
dimensions :: Maybe [Dimension]
storageResolution :: Maybe Natural
value :: Maybe Double
counts :: Maybe [Double]
values :: Maybe [Double]
$sel:metricName:MetricDatum' :: MetricDatum -> Text
$sel:statisticValues:MetricDatum' :: MetricDatum -> Maybe StatisticSet
$sel:timestamp:MetricDatum' :: MetricDatum -> Maybe ISO8601
$sel:unit:MetricDatum' :: MetricDatum -> Maybe StandardUnit
$sel:dimensions:MetricDatum' :: MetricDatum -> Maybe [Dimension]
$sel:storageResolution:MetricDatum' :: MetricDatum -> Maybe Natural
$sel:value:MetricDatum' :: MetricDatum -> Maybe Double
$sel:counts:MetricDatum' :: MetricDatum -> Maybe [Double]
$sel:values:MetricDatum' :: MetricDatum -> Maybe [Double]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Values"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Double] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Double] -> QueryString) -> Maybe [Double] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Double]
values),
        ByteString
"Counts"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Double] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Double] -> QueryString) -> Maybe [Double] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Double]
counts),
        ByteString
"Value" ByteString -> Maybe Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Double
value,
        ByteString
"StorageResolution" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
storageResolution,
        ByteString
"Dimensions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Dimension] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Dimension] -> QueryString)
-> Maybe [Dimension] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
        ByteString
"Unit" ByteString -> Maybe StandardUnit -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StandardUnit
unit,
        ByteString
"Timestamp" ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
timestamp,
        ByteString
"StatisticValues" ByteString -> Maybe StatisticSet -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StatisticSet
statisticValues,
        ByteString
"MetricName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
metricName
      ]