{-# 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.StatisticSet
-- 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.StatisticSet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a set of statistics that describes a specific metric.
--
-- /See:/ 'newStatisticSet' smart constructor.
data StatisticSet = StatisticSet'
  { -- | The number of samples used for the statistic set.
    StatisticSet -> Double
sampleCount :: Prelude.Double,
    -- | The sum of values for the sample set.
    StatisticSet -> Double
sum :: Prelude.Double,
    -- | The minimum value of the sample set.
    StatisticSet -> Double
minimum :: Prelude.Double,
    -- | The maximum value of the sample set.
    StatisticSet -> Double
maximum :: Prelude.Double
  }
  deriving (StatisticSet -> StatisticSet -> Bool
(StatisticSet -> StatisticSet -> Bool)
-> (StatisticSet -> StatisticSet -> Bool) -> Eq StatisticSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatisticSet -> StatisticSet -> Bool
$c/= :: StatisticSet -> StatisticSet -> Bool
== :: StatisticSet -> StatisticSet -> Bool
$c== :: StatisticSet -> StatisticSet -> Bool
Prelude.Eq, ReadPrec [StatisticSet]
ReadPrec StatisticSet
Int -> ReadS StatisticSet
ReadS [StatisticSet]
(Int -> ReadS StatisticSet)
-> ReadS [StatisticSet]
-> ReadPrec StatisticSet
-> ReadPrec [StatisticSet]
-> Read StatisticSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatisticSet]
$creadListPrec :: ReadPrec [StatisticSet]
readPrec :: ReadPrec StatisticSet
$creadPrec :: ReadPrec StatisticSet
readList :: ReadS [StatisticSet]
$creadList :: ReadS [StatisticSet]
readsPrec :: Int -> ReadS StatisticSet
$creadsPrec :: Int -> ReadS StatisticSet
Prelude.Read, Int -> StatisticSet -> ShowS
[StatisticSet] -> ShowS
StatisticSet -> String
(Int -> StatisticSet -> ShowS)
-> (StatisticSet -> String)
-> ([StatisticSet] -> ShowS)
-> Show StatisticSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatisticSet] -> ShowS
$cshowList :: [StatisticSet] -> ShowS
show :: StatisticSet -> String
$cshow :: StatisticSet -> String
showsPrec :: Int -> StatisticSet -> ShowS
$cshowsPrec :: Int -> StatisticSet -> ShowS
Prelude.Show, (forall x. StatisticSet -> Rep StatisticSet x)
-> (forall x. Rep StatisticSet x -> StatisticSet)
-> Generic StatisticSet
forall x. Rep StatisticSet x -> StatisticSet
forall x. StatisticSet -> Rep StatisticSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatisticSet x -> StatisticSet
$cfrom :: forall x. StatisticSet -> Rep StatisticSet x
Prelude.Generic)

-- |
-- Create a value of 'StatisticSet' 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:
--
-- 'sampleCount', 'statisticSet_sampleCount' - The number of samples used for the statistic set.
--
-- 'sum', 'statisticSet_sum' - The sum of values for the sample set.
--
-- 'minimum', 'statisticSet_minimum' - The minimum value of the sample set.
--
-- 'maximum', 'statisticSet_maximum' - The maximum value of the sample set.
newStatisticSet ::
  -- | 'sampleCount'
  Prelude.Double ->
  -- | 'sum'
  Prelude.Double ->
  -- | 'minimum'
  Prelude.Double ->
  -- | 'maximum'
  Prelude.Double ->
  StatisticSet
newStatisticSet :: Double -> Double -> Double -> Double -> StatisticSet
newStatisticSet
  Double
pSampleCount_
  Double
pSum_
  Double
pMinimum_
  Double
pMaximum_ =
    StatisticSet' :: Double -> Double -> Double -> Double -> StatisticSet
