{-# 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.AccountLimit
-- 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.AccountLimit 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

-- | Limits that are related to concurrency and storage. All file and storage
-- sizes are in bytes.
--
-- /See:/ 'newAccountLimit' smart constructor.
data AccountLimit = AccountLimit'
  { -- | The maximum size of a function\'s deployment package and layers when
    -- they\'re extracted.
    AccountLimit -> Maybe Integer
codeSizeUnzipped :: Prelude.Maybe Prelude.Integer,
    -- | The maximum size of a deployment package when it\'s uploaded directly to
    -- Lambda. Use Amazon S3 for larger files.
    AccountLimit -> Maybe Integer
codeSizeZipped :: Prelude.Maybe Prelude.Integer,
    -- | The maximum number of simultaneous function executions.
    AccountLimit -> Maybe Int
concurrentExecutions :: Prelude.Maybe Prelude.Int,
    -- | The amount of storage space that you can use for all deployment packages
    -- and layer archives.
    AccountLimit -> Maybe Integer
totalCodeSize :: Prelude.Maybe Prelude.Integer,
    -- | The maximum number of simultaneous function executions, minus the
    -- capacity that\'s reserved for individual functions with
    -- PutFunctionConcurrency.
    AccountLimit -> Maybe Natural
unreservedConcurrentExecutions :: Prelude.Maybe Prelude.Natural
  }
  deriving (AccountLimit -> AccountLimit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountLimit -> AccountLimit -> Bool
$c/= :: AccountLimit -> AccountLimit -> Bool
== :: AccountLimit -> AccountLimit -> Bool
$c== :: AccountLimit -> AccountLimit -> Bool
Prelude.Eq, ReadPrec [AccountLimit]
ReadPrec AccountLimit
Int -> ReadS AccountLimit
ReadS [AccountLimit]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountLimit]
$creadListPrec :: ReadPrec [AccountLimit]
readPrec :: ReadPrec AccountLimit
$creadPrec :: ReadPrec AccountLimit
readList :: ReadS [AccountLimit]
$creadList :: ReadS [AccountLimit]
readsPrec :: Int -> ReadS AccountLimit
$creadsPrec :: Int -> ReadS AccountLimit
Prelude.Read, Int -> AccountLimit -> ShowS
[AccountLimit] -> ShowS
AccountLimit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountLimit] -> ShowS
$cshowList :: [AccountLimit] -> ShowS
show :: AccountLimit -> String
$cshow :: AccountLimit -> String
showsPrec :: Int -> AccountLimit -> ShowS
$cshowsPrec :: Int -> AccountLimit -> ShowS
Prelude.Show, forall x. Rep AccountLimit x -> AccountLimit
forall x. AccountLimit -> Rep AccountLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountLimit x -> AccountLimit
$cfrom :: forall x. AccountLimit -> Rep AccountLimit x
Prelude.Generic)

-- |
-- Create a value of 'AccountLimit' 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:
--
-- 'codeSizeUnzipped', 'accountLimit_codeSizeUnzipped' - The maximum size of a function\'s deployment package and layers when
-- they\'re extracted.
--
-- 'codeSizeZipped', 'accountLimit_codeSizeZipped' - The maximum size of a deployment package when it\'s uploaded directly to
-- Lambda. Use Amazon S3 for larger files.
--
-- 'concurrentExecutions', 'accountLimit_concurrentExecutions' - The maximum number of simultaneous function executions.
--
-- 'totalCodeSize', 'accountLimit_totalCodeSize' - The amount of storage space that you can use for all deployment packages
-- and layer archives.
--
-- 'unreservedConcurrentExecutions', 'accountLimit_unreservedConcurrentExecutions' - The maximum number of simultaneous function executions, minus the
-- capacity that\'s reserved for individual functions with
-- PutFunctionConcurrency.
newAccountLimit ::
  AccountLimit
newAccountLimit :: AccountLimit
newAccountLimit =
  AccountLimit'
    { $sel:codeSizeUnzipped:AccountLimit' :: Maybe Integer
codeSizeUnzipped = forall a. Maybe a
Prelude.Nothing,
      $sel:codeSizeZipped:AccountLimit' :: Maybe Integer
codeSizeZipped = forall a. Maybe a
Prelude.Nothing,
      $sel:concurrentExecutions:AccountLimit' :: Maybe Int
concurrentExecutions = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCodeSize:AccountLimit' :: Maybe Integer
totalCodeSize = forall a. Maybe a
Prelude.Nothing,
      $sel:unreservedConcurrentExecutions:AccountLimit' :: Maybe Natural
unreservedConcurrentExecutions = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum size of a function\'s deployment package and layers when
-- they\'re extracted.
accountLimit_codeSizeUnzipped :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Integer)
accountLimit_codeSizeUnzipped :: Lens' AccountLimit (Maybe Integer)
accountLimit_codeSizeUnzipped = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Integer
codeSizeUnzipped :: Maybe Integer
$sel:codeSizeUnzipped:AccountLimit' :: AccountLimit -> Maybe Integer
codeSizeUnzipped} -> Maybe Integer
codeSizeUnzipped) (\s :: AccountLimit
s@AccountLimit' {} Maybe Integer
a -> AccountLimit
s {$sel:codeSizeUnzipped:AccountLimit' :: Maybe Integer
codeSizeUnzipped = Maybe Integer
a} :: AccountLimit)

