Rate Limit
Rate Limit configuration allows Inigo's users to apply fine-grained traffic controls. Not all clients are the same; you may have authenticated and unauthenticated clients using your application. Using the rate limit capability of inigo, you can enforce rate limiting policies depending on the authentication and authorization context of your clients.
Sample Config
rate_limit.yaml
kind: RateLimit
name: demo
label: starwars
spec:
profiles:
- name: guest
path_calls:
- path: query.films
allowance: 5
period: 10m
- path: query.people
allowance: 10
period: 1h30m
Spec
This section defines the format of Inigo's RateLimit type configuration files. Fields marked as required must be specified if the parent is defined.
| Field | Type | Description |
|---|---|---|
| profile_default_values | RateLimitProfileDefaultValues | |
| profiles | [RateLimitProfile] |
RateLimitProfileDefaultValues
| Field | Type | Description |
|---|---|---|
| extension_output | boolean | Adds rate limit-related information to the extensions response JSON key named rate_limiter. |
| path_calls | [RateLimitCallConfig] | Adds rate limit based on path. For example: "query.version.date" |
| type_calls | [RateLimitCallConfig] | Adds rate limit based on type + field. For example: "Version.date" |
| credits | [RateLimitCreditConfig] |
RateLimitCallConfig
| Field | Type | Description |
|---|---|---|
| path | string required | |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |
| period | string required | String represents the duration in the form "72h3m0.5s". |
| filter | RateLimitFilter |
RateLimitFilter
| Field | Type | Description |
|---|---|---|
| has_errors | boolean |
RateLimitCallConfig
| Field | Type | Description |
|---|---|---|
| path | string required | |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |
| period | string required | String represents the duration in the form "72h3m0.5s". |
| filter | RateLimitFilter |
RateLimitFilter
| Field | Type | Description |
|---|---|---|
| has_errors | boolean |
RateLimitCreditConfig
| Field | Type | Description |
|---|---|---|
| period | string required | String represents the duration in the form "72h3m0.5s". |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |
RateLimitProfile
| Field | Type | Description |
|---|---|---|
| Name | string required | Name of the profile. |
| extension_output | boolean | Adds rate limit-related information to the extensions response JSON key named rate_limiter. |
| path_calls | [RateLimitCallConfig] | Adds rate limit based on path. For example: "query.version.date" |
| type_calls | [RateLimitCallConfig] | Adds rate limit based on type + field. For example: "Version.date" |
| credits | [RateLimitCreditConfig] |
RateLimitCallConfig
| Field | Type | Description |
|---|---|---|
| path | string required | |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |
| period | string required | String represents the duration in the form "72h3m0.5s". |
| filter | RateLimitFilter |
RateLimitFilter
| Field | Type | Description |
|---|---|---|
| has_errors | boolean |
RateLimitCallConfig
| Field | Type | Description |
|---|---|---|
| path | string required | |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |
| period | string required | String represents the duration in the form "72h3m0.5s". |
| filter | RateLimitFilter |
RateLimitFilter
| Field | Type | Description |
|---|---|---|
| has_errors | boolean |
RateLimitCreditConfig
| Field | Type | Description |
|---|---|---|
| period | string required | String represents the duration in the form "72h3m0.5s". |
| allowance | string | number required | It can be either a regular number or a string with one of the following suffixes 'k', 'M'. Example: 1k, 20M. |