{-# 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.CustomerProfiles.Types.DomainStats
-- 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.CustomerProfiles.Types.DomainStats where

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

-- | Usage-specific statistics about the domain.
--
-- /See:/ 'newDomainStats' smart constructor.
data DomainStats = DomainStats'
  { -- | The number of profiles that you are currently paying for in the domain.
    -- If you have more than 100 objects associated with a single profile, that
    -- profile counts as two profiles. If you have more than 200 objects, that
    -- profile counts as three, and so on.
    DomainStats -> Maybe Integer
meteringProfileCount :: Prelude.Maybe Prelude.Integer,
    -- | The total size, in bytes, of all objects in the domain.
    DomainStats -> Maybe Integer
totalSize :: Prelude.Maybe Prelude.Integer,
    -- | The total number of profiles currently in the domain.
    DomainStats -> Maybe Integer
profileCount :: Prelude.Maybe Prelude.Integer,
    -- | The total number of objects in domain.
    DomainStats -> Maybe Integer
objectCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (DomainStats -> DomainStats -> Bool
(DomainStats -> DomainStats -> Bool)
-> (DomainStats -> DomainStats -> Bool) -> Eq DomainStats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainStats -> DomainStats -> Bool
$c/= :: DomainStats -> DomainStats -> Bool
== :: DomainStats -> DomainStats -> Bool
$c== :: DomainStats -> DomainStats -> Bool
Prelude.Eq, ReadPrec [DomainStats]
ReadPrec DomainStats
Int -> ReadS DomainStats
ReadS [DomainStats]
(Int -> ReadS DomainStats)
-> ReadS [DomainStats]
-> ReadPrec DomainStats
-> ReadPrec [DomainStats]
-> Read DomainStats
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainStats]
$creadListPrec :: ReadPrec [DomainStats]
readPrec :: ReadPrec DomainStats
$creadPrec :: ReadPrec DomainStats
readList :: ReadS [DomainStats]
$creadList :: ReadS [DomainStats]
readsPrec :: Int -> ReadS DomainStats
$creadsPrec :: Int -> ReadS DomainStats
Prelude.Read, Int -> DomainStats -> ShowS
[DomainStats] -> ShowS
DomainStats -> String
(Int -> DomainStats -> ShowS)
-> (DomainStats -> String)
-> ([DomainStats] -> ShowS)
-> Show DomainStats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainStats] -> ShowS
$cshowList :: [DomainStats] -> ShowS
show :: DomainStats -> String
$cshow :: DomainStats -> String
showsPrec :: Int -> DomainStats -> ShowS
$cshowsPrec :: Int -> DomainStats -> ShowS
Prelude.Show, (forall x. DomainStats -> Rep DomainStats x)
-> (forall x. Rep DomainStats x -> DomainStats)
-> Generic DomainStats
forall x. Rep DomainStats x -> DomainStats
forall x. DomainStats -> Rep DomainStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainStats x -> DomainStats
$cfrom :: forall x. DomainStats -> Rep DomainStats x
Prelude.Generic)

-- |
-- Create a value of 'DomainStats' 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:
--
-- 'meteringProfileCount', 'domainStats_meteringProfileCount' - The number of profiles that you are currently paying for in the domain.
-- If you have more than 100 objects associated with a single profile, that
-- profile counts as two profiles. If you have more than 200 objects, that
-- profile counts as three, and so on.
--
-- 'totalSize', 'domainStats_totalSize' - The total size, in bytes, of all objects in the domain.
--
-- 'profileCount', 'domainStats_profileCount' - The total number of profiles currently in the domain.
--
-- 'objectCount', 'domainStats_objectCount' - The total number of objects in domain.
newDomainStats ::
  DomainStats
newDomainStats :: DomainStats
newDomainStats =
  DomainStats' :: Maybe Integer