-- | The maximum size of a deployment package when it\'s uploaded directly to
-- Lambda. Use Amazon S3 for larger files.
accountLimit_codeSizeZipped :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Integer)
accountLimit_codeSizeZipped :: Lens' AccountLimit (Maybe Integer)
accountLimit_codeSizeZipped = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Integer
codeSizeZipped :: Maybe Integer
$sel:codeSizeZipped:AccountLimit' :: AccountLimit -> Maybe Integer
codeSizeZipped} -> Maybe Integer
codeSizeZipped) (\s :: AccountLimit
s@AccountLimit' {} Maybe Integer
a -> AccountLimit
s {$sel:codeSizeZipped:AccountLimit' :: Maybe Integer
codeSizeZipped = Maybe Integer
a} :: AccountLimit)

-- | The maximum number of simultaneous function executions.
accountLimit_concurrentExecutions :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Int)
accountLimit_concurrentExecutions :: Lens' AccountLimit (Maybe Int)
accountLimit_concurrentExecutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Int
concurrentExecutions :: Maybe Int
$sel:concurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Int
concurrentExecutions} -> Maybe Int
concurrentExecutions) (\s :: AccountLimit
s@AccountLimit' {} Maybe Int
a -> AccountLimit
s {$sel:concurrentExecutions:AccountLimit' :: Maybe Int
concurrentExecutions = Maybe Int
a} :: AccountLimit)

-- | The amount of storage space that you can use for all deployment packages
-- and layer archives.
accountLimit_totalCodeSize :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Integer)
accountLimit_totalCodeSize :: Lens' AccountLimit (Maybe Integer)
accountLimit_totalCodeSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Integer
totalCodeSize :: Maybe Integer
$sel:totalCodeSize:AccountLimit' :: AccountLimit -> Maybe Integer
totalCodeSize} -> Maybe Integer
totalCodeSize) (\s :: AccountLimit
s@AccountLimit' {} Maybe Integer
a -> AccountLimit
s {$sel:totalCodeSize:AccountLimit' :: Maybe Integer
totalCodeSize = Maybe Integer
a} :: AccountLimit)

-- | The maximum number of simultaneous function executions, minus the
-- capacity that\'s reserved for individual functions with
-- PutFunctionConcurrency.
accountLimit_unreservedConcurrentExecutions :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Natural)
accountLimit_unreservedConcurrentExecutions :: Lens' AccountLimit (Maybe Natural)
accountLimit_unreservedConcurrentExecutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLimit' {Maybe Natural
unreservedConcurrentExecutions :: Maybe Natural
$sel:unreservedConcurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Natural
unreservedConcurrentExecutions} -> Maybe Natural
unreservedConcurrentExecutions) (\s :: AccountLimit
s@AccountLimit' {} Maybe Natural
a -> AccountLimit
s {$sel:unreservedConcurrentExecutions:AccountLimit' :: Maybe Natural
unreservedConcurrentExecutions = Maybe Natural
a} :: AccountLimit)

instance Data.FromJSON AccountLimit where
  parseJSON :: Value -> Parser AccountLimit
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountLimit"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Int
-> Maybe Integer
-> Maybe Natural
-> AccountLimit
AccountLimit'
            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
"CodeSizeUnzipped")
            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
"CodeSizeZipped")
            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
"ConcurrentExecutions")
            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")
            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
"UnreservedConcurrentExecutions")
      )

instance Prelude.Hashable AccountLimit where
  hashWithSalt :: Int -> AccountLimit -> Int
hashWithSalt Int
_salt AccountLimit' {Maybe Int
Maybe Integer
Maybe Natural
unreservedConcurrentExecutions :: Maybe Natural
totalCodeSize :: Maybe Integer
concurrentExecutions :: Maybe Int
codeSizeZipped :: Maybe Integer
codeSizeUnzipped :: Maybe Integer
$sel:unreservedConcurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Natural
$sel:totalCodeSize:AccountLimit' :: AccountLimit -> Maybe Integer
$sel:concurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Int
$sel:codeSizeZipped:AccountLimit' :: AccountLimit -> Maybe Integer
$sel:codeSizeUnzipped:AccountLimit' :: AccountLimit -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
codeSizeUnzipped
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
codeSizeZipped
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
concurrentExecutions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalCodeSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
unreservedConcurrentExecutions

instance Prelude.NFData AccountLimit where
  rnf :: AccountLimit -> ()
rnf AccountLimit' {Maybe Int
Maybe Integer
Maybe Natural
unreservedConcurrentExecutions :: Maybe Natural
totalCodeSize :: Maybe Integer
concurrentExecutions :: Maybe Int
codeSizeZipped :: Maybe Integer
codeSizeUnzipped :: Maybe Integer
$sel:unreservedConcurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Natural
$sel:totalCodeSize:AccountLimit' :: AccountLimit -> Maybe Integer
$sel:concurrentExecutions:AccountLimit' :: AccountLimit -> Maybe Int
$sel:codeSizeZipped:AccountLimit' :: AccountLimit -> Maybe Integer
$sel:codeSizeUnzipped:AccountLimit' :: AccountLimit -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
codeSizeUnzipped
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
codeSizeZipped
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
concurrentExecutions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalCodeSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
unreservedConcurrentExecutions