{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lambda.Types
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
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]
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
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. 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'
{ $sel:functionName:PutFunctionConcurrency' :: Text
functionName =
Text
pFunctionName_,
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: Natural
reservedConcurrentExecutions =
Natural
pReservedConcurrentExecutions_
}
putFunctionConcurrency_functionName :: Lens.Lens' PutFunctionConcurrency Prelude.Text
putFunctionConcurrency_functionName :: Lens' PutFunctionConcurrency Text
putFunctionConcurrency_functionName = 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 :: Lens' PutFunctionConcurrency Natural
putFunctionConcurrency_reservedConcurrentExecutions = 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 :: (Service -> Service)
-> PutFunctionConcurrency -> Request PutFunctionConcurrency
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutFunctionConcurrency
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutFunctionConcurrency)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable PutFunctionConcurrency where
hashWithSalt :: Int -> PutFunctionConcurrency -> Int
hashWithSalt Int
_salt PutFunctionConcurrency' {Natural
Text
reservedConcurrentExecutions :: Natural
functionName :: Text
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
functionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
reservedConcurrentExecutions
instance Prelude.NFData PutFunctionConcurrency where
rnf :: PutFunctionConcurrency -> ()
rnf PutFunctionConcurrency' {Natural
Text
reservedConcurrentExecutions :: Natural
functionName :: Text
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
functionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
reservedConcurrentExecutions
instance Data.ToHeaders PutFunctionConcurrency where
toHeaders :: PutFunctionConcurrency -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"ReservedConcurrentExecutions"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
reservedConcurrentExecutions
)
]
)
instance Data.ToPath PutFunctionConcurrency where
toPath :: PutFunctionConcurrency -> ByteString
toPath PutFunctionConcurrency' {Natural
Text
reservedConcurrentExecutions :: Natural
functionName :: Text
$sel:reservedConcurrentExecutions:PutFunctionConcurrency' :: PutFunctionConcurrency -> Natural
$sel:functionName:PutFunctionConcurrency' :: PutFunctionConcurrency -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2017-10-31/functions/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
functionName,
ByteString
"/concurrency"
]
instance Data.ToQuery PutFunctionConcurrency where
toQuery :: PutFunctionConcurrency -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty