{-# 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.Lambda.Types.AccountUsage
-- 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.Lambda.Types.AccountUsage 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

-- | The number of functions and amount of storage in use.
--
-- /See:/ 'newAccountUsage' smart constructor.
data AccountUsage = AccountUsage'
  { -- | The number of Lambda functions.
    AccountUsage -> Maybe Integer
functionCount :: Prelude.Maybe Prelude.Integer,
    -- | The amount of storage space, in bytes, that\'s being used by deployment
    -- packages and layer archives.
    AccountUsage -> Maybe Integer
totalCodeSize :: Prelude.Maybe Prelude.Integer
  }
  deriving (AccountUsage -> AccountUsage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountUsage -> AccountUsage -> Bool
$c/= :: AccountUsage -> AccountUsage -> Bool
== :: AccountUsage -> AccountUsage -> Bool
$c== :: AccountUsage -> AccountUsage -> Bool
Prelude.Eq, ReadPrec [AccountUsage]
ReadPrec AccountUsage
Int -> ReadS AccountUsage
ReadS [AccountUsage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountUsage]
$creadListPrec :: ReadPrec [AccountUsage]
readPrec :: ReadPrec AccountUsage
$creadPrec :: ReadPrec AccountUsage
readList :: ReadS [AccountUsage]
$creadList :: ReadS [AccountUsage]
readsPrec :: Int -> ReadS AccountUsage
$creadsPrec :: Int -> ReadS AccountUsage
Prelude.Read, Int -> AccountUsage -> ShowS
[AccountUsage] -> ShowS
AccountUsage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountUsage] -> ShowS
$cshowList :: [AccountUsage] -> ShowS
show :: AccountUsage -> String
$cshow :: AccountUsage -> String
showsPrec :: Int -> AccountUsage -> ShowS
$cshowsPrec :: Int -> AccountUsage -> ShowS
Prelude.Show, forall x. Rep AccountUsage x -> AccountUsage
forall x. AccountUsage -> Rep AccountUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountUsage x -> AccountUsage
$cfrom :: forall x. AccountUsage -> Rep AccountUsage x
Prelude.Generic)

-- |
-- Create a value of 'AccountUsage' 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:
--
-- 'functionCount', 'accountUsage_functionCount' - The number of Lambda functions.
--
-- 'totalCodeSize', 'accountUsage_totalCodeSize' - The amount of storage space, in bytes, that\'s being used by deployment
-- packages and layer archives.
newAccountUsage ::
  AccountUsage
newAccountUsage :: AccountUsage
newAccountUsage =
  AccountUsage'
    { $sel:functionCount:AccountUsage' :: Maybe Integer
functionCount = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCodeSize:AccountUsage' :: Maybe Integer
totalCodeSize = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of Lambda functions.
accountUsage_functionCount :: Lens.Lens' AccountUsage (Prelude.Maybe Prelude.Integer)
accountUsage_functionCount :: Lens' AccountUsage (Maybe Integer)
accountUsage_functionCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountUsage' {Maybe Integer
functionCount :: Maybe Integer
$sel:functionCount:AccountUsage' :: AccountUsage -> Maybe Integer
functionCount} -> Maybe Integer
functionCount) (\s :: AccountUsage
s@AccountUsage' {} Maybe Integer
a -> AccountUsage
s {$sel:functionCount:AccountUsage' :: Maybe Integer
functionCount = Maybe Integer
a} :: AccountUsage)

-- | The amount of storage space, in bytes, that\'s being used by deployment
-- packages and layer archives.
accountUsage_totalCodeSize :: Lens.Lens' AccountUsage (Prelude.Maybe Prelude.Integer)
accountUsage_totalCodeSize :: Lens' AccountUsage (Maybe Integer)
accountUsage_totalCodeSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountUsage' {Maybe Integer
totalCodeSize :: Maybe Integer
$sel:totalCodeSize:AccountUsage' :: AccountUsage -> Maybe Integer
totalCodeSize} -> Maybe Integer
totalCodeSize) (\s :: AccountUsage
s@AccountUsage' {} Maybe Integer
a -> AccountUsage
s {$sel:totalCodeSize:AccountUsage' :: Maybe Integer
totalCodeSize = Maybe Integer
a} :: AccountUsage)

instance Data.FromJSON AccountUsage where
  parseJSON :: Value -> Parser AccountUsage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountUsage"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> AccountUsage
AccountUsage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FunctionCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TotalCodeSize")
      )

instance Prelude.Hashable AccountUsage where
  hashWithSalt :: Int -> AccountUsage -> Int
hashWithSalt Int
_salt AccountUsage' {Maybe Integer
totalCodeSize :: Maybe Integer
functionCount :: Maybe Integer
$sel:totalCodeSize:AccountUsage' :: AccountUsage -> Maybe Integer
$sel:functionCount:AccountUsage' :: AccountUsage -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
functionCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalCodeSize

instance Prelude.NFData AccountUsage where
  rnf :: AccountUsage -> ()
rnf AccountUsage' {Maybe Integer
totalCodeSize :: Maybe Integer
functionCount :: Maybe Integer
$sel:totalCodeSize:AccountUsage' :: AccountUsage -> Maybe Integer
$sel:functionCount:AccountUsage' :: AccountUsage -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
functionCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalCodeSize