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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (AccountLimit -> AccountLimit -> Bool
(AccountLimit -> AccountLimit -> Bool)
-> (AccountLimit -> AccountLimit -> Bool) -> Eq AccountLimit
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]
(Int -> ReadS AccountLimit)
-> ReadS [AccountLimit]
-> ReadPrec AccountLimit
-> ReadPrec [AccountLimit]
-> Read 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
(Int -> AccountLimit -> ShowS)
-> (AccountLimit -> String)
-> ([AccountLimit] -> ShowS)
-> Show AccountLimit
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. AccountLimit -> Rep AccountLimit x)
-> (forall x. Rep AccountLimit x -> AccountLimit)
-> Generic AccountLimit
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:
--
-- '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.
--
-- '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.
newAccountLimit ::
  AccountLimit
newAccountLimit :: AccountLimit
newAccountLimit =
  AccountLimit' :: Maybe Int
-> Maybe Integer
-> Maybe Natural
-> Maybe Integer
-> Maybe Integer
-> AccountLimit
AccountLimit'
    { $sel:concurrentExecutions:AccountLimit' :: Maybe Int
concurrentExecutions =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCodeSize:AccountLimit' :: Maybe Integer
totalCodeSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:unreservedConcurrentExecutions:AccountLimit' :: Maybe Natural
unreservedConcurrentExecutions = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:codeSizeUnzipped:AccountLimit' :: Maybe Integer
codeSizeUnzipped = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:codeSizeZipped:AccountLimit' :: Maybe Integer
codeSizeZipped = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of simultaneous function executions.
accountLimit_concurrentExecutions :: Lens.Lens' AccountLimit (Prelude.Maybe Prelude.Int)
accountLimit_concurrentExecutions :: (Maybe Int -> f (Maybe Int)) -> AccountLimit -> f AccountLimit
accountLimit_concurrentExecutions = (AccountLimit -> Maybe Int)
-> (AccountLimit -> Maybe Int -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Int) (Maybe Int)
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 :: (Maybe Integer -> f (Maybe Integer))
-> AccountLimit -> f AccountLimit
accountLimit_totalCodeSize = (AccountLimit -> Maybe Integer)
-> (AccountLimit -> Maybe Integer -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Integer) (Maybe Integer)
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 :: (Maybe Natural -> f (Maybe Natural))
-> AccountLimit -> f AccountLimit
accountLimit_unreservedConcurrentExecutions = (AccountLimit -> Maybe Natural)
-> (AccountLimit -> Maybe Natural -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe Integer -> f (Maybe Integer))
-> AccountLimit -> f AccountLimit
accountLimit_codeSizeUnzipped = (AccountLimit -> Maybe Integer)
-> (AccountLimit -> Maybe Integer -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Integer) (Maybe Integer)
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 :: (Maybe Integer -> f (Maybe Integer))
-> AccountLimit -> f AccountLimit
accountLimit_codeSizeZipped = (AccountLimit -> Maybe Integer)
-> (AccountLimit -> Maybe Integer -> AccountLimit)
-> Lens AccountLimit AccountLimit (Maybe Integer) (Maybe Integer)
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)

instance Core.FromJSON AccountLimit where
  parseJSON :: Value -> Parser AccountLimit
parseJSON =
    String
-> (Object -> Parser AccountLimit) -> Value -> Parser AccountLimit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccountLimit"
      ( \Object
x ->
          Maybe Int
-> Maybe Integer
-> Maybe Natural
-> Maybe Integer
-> Maybe Integer
-> AccountLimit
AccountLimit'
            (Maybe Int
 -> Maybe Integer
 -> Maybe Natural
 -> Maybe Integer
 -> Maybe Integer
 -> AccountLimit)
-> Parser (Maybe Int)
-> Parser
     (Maybe Integer
      -> Maybe Natural -> Maybe Integer -> Maybe Integer -> AccountLimit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConcurrentExecutions")
            Parser
  (Maybe Integer
   -> Maybe Natural -> Maybe Integer -> Maybe Integer -> AccountLimit)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Natural -> Maybe Integer -> Maybe Integer -> AccountLimit)
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
"TotalCodeSize")
            Parser
  (Maybe Natural -> Maybe Integer -> Maybe Integer -> AccountLimit)
-> Parser (Maybe Natural)
-> Parser (Maybe Integer -> Maybe Integer -> AccountLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UnreservedConcurrentExecutions")
            Parser (Maybe Integer -> Maybe Integer -> AccountLimit)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> AccountLimit)
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
"CodeSizeUnzipped")
            Parser (Maybe Integer -> AccountLimit)
-> Parser (Maybe Integer) -> Parser AccountLimit
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
"CodeSizeZipped")
      )

instance Prelude.Hashable AccountLimit

instance Prelude.NFData AccountLimit