-> Maybe Integer -> Maybe Integer -> Maybe Integer -> DomainStats
DomainStats'
    { $sel:meteringProfileCount:DomainStats' :: Maybe Integer
meteringProfileCount =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalSize:DomainStats' :: Maybe Integer
totalSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:profileCount:DomainStats' :: Maybe Integer
profileCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:objectCount:DomainStats' :: Maybe Integer
objectCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of profiles that you are currently paying for in the domain.
-- If you have more than 100 objects associated with a single profile, that
-- profile counts as two profiles. If you have more than 200 objects, that
-- profile counts as three, and so on.
domainStats_meteringProfileCount :: Lens.Lens' DomainStats (Prelude.Maybe Prelude.Integer)
domainStats_meteringProfileCount :: (Maybe Integer -> f (Maybe Integer))
-> DomainStats -> f DomainStats
domainStats_meteringProfileCount = (DomainStats -> Maybe Integer)
-> (DomainStats -> Maybe Integer -> DomainStats)
-> Lens DomainStats DomainStats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainStats' {Maybe Integer
meteringProfileCount :: Maybe Integer
$sel:meteringProfileCount:DomainStats' :: DomainStats -> Maybe Integer
meteringProfileCount} -> Maybe Integer
meteringProfileCount) (\s :: DomainStats
s@DomainStats' {} Maybe Integer
a -> DomainStats
s {$sel:meteringProfileCount:DomainStats' :: Maybe Integer
meteringProfileCount = Maybe Integer
a} :: DomainStats)

-- | The total size, in bytes, of all objects in the domain.
domainStats_totalSize :: Lens.Lens' DomainStats (Prelude.Maybe Prelude.Integer)
domainStats_totalSize :: (Maybe Integer -> f (Maybe Integer))
-> DomainStats -> f DomainStats
domainStats_totalSize = (DomainStats -> Maybe Integer)
-> (DomainStats -> Maybe Integer -> DomainStats)
-> Lens DomainStats DomainStats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainStats' {Maybe Integer
totalSize :: Maybe Integer
$sel:totalSize:DomainStats' :: DomainStats -> Maybe Integer
totalSize} -> Maybe Integer
totalSize) (\s :: DomainStats
s@DomainStats' {} Maybe Integer
a -> DomainStats
s {$sel:totalSize:DomainStats' :: Maybe Integer
totalSize = Maybe Integer
a} :: DomainStats)

-- | The total number of profiles currently in the domain.
domainStats_profileCount :: Lens.Lens' DomainStats (Prelude.Maybe Prelude.Integer)
domainStats_profileCount :: (Maybe Integer -> f (Maybe Integer))
-> DomainStats -> f DomainStats
domainStats_profileCount = (DomainStats -> Maybe Integer)
-> (DomainStats -> Maybe Integer -> DomainStats)
-> Lens DomainStats DomainStats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainStats' {Maybe Integer
profileCount :: Maybe Integer
$sel:profileCount:DomainStats' :: DomainStats -> Maybe Integer
profileCount} -> Maybe Integer
profileCount) (\s :: DomainStats
s@DomainStats' {} Maybe Integer
a -> DomainStats
s {$sel:profileCount:DomainStats' :: Maybe Integer
profileCount = Maybe Integer
a} :: DomainStats)

-- | The total number of objects in domain.
domainStats_objectCount :: Lens.Lens' DomainStats (Prelude.Maybe Prelude.Integer)
domainStats_objectCount :: (Maybe Integer -> f (Maybe Integer))
-> DomainStats -> f DomainStats
domainStats_objectCount = (DomainStats -> Maybe Integer)
-> (DomainStats -> Maybe Integer -> DomainStats)
-> Lens DomainStats DomainStats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainStats' {Maybe Integer
objectCount :: Maybe Integer
$sel:objectCount:DomainStats' :: DomainStats -> Maybe Integer
objectCount} -> Maybe Integer
objectCount) (\s :: DomainStats
s@DomainStats' {} Maybe Integer
a -> DomainStats
s {$sel:objectCount:DomainStats' :: Maybe Integer
objectCount = Maybe Integer
a} :: DomainStats)

instance Core.FromJSON DomainStats where
  parseJSON :: Value -> Parser DomainStats
parseJSON =
    String
-> (Object -> Parser DomainStats) -> Value -> Parser DomainStats
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainStats"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer -> Maybe Integer -> Maybe Integer -> DomainStats
DomainStats'
            (Maybe Integer
 -> Maybe Integer -> Maybe Integer -> Maybe Integer -> DomainStats)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer -> Maybe Integer -> Maybe Integer -> DomainStats)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MeteringProfileCount")
            Parser
  (Maybe Integer -> Maybe Integer -> Maybe Integer -> DomainStats)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> DomainStats)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalSize")
            Parser (Maybe Integer -> Maybe Integer -> DomainStats)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> DomainStats)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProfileCount")
            Parser (Maybe Integer -> DomainStats)
-> Parser (Maybe Integer) -> Parser DomainStats
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ObjectCount")
      )

instance Prelude.Hashable DomainStats

instance Prelude.NFData DomainStats