Skip to content

Commit

Permalink
docs: add more details for consumer-restriction plugin (#9971)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabriceli authored Aug 8, 2023
1 parent 8f289ba commit 8773687
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions docs/en/latest/plugins/consumer-restriction.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ The `consumer-restriction` Plugin allows users to configure access restrictions

## Attributes

| Name | Type | Required | Default | Valid values | Description |
|--------------------|---------------|----------|---------------|---------------|-------------|
| type | string | False | consumer_name | ["consumer_name", "consumer_group_id", "service_id", "route_id"] | Type of object to base the restriction on. |
| whitelist | array[string] | True | | | List of objects to whitelist. Has a higher priority than `allowed_by_methods`. |
| blacklist | array[string] | True | | | List of objects to blacklist. Has a higher priority than `whitelist`. |
| rejected_code | integer | False | 403 | [200,...] | HTTP status code returned when the request is rejected. |
| rejected_msg | string | False | | | Message returned when the request is rejected. |
| allowed_by_methods | array[object] | False | | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"] | List of allowed HTTP methods for a Consumer. |
| Name | Type | Required | Default | Valid values | Description |
| -------------------------- | ------------- | -------- | ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| type | string | False | consumer_name | ["consumer_name", "consumer_group_id", "service_id", "route_id"] | Type of object to base the restriction on. |
| whitelist | array[string] | True | | | List of objects to whitelist. Has a higher priority than `allowed_by_methods`. |
| blacklist | array[string] | True | | | List of objects to blacklist. Has a higher priority than `whitelist`. |
| rejected_code | integer | False | 403 | [200,...] | HTTP status code returned when the request is rejected. |
| rejected_msg | string | False | | | Message returned when the request is rejected. |
| allowed_by_methods | array[object] | False | | | List of allowed configurations for Consumer settings, including a username of the Consumer and a list of allowed HTTP methods. |
| allowed_by_methods.user | string | False | | | A username for a Consumer. |
| allowed_by_methods.methods | array[string] | False | | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"] | List of allowed HTTP methods for a Consumer. |

:::note

Expand Down
18 changes: 10 additions & 8 deletions docs/zh/latest/plugins/consumer-restriction.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ description: Consumer Restriction 插件允许用户根据 Route、Service 或 C

## 属性

| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
| --------- | ------------- | ------ | -----------------| -------------------------|------------------------|
| type | string || consumer_name | ["consumer_name", "consumer_group_id", "service_id", "route_id"] | 支持设置访问限制的对象类型。 |
| whitelist | array[string] || | | 加入白名单的对象,优先级高于 `allowed_by_methods`|
| blacklist | array[string] || | | 加入黑名单的对象,优先级高于 `whitelist`|
| rejected_code | integer || 403 | [200,...] | 当请求被拒绝时,返回的 HTTP 状态码。 |
| rejected_msg | string || | | 当请求被拒绝时,返回的错误信息。 |
| allowed_by_methods | array[object] || | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"] | 为 Consumer 设置的允许的 HTTP 方法列表。 |
| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
| -------------------------- | ------------- | ------ | ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| type | string || consumer_name | ["consumer_name", "consumer_group_id", "service_id", "route_id"] | 支持设置访问限制的对象类型。 |
| whitelist | array[string] || | | 加入白名单的对象,优先级高于`allowed_by_methods`|
| blacklist | array[string] || | | 加入黑名单的对象,优先级高于`whitelist`|
| rejected_code | integer || 403 | [200,...] | 当请求被拒绝时,返回的 HTTP 状态码。 |
| rejected_msg | string || | | 当请求被拒绝时,返回的错误信息。 |
| allowed_by_methods | array[object] || | | 一组为 Consumer 设置允许的配置,包括用户名和允许的 HTTP 方法列表。 |
| allowed_by_methods.user | string || | | 为 Consumer 设置的用户名。 |
| allowed_by_methods.methods | array[string] || | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"] | 为 Consumer 设置的允许的 HTTP 方法列表。 |

:::note

Expand Down

0 comments on commit 8773687

Please sign in to comment.