CountLimit

Enforce simultaneous access to resources

Table 1. Supported parameters
Parameter Required Data type Details
limits Yes array A list of count limits to be applied, each with an operation
name Yes string The name of the count limit action. Required. Identifies the action in log and error messages and helps ensure that every inline limit in the action is unique within the assembly
Table 2. Options for limits
Parameter Required Data type Details
inline Yes object A limit that is defined in the action, in the definition field
ref Yes object A reference to a count limit defined in the gateway configuration
alias Yes object A reference to a limit alias declared in the countLimitMap of a plan
Table 3. Nested properties inside inline
Parameter Required Data type Details
definition Yes object The parameters of this limit
name Yes string The name of this limit. Should be unique within this action
operation No object The operation to apply to this limit
Table 4. Nested properties inside definition
Parameter Required Data type Details
autoDecrement No boolean If true (default), the count limit is automatically decremented at the end of the transaction by the amount it was incremented during the transaction. If false, the count is only decremented by a Decrement operation.
dynamicValue No string or null JSONata expression to be added to the limit key; evaluates to a string
max Yes integer Max allowed for this count limit. A value of 0 means "unlimited" (any number of calls are allowed). Value must be greater or equal to 0.
weightExpr No string or null JSONata expression for the weight of a call (i.e., the amount by which the count is incremented or decremented). Must evaluate to a positive integer. If not set, the weight defaults to 1.
Table 5. Options for operation
Parameter Required Data type Details
increment No enum (of string) Increment the count by the evaluated weight, unless it would exceed max (in which case the count is not incremented, and the action immediately returns a LimitExceeded error).
decrement No enum (of string) Decrement the count by the evaluated weight
Table 6. Nested properties inside ref
Parameter Required Data type Details
name Yes string The name of a limit defined in the components.countLimits section of the gateway configuration
operation No object The operation to apply to this limit
Table 7. Nested properties inside alias
Parameter Required Data type Details
name Yes string The name of a key in the countLimit map of a plan
operation No object Operation to apply to a count limit in an action