StatisticSet'
      { $sel:sampleCount:StatisticSet' :: Double
sampleCount = Double
pSampleCount_,
        $sel:sum:StatisticSet' :: Double
sum = Double
pSum_,
        $sel:minimum:StatisticSet' :: Double
minimum = Double
pMinimum_,
        $sel:maximum:StatisticSet' :: Double
maximum = Double
pMaximum_
      }

-- | The number of samples used for the statistic set.
statisticSet_sampleCount :: Lens.Lens' StatisticSet Prelude.Double
statisticSet_sampleCount :: (Double -> f Double) -> StatisticSet -> f StatisticSet
statisticSet_sampleCount = (StatisticSet -> Double)
-> (StatisticSet -> Double -> StatisticSet)
-> Lens StatisticSet StatisticSet Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticSet' {Double
sampleCount :: Double
$sel:sampleCount:StatisticSet' :: StatisticSet -> Double
sampleCount} -> Double
sampleCount) (\s :: StatisticSet
s@StatisticSet' {} Double
a -> StatisticSet
s {$sel:sampleCount:StatisticSet' :: Double
sampleCount = Double
a} :: StatisticSet)

-- | The sum of values for the sample set.
statisticSet_sum :: Lens.Lens' StatisticSet Prelude.Double
statisticSet_sum :: (Double -> f Double) -> StatisticSet -> f StatisticSet
statisticSet_sum = (StatisticSet -> Double)
-> (StatisticSet -> Double -> StatisticSet)
-> Lens StatisticSet StatisticSet Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticSet' {Double
sum :: Double
$sel:sum:StatisticSet' :: StatisticSet -> Double
sum} -> Double
sum) (\s :: StatisticSet
s@StatisticSet' {} Double
a -> StatisticSet
s {$sel:sum:StatisticSet' :: Double
sum = Double
a} :: StatisticSet)

-- | The minimum value of the sample set.
statisticSet_minimum :: Lens.Lens' StatisticSet Prelude.Double
statisticSet_minimum :: (Double -> f Double) -> StatisticSet -> f StatisticSet
statisticSet_minimum = (StatisticSet -> Double)
-> (StatisticSet -> Double -> StatisticSet)
-> Lens StatisticSet StatisticSet Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticSet' {Double
minimum :: Double
$sel:minimum:StatisticSet' :: StatisticSet -> Double
minimum} -> Double
minimum) (\s :: StatisticSet
s@StatisticSet' {} Double
a -> StatisticSet
s {$sel:minimum:StatisticSet' :: Double
minimum = Double
a} :: StatisticSet)

-- | The maximum value of the sample set.
statisticSet_maximum :: Lens.Lens' StatisticSet Prelude.Double
statisticSet_maximum :: (Double -> f Double) -> StatisticSet -> f StatisticSet
statisticSet_maximum = (StatisticSet -> Double)
-> (StatisticSet -> Double -> StatisticSet)
-> Lens StatisticSet StatisticSet Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatisticSet' {Double
maximum :: Double
$sel:maximum:StatisticSet' :: StatisticSet -> Double
maximum} -> Double
maximum) (\s :: StatisticSet
s@StatisticSet' {} Double
a -> StatisticSet
s {$sel:maximum:StatisticSet' :: Double
maximum = Double
a} :: StatisticSet)

instance Prelude.Hashable StatisticSet

instance Prelude.NFData StatisticSet

instance Core.ToQuery StatisticSet where
  toQuery :: StatisticSet -> QueryString
toQuery StatisticSet' {Double
maximum :: Double
minimum :: Double
sum :: Double
sampleCount :: Double
$sel:maximum:StatisticSet' :: StatisticSet -> Double
$sel:minimum:StatisticSet' :: StatisticSet -> Double
$sel:sum:StatisticSet' :: StatisticSet -> Double
$sel:sampleCount:StatisticSet' :: StatisticSet -> Double
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"SampleCount" ByteString -> Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Double
sampleCount,
        ByteString
"Sum" ByteString -> Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Double
sum,
        ByteString
"Minimum" ByteString -> Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Double
minimum,
        ByteString
"Maximum" ByteString -> Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Double
maximum
      ]