{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Lambda.PutFunctionConcurrency
(
PutFunctionConcurrency (..),
newPutFunctionConcurrency,
putFunctionConcurrency_functionName,
putFunctionConcurrency_reservedConcurrentExecutions,
Concurrency (..),
newConcurrency,
concurrency_reservedConcurrentExecutions,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutFunctionConcurrency = PutFunctionConcurrency'
{
PutFunctionConcurrency -> Text
functionName :: Prelude.Text,
PutFunctionConcurrency -> Natural
reservedConcurrentExecutions :: Prelude.Natural
}
deriving (PutFunctionConcurrency -> PutFunctionConcurrency -> Bool
(PutFunctionConcurrency -> PutFunctionConcurrency -> Bool)
-> (PutFunctionConcurrency -> PutFunctionConcurrency -> Bool)
-> Eq PutFunctionConcurrency
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutFunctionConcurrency -> PutFunctionConcurrency -> Bool
$c/= :: PutFunctionConcurrency -> PutFunctionConcurrency -> Bool
== :: PutFunctionConcurrency -> PutFunctionConcurrency -> Bool
$c== :: PutFunctionConcurrency -> PutFunctionConcurrency -> Bool
Prelude.Eq, ReadPrec [PutFunctionConcurrency]
ReadPrec PutFunctionConcurrency
Int -> ReadS PutFunctionConcurrency
ReadS [PutFunctionConcurrency]
(Int -> ReadS PutFunctionConcurrency)
-> ReadS [PutFunctionConcurrency]
-> ReadPrec PutFunctionConcurrency
-> ReadPrec [PutFunctionConcurrency]
-> Read PutFunctionConcurrency
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutFunctionConcurrency]
$creadListPrec :: ReadPrec [PutFunctionConcurrency]
readPrec :: ReadPrec PutFunctionConcurrency
$creadPrec :: ReadPrec PutFunctionConcurrency
readList :: ReadS [PutFunctionConcurrency]
$creadList :: ReadS [PutFunctionConcurrency]
readsPrec :: Int -> ReadS PutFunctionConcurrency
$creadsPrec :: Int -> ReadS PutFunctionConcurrency
Prelude.Read, Int -> PutFunctionConcurrency -> ShowS
[PutFunctionConcurrency] -> ShowS
PutFunctionConcurrency -> String
(Int -> PutFunctionConcurrency -> ShowS)
-> (PutFunctionConcurrency -> String)
-> ([PutFunctionConcurrency] -> ShowS)
-> Show PutFunctionConcurrency
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutFunctionConcurrency] -> ShowS
$cshowList :: [PutFunctionConcurrency] -> ShowS
show :: PutFunctionConcurrency -> String
$cshow :: PutFunctionConcurrency -> String
showsPrec :: Int -> PutFunctionConcurrency -> ShowS
$cshowsPrec :: Int -> PutFunctionConcurrency -> ShowS
Prelude.Show, (forall x. PutFunctionConcurrency -> Rep PutFunctionConcurrency x)
-> (forall x.
Rep PutFunctionConcurrency x -> PutFunctionConcurrency)
-> Generic PutFunctionConcurrency
forall x. Rep PutFunctionConcurrency x -> PutFunctionConcurrency
forall x. PutFunctionConcurrency -> Rep PutFunctionConcurrency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutFunctionConcurrency x -> PutFunctionConcurrency
$cfrom :: forall x. PutFunctionConcurrency -> Rep PutFunctionConcurrency x
Prelude.Generic)
newPutFunctionConcurrency ::
Prelude.Text ->
Prelude.Natural ->
PutFunctionConcurrency
newPutFunctionConcurrency :: Text -> Natural -> PutFunctionConcurrency
newPutFunctionConcurrency
Text
pFunctionName_
Natural
pReservedConcurrentExecutions_ =
PutFunctionConcurrency' :: Text -> Natural -> PutFunctionConcurrency
PutFunctionConcurrency'
{ $sel:functionName:PutFunctionConcurrency' :: Text
functionName =
Text
pFunctionName_,
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: Natural
reservedConcurrentExecutions =
Natural
pReservedConcurrentExecutions_
}
putFunctionConcurrency_functionName :: Lens.Lens' PutFunctionConcurrency Prelude.Text
putFunctionConcurrency_functionName :: (Text -> f Text)
-> PutFunctionConcurrency -> f PutFunctionConcurrency
putFunctionConcurrency_functionName = (PutFunctionConcurrency -> Text)
-> (PutFunctionConcurrency -> Text -> PutFunctionConcurrency)
-> Lens PutFunctionConcurrency PutFunctionConcurrency Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionConcurrency' {Text
functionName :: Text
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
functionName} -> Text
functionName) (\s :: PutFunctionConcurrency
s@PutFunctionConcurrency' {} Text
a -> PutFunctionConcurrency
s {$sel:functionName:PutFunctionConcurrency' :: Text
functionName = Text
a} :: PutFunctionConcurrency)
putFunctionConcurrency_reservedConcurrentExecutions :: Lens.Lens' PutFunctionConcurrency Prelude.Natural
putFunctionConcurrency_reservedConcurrentExecutions :: (Natural -> f Natural)
-> PutFunctionConcurrency -> f PutFunctionConcurrency
putFunctionConcurrency_reservedConcurrentExecutions = (PutFunctionConcurrency -> Natural)
-> (PutFunctionConcurrency -> Natural -> PutFunctionConcurrency)
-> Lens
PutFunctionConcurrency PutFunctionConcurrency Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionConcurrency' {Natural
reservedConcurrentExecutions :: Natural
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
reservedConcurrentExecutions} -> Natural
reservedConcurrentExecutions) (\s :: PutFunctionConcurrency
s@PutFunctionConcurrency' {} Natural
a -> PutFunctionConcurrency
s {$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: Natural
reservedConcurrentExecutions = Natural
a} :: PutFunctionConcurrency)
instance Core.AWSRequest PutFunctionConcurrency where
type AWSResponse PutFunctionConcurrency = Concurrency
request :: PutFunctionConcurrency -> Request PutFunctionConcurrency
request = Service -> PutFunctionConcurrency -> Request PutFunctionConcurrency
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutFunctionConcurrency
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutFunctionConcurrency)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutFunctionConcurrency))
-> Logger
-> Service
-> Proxy PutFunctionConcurrency
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutFunctionConcurrency)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String Concurrency
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable PutFunctionConcurrency
instance Prelude.NFData PutFunctionConcurrency
instance Core.ToHeaders PutFunctionConcurrency where
toHeaders :: PutFunctionConcurrency -> ResponseHeaders
toHeaders = ResponseHeaders -> PutFunctionConcurrency -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutFunctionConcurrency where
toJSON :: PutFunctionConcurrency -> Value
toJSON PutFunctionConcurrency' {Natural
Text
reservedConcurrentExecutions :: Natural
functionName :: Text
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ReservedConcurrentExecutions"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
reservedConcurrentExecutions
)
]
)
instance Core.ToPath PutFunctionConcurrency where
toPath :: PutFunctionConcurrency -> ByteString
toPath PutFunctionConcurrency' {Natural
Text
reservedConcurrentExecutions :: Natural
functionName :: Text
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2017-10-31/functions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionName,
ByteString
"/concurrency"
]
instance Core.ToQuery PutFunctionConcurrency where
toQuery :: PutFunctionConcurrency -> QueryString
toQuery = QueryString -> PutFunctionConcurrency -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty