{-# 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.MwAA.Types.StatisticSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MwAA.Types.StatisticSet where

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

-- | __Internal only__. Represents a set of statistics that describe a
-- specific metric. To learn more about the metrics published to Amazon
-- CloudWatch, see
-- <https://docs.aws.amazon.com/mwaa/latest/userguide/cw-metrics.html Amazon MWAA performance metrics in Amazon CloudWatch>.
--
-- /See:/ 'newStatisticSet' smart constructor.
data StatisticSet = StatisticSet'
  { -- | __Internal only__. The maximum value of the sample set.
    StatisticSet -> Maybe Double
maximum :: Prelude.Maybe Prelude.Double,
    -- | __Internal only__. The minimum value of the sample set.
    StatisticSet -> Maybe Double
minimum :: Prelude.Maybe Prelude.Double,
    -- | __Internal only__. The number of samples used for the statistic set.
    StatisticSet -> Maybe Int
sampleCount :: Prelude.Maybe Prelude.Int,
    -- | __Internal only__. The sum of values for the sample set.
    StatisticSet -> Maybe Double
sum :: Prelude.Maybe Prelude.Double
  }
  deriving (StatisticSet -> StatisticSet -> Bool
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]
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
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. 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:
--
-- 'maximum', 'statisticSet_maximum' - __Internal only__. The maximum value of the sample set.
--
-- 'minimum', 'statisticSet_minimum' - __Internal only__. The minimum value of the sample set.
--
-- 'sampleCount', 'statisticSet_sampleCount' - __Internal only__. The number of samples used for the statistic set.
--
-- 'sum', 'statisticSet_sum' - __Internal only__. The sum of values for the sample set.
newStatisticSet ::
  StatisticSet
newStatisticSet :: StatisticSet
newStatisticSet =
  StatisticSet'
    { $sel:maximum:StatisticSet' :: Maybe Double
maximum = forall a. Maybe a
Prelude.Nothing,
      $sel:minimum:StatisticSet' :: Maybe Double
minimum = forall a. Maybe a
Prelude.Nothing,
      $sel:sampleCount:StatisticSet' :: Maybe Int
sampleCount = forall a. Maybe a
Prelude.Nothing,
      $sel:sum:StatisticSet' :: Maybe Double
sum = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

instance Prelude.Hashable StatisticSet where
  hashWithSalt :: Int -> StatisticSet -> Int
hashWithSalt Int
_salt StatisticSet' {Maybe Double
Maybe Int
sum :: Maybe Double
sampleCount :: Maybe Int
minimum :: Maybe Double
maximum :: Maybe Double
$sel:sum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:sampleCount:StatisticSet' :: StatisticSet -> Maybe Int
$sel:minimum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:maximum:StatisticSet' :: StatisticSet -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
maximum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
minimum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sampleCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
sum

instance Prelude.NFData StatisticSet where
  rnf :: StatisticSet -> ()
rnf StatisticSet' {Maybe Double
Maybe Int
sum :: Maybe Double
sampleCount :: Maybe Int
minimum :: Maybe Double
maximum :: Maybe Double
$sel:sum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:sampleCount:StatisticSet' :: StatisticSet -> Maybe Int
$sel:minimum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:maximum:StatisticSet' :: StatisticSet -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
maximum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
minimum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sampleCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
sum

instance Data.ToJSON StatisticSet where
  toJSON :: StatisticSet -> Value
toJSON StatisticSet' {Maybe Double
Maybe Int
sum :: Maybe Double
sampleCount :: Maybe Int
minimum :: Maybe Double
maximum :: Maybe Double
$sel:sum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:sampleCount:StatisticSet' :: StatisticSet -> Maybe Int
$sel:minimum:StatisticSet' :: StatisticSet -> Maybe Double
$sel:maximum:StatisticSet' :: StatisticSet -> Maybe Double
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Maximum" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
maximum,
            (Key
"Minimum" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minimum,
            (Key
"SampleCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
sampleCount,
            (Key
"Sum" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
sum
          ]
      )