From fe4ebbe83cafa5d85eac1bb1b2b6c358ec6a7855 Mon Sep 17 00:00:00 2001 From: yutao04 Date: Tue, 11 Oct 2022 10:51:38 +0800 Subject: [PATCH] docs: add response-header-rewrite and static-downgrade plugin docs --- docs/plugin/percent-limit.md | 7 +++-- docs/plugin/response-header-rewrite.md | 12 +++---- docs/plugin/static-downgrade.md | 43 +++++++++++++------------- docs/plugin/ua-restriction.md | 11 ++++--- 4 files changed, 38 insertions(+), 35 deletions(-) diff --git a/docs/plugin/percent-limit.md b/docs/plugin/percent-limit.md index 4265867..073f9f6 100644 --- a/docs/plugin/percent-limit.md +++ b/docs/plugin/percent-limit.md @@ -6,9 +6,10 @@ ## 属性 -| 名称 | 类型 | 必选项 | 默认值 | 描述 | -|-------|--------|-----|-----|------------| -| 限流百分比 | number | 是 | - | 允许通过流量的百分比 | +| 名称 | 类型 | 必选项 | 范围 | 描述 | +|---------------|---------|-----|---------------|------------| +| kind | string | 是 | percent-limit | 插件类型(值固定) | +| limit_percent | integer | 是 | [0, 100] | 允许通过流量的百分比 | ## 前置条件 diff --git a/docs/plugin/response-header-rewrite.md b/docs/plugin/response-header-rewrite.md index 6245387..3c6d7c8 100644 --- a/docs/plugin/response-header-rewrite.md +++ b/docs/plugin/response-header-rewrite.md @@ -6,11 +6,11 @@ ## 属性 -| 名称 | 类型 | 必选项 | 默认值 | 描述 | -|----------|--------|-----|-------|--------------| -| Header名称 | string | 是 | - | 需要操作的响应头名称 | -| 修改类型 | select | 是 | 创建或追加 | 对响应的的操作类型 | -| 取值 | string | 是 | - | 对于响应头新增或修改的值 | +| 名称 | 类型 | 必选项 | 默认值 | 范围 | 描述 | +|----------------------|--------|-----|--------|------------------------------|--------------| +| header[].headerKey | string | 是 | - | length <= 200 | 需要操作的响应头名称 | +| header[].operation | string | 是 | create | create
update
delete | 对响应的的操作类型 | +| header[].headerValue | string | 是 | - | length <= 200 | 对于响应头新增或修改的值 | ## 前置条件 @@ -24,7 +24,7 @@ curl -XPOST -v -H "Content-Type:application/json" -d '{ "BindingObjectId": {{ 路由ID }}, "BindingObjectType": "routeRule", "GwId": {{ 网关ID }}, - "PluginConfiguration": "{\"headerKey\":[\"headerKey\": \"testHeader\",\"operation\": \"update\",\"headerValue\": \"testHeaderValue\"]}", + "PluginConfiguration": "{\"header\":[\"headerKey\": \"testHeader\",\"operation\": \"update\",\"headerValue\": \"testHeaderValue\"]}", "PluginType": "response-header-rewrite" }' http://{{ hango-portal ip:port }}/gdashboard?Action=BindingPlugin&Version=2019-09-01 ``` diff --git a/docs/plugin/static-downgrade.md b/docs/plugin/static-downgrade.md index ef5b9cd..12887b4 100644 --- a/docs/plugin/static-downgrade.md +++ b/docs/plugin/static-downgrade.md @@ -6,26 +6,27 @@ ## 属性 -| 名称 | 类型 | 必选项 | 默认值 | 描述 | -|----------------------|--------|-----|------|--------------| -| 静态降级条件/请求/是否使用请求进行匹配 | switch | 是 | 否 | 是否使用请求进行匹配 | -| - 静态降级条件/请求/请求方法 | select | 否 | - | HTTP的请求方法类型 | -| - 静态降级条件/请求/请求路径/匹配方法 | select | 是 | 精确匹配 | 请求路径匹配方式 | -| - 静态降级条件/请求/请求路径/取值 | string | 否 | - | 请求路径匹配内容 | -| - 静态降级条件/请求/域名/匹配方式 | select | 是 | 精确匹配 | 请求域名匹配方式 | -| - 静态降级条件/请求/域名/取值 | string | 否 | - | 请求域名匹配内容 | -| - 静态降级条件/请求/请求头/请求头 | string | 否 | - | 请求头匹配名称 | -| - 静态降级条件/请求/请求头/匹配方式 | select | 是 | 精确匹配 | 请求头匹配匹配方式 | -| - 静态降级条件/请求/请求头/取值 | string | 否 | - | 请求头匹配匹配内容 | -| 静态降级条件/响应/状态码/匹配方式 | select | 是 | 精确匹配 | 响应状态码匹配方式 | -| 静态降级条件/响应/状态码/取值 | string | 是 | - | 响应状态码匹配内容 | -| 静态降级条件/响应/响应头/响应头 | string | 否 | - | 响应头匹配名称 | -| 静态降级条件/响应/响应头/匹配方式 | select | 是 | 精确匹配 | 响应头匹配方式 | -| 静态降级条件/响应/响应头/取值 | string | 否 | - | 响应头匹配内容 | -| 降级后响应内容/响应状态码 | number | 是 | 200 | 降级后返回的状态码 | -| 降级后响应内容/响应头 | string | 是 | - | 降级后返回的响应头 | -| 降级后响应内容/响应头值 | string | 是 | - | 降级后返回的响应头对应值 | -| 降级后响应内容/请求响应内容 | string | 是 | - | 降级后返回的body内容 | +| 名称 | 类型 | 必选项 | 范围 | 描述 | +|-----------------------------------------|----------|-----|--------------------------------------------------------------------------------------|--------------| +| kind | string | 是 | static-downgrade | 插件类型(值固定) | +| condition.request.requestSwitch | boolean | 是 | - | 是否使用请求进行匹配 | +| condition.request.method | []string | 否 | GET
POST
PUT
DELETE
OPTIONS
HEAD
TRACE
CONNECT
PATCH | HTTP的请求方法类型 | +| condition.request.path.match_type | string | 否 | exact_match
safe_regex_match | 请求路径匹配方式 | +| condition.request.path.value | string | 否 | - | 请求路径匹配内容 | +| condition.request.host.match_type | string | 否 | exact_match
safe_regex_match | 请求域名匹配方式 | +| condition.request.host.value | string | 否 | - | 请求域名匹配内容 | +| condition.request.headers[].headerKey | string | 否 | - | 请求头匹配名称 | +| condition.request.headers[].match_type | string | 否 | exact_match
safe_regex_match | 请求头匹配匹配方式 | +| condition.request.headers[].value | string | 否 | - | 请求头匹配匹配内容 | +| condition.response.code.match_type | string | 是 | exact_match
safe_regex_match | 响应状态码匹配方式 | +| condition.response.code.value | integer | 是 | [200, 599] | 响应状态码匹配内容 | +| condition.response.headers[].headerKey | string | 否 | - | 响应头匹配名称 | +| condition.response.headers[].match_type | string | 否 | exact_match
safe_regex_match | 响应头匹配方式 | +| condition.response.headers[].value | string | 否 | - | 响应头匹配内容 | +| response.code | integer | 是 | [200, 599] | 降级后返回的状态码 | +| response.headers[key] | string | 是 | - | 降级后返回的响应头 | +| response.headers[value] | string | 是 | - | 降级后返回的响应头对应值 | +| response.body | string | 否 | - | 降级后返回的body内容 | ## 前置条件 @@ -39,7 +40,7 @@ curl -XPOST -v -H "Content-Type:application/json" -d '{ "BindingObjectId": {{ 路由ID }}, "BindingObjectType": "routeRule", "GwId": {{ 网关ID }}, - "PluginConfiguration": "{\"condition\":{\"request\":{\"requestSwitch\":true,\"method\":[\"GET\",\"POST\"],\"path\":{\"match_type\":\"exact_match\",\"value\":\"/rootpath/subpath\"},\"host\":{\"match_type\":\"exact_match\"},\"headers\":[{\"headerKey\":\"reqHeader\",\"match_type\":\"exact_match\",\"value\":\"reqHeaderValue\"}]},\"response\":{\"code\":{\"match_type\":\"safe_regex_match\",\"value\":\"503\"},\"headers\":[{\"headerKey\":\"rspHeader\",\"match_type\":\"exact_match\",\"value\":\"rspHeaderValue\"}]}},\"kind\":\"static-downgrade\",\"response\":{\"headers\":{\"downgradeHeader\":\"downgradeHeaderValue\"},\"code\":\"200\",\"body\":\"Test Response Context\"}}", + "PluginConfiguration": "{\"condition\":{\"request\":{\"requestSwitch\":true,\"method\":[\"GET\",\"POST\"],\"path\":{\"match_type\":\"exact_match\",\"value\":\"/rootpath/subpath\"},\"headers\":[{\"headerKey\":\"reqHeader\",\"match_type\":\"exact_match\",\"value\":\"reqHeaderValue\"}]},\"response\":{\"code\":{\"match_type\":\"safe_regex_match\",\"value\":\"503\"},\"headers\":[{\"headerKey\":\"rspHeader\",\"match_type\":\"exact_match\",\"value\":\"rspHeaderValue\"}]}},\"kind\":\"static-downgrade\",\"response\":{\"headers\":{\"downgradeHeader\":\"downgradeHeaderValue\"},\"code\":\"200\",\"body\":\"Test Response Context\"}}", "PluginType": "static-downgrade" }' http://{{ hango-portal ip:port }}/gdashboard?Action=BindingPlugin&Version=2019-09-01 ``` diff --git a/docs/plugin/ua-restriction.md b/docs/plugin/ua-restriction.md index dd402c5..26eabbd 100644 --- a/docs/plugin/ua-restriction.md +++ b/docs/plugin/ua-restriction.md @@ -6,11 +6,12 @@ ## 属性 -| 名称 | 类型 | 必选项 | 默认值 | 描述 | -|--------|---------|-----|----|-------------| -| 黑白名单类型 | select | 是 | - | UA黑白名单策略 | -| 匹配方式 | select | 是 | 精确匹配 | UA黑白名单策略 | -| 取值 | string | 是 | - | User-Agent值 | +| 名称 | 类型 | 必选项 | 范围 | 描述 | +|-------------------|---------|-----|---------------------------------------------------|--------------------------| +| kind | string | 是 | ua-restriction | 插件类型(值固定) | +| type | integer | 是 | [0, 1] | UA黑白名单策略
0:黑名单;1:白名单 | +| list[].match_type | string | 是 | exact_match
prefix_match
safe_regex_match | UA黑白名单策略 | +| list[].value | string | 是 | length <= 200 | User-Agent值 | ## 前置条件