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

-- | /See:/ 'newConcurrency' smart constructor.
data Concurrency = Concurrency'
  { -- | The number of concurrent executions that are reserved for this function.
    -- For more information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html Managing Lambda reserved concurrency>.
    Concurrency -> Maybe Natural
reservedConcurrentExecutions :: Prelude.Maybe Prelude.Natural
  }
  deriving (Concurrency -> Concurrency -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Concurrency -> Concurrency -> Bool
$c/= :: Concurrency -> Concurrency -> Bool
== :: Concurrency -> Concurrency -> Bool
$c== :: Concurrency -> Concurrency -> Bool
Prelude.Eq, ReadPrec [Concurrency]
ReadPrec Concurrency
Int -> ReadS Concurrency
ReadS [Concurrency]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Concurrency]
$creadListPrec :: ReadPrec [Concurrency]
readPrec :: ReadPrec Concurrency
$creadPrec :: ReadPrec Concurrency
readList :: ReadS [Concurrency]
$creadList :: ReadS [Concurrency]
readsPrec :: Int -> ReadS Concurrency
$creadsPrec :: Int -> ReadS Concurrency
Prelude.Read, Int -> Concurrency -> ShowS
[Concurrency] -> ShowS
Concurrency -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Concurrency] -> ShowS
$cshowList :: [Concurrency] -> ShowS
show :: Concurrency -> String
$cshow :: Concurrency -> String
showsPrec :: Int -> Concurrency -> ShowS
$cshowsPrec :: Int -> Concurrency -> ShowS
Prelude.Show, forall x. Rep Concurrency x -> Concurrency
forall x. Concurrency -> Rep Concurrency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Concurrency x -> Concurrency
$cfrom :: forall x. Concurrency -> Rep Concurrency x
Prelude.Generic)

-- |
-- Create a value of 'Concurrency' 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:
--
-- 'reservedConcurrentExecutions', 'concurrency_reservedConcurrentExecutions' - The number of concurrent executions that are reserved for this function.
-- For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html Managing Lambda reserved concurrency>.
newConcurrency ::
  Concurrency
newConcurrency :: Concurrency
newConcurrency =
  Concurrency'
    { $sel:reservedConcurrentExecutions:Concurrency' :: Maybe Natural
reservedConcurrentExecutions =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The number of concurrent executions that are reserved for this function.
-- For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html Managing Lambda reserved concurrency>.
concurrency_reservedConcurrentExecutions :: Lens.Lens' Concurrency (Prelude.Maybe Prelude.Natural)
concurrency_reservedConcurrentExecutions :: Lens' Concurrency (Maybe Natural)
concurrency_reservedConcurrentExecutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Concurrency' {Maybe Natural
reservedConcurrentExecutions :: Maybe Natural
$sel:reservedConcurrentExecutions:Concurrency' :: Concurrency -> Maybe Natural
reservedConcurrentExecutions} -> Maybe Natural
reservedConcurrentExecutions) (\s :: Concurrency
s@Concurrency' {} Maybe Natural
a -> Concurrency
s {$sel:reservedConcurrentExecutions:Concurrency' :: Maybe Natural
reservedConcurrentExecutions = Maybe Natural
a} :: Concurrency)

instance Data.FromJSON Concurrency where
  parseJSON :: Value -> Parser Concurrency
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Concurrency"
      ( \Object
x ->
          Maybe Natural -> Concurrency
Concurrency'
            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
"ReservedConcurrentExecutions")
      )

instance Prelude.Hashable Concurrency where
  hashWithSalt :: Int -> Concurrency -> Int
hashWithSalt Int
_salt Concurrency' {Maybe Natural
reservedConcurrentExecutions :: Maybe Natural
$sel:reservedConcurrentExecutions:Concurrency' :: Concurrency -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
reservedConcurrentExecutions

instance Prelude.NFData Concurrency where
  rnf :: Concurrency -> ()
rnf Concurrency' {Maybe Natural
reservedConcurrentExecutions :: Maybe Natural
$sel:reservedConcurrentExecutions:Concurrency' :: Concurrency -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
reservedConcurrentExecutions