assembly-count-limit
This command specifies an assembly count limit scheme to apply to a rate limit policy.
Syntax
assembly-count-limit scheme count [hard-limit] [cache-first] [is-client] [use-api-name] [use-app-id] [use-client-id] [dynamic-value] [weight] [autodecrement]
Parameters
- scheme
- The name for the rate limit scheme.
Assembly limits defined in different configurations, including an API gateway, API collection, or API plan, need unique names. If two limits with the same name are used in an assembly and both limits are applied, then information about only one limit is included in the response headers.
- count
- The maximum number of transactions to allow with the rate limit interval.
- hard-limit
- Whether to reject requests when the specified rate limit is reached. The default value
is
on.on- Reject the requests when the limit is exceeded.
off- Accept and process requests when the specified rate limit is reached but produces a warning message.
- cache-first
- Whether to use the local cache first to enforce the count limit. In peer group mode,
the local cache first can prevent transaction delays if communication problems arise across the peer
group. However, the transaction count is less precise when this setting is enabled. The default
setting is
on. - is-client
- Whether to apply the count limit to the client or to an internal component. Client
burst limits return a 429 error when exceeded. Nonclient burst limits return a 503 error when
exceeded. The default setting is
off. When set tooff, count limit information is not included in the response header. - use-api-name
- Whether to use the API name as part of the count limit key. The default value is
off. - use-app-id
- Whether to use the application ID as part of the count limit key. The default value is
off. - use-client-id
- Whether to use the client ID as part of the count limit key. The default value is
off. - dynamic-value
- The dynamic value string for the count limit, which contains one or more context
variables. The dynamic value makes it possible to use a context variable to enforce the limit based
on parameters that are not defined in the scheme. The context variable can be set in a GatewayScript
action and then included in the dynamic value. The default value is an empty string.The following example uses the
contextobject in a GatewayScript action to add themy.servervariable to the API context. You can then provide the$(my.server)variable that resolves to theserver34server.context.set("my.server", "server34") - weight
- The JSONata expression that assigns a weight value to the transaction. For more information, see JSONata notation in policies.
- autodecrement
- Whether to automatically decrement the count limit for each transaction. The default
value is
on.on- Automatically decrement the count limit at the end of the assembly. The decremented amount is the incremented count during the assembly minus any decrement actions in the rate limit policy. You do not need to explicitly define decrement actions unless you want the decrements to occur at specific points in the assembly.
off- Do not automatically decrement the count limit at the end of the assembly. You must explicitly define a decrement action for each corresponding increment action.
Guidelines
The assembly-count-limit command specifies an assembly count limit scheme to apply to a rate limit policy.