
# 查询频率控制规则列表 - ListFrequencyControlRuleV2
#### 功能介绍
查询频率控制规则列表。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-aad/aad_02_0007.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-aad/abcd.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v2/aad/policies/waf/frequency-control-rule
表1Query参数 
| 参数            | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| domain_name   | 是    | String  | 域名                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| overseas_type | 否    | Integer | 防护区域，默认0。 - 0：大陆。   - 1：海外。    |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
| Content-Type | 是    | String | Content-Type                                             |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数    | 参数类型                                                                                                | 描述  |
|:---|:---|:---|
| total | Integer                                                                                             | 总数。 |
| items | Array of [FrequencyControlRule] objects | 项目。 |
   
 表4FrequencyControlRule 
| 参数                 | 参数类型                                                                                                          | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|:---|:---|:---|
| id                 | String                                                                                                        | id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| name               | String                                                                                                        | 规则名称。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| limit_num          | Integer                                                                                                       | 限制频率。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| limit_period       | Integer                                                                                                       | 限速周期。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| lock_time          | Integer                                                                                                       | 阻断时长。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| tag_type           | String                                                                                                        | 限速模式：源限速、目的限速。 源限速： - ip：IP限速，根据IP区分单个Web访问者。   - cookie：用户限速，根据Cookie键值区分单个Web访问者。   - header：用户限速，根据Header区分单个Web访问者。   - other：根据Referer（自定义请求访问的来源）字段区分单个Web访问者。    目的限速： - policy：策略限速。   - domain：域名限速。   - url：url限速。    |
| tag_index          | String                                                                                                        | 用户标识，当限速模式为用户限速（cookie或header）时。 选择cookie时，为cookie字段名。 选择header时，为需要防护的自定义HTTP首部。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| tag_condition      | [TagCondition] object                                     | 用户标识。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| action             | [ActionInfo] object                                         | 防护动作。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| conditions         | Array of [FrequencyControlCondition] objects | 限速条件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unlock_num         | Integer                                                                                                       | 放行频率。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| domain_aggregation | Boolean                                                                                                       | 域名聚合统计。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| region_aggregation | Boolean                                                                                                       | 全局计数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| captcha_lock_time  | Integer                                                                                                       | 锁定验证。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| grayscale_time     | Boolean                                                                                                       | 是否灰度生效。 - false：立即生效。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
   
 表5TagCondition 
| 参数       | 参数类型             | 描述                   |
|:---|:---|:---|
| category | String           | 用户标识字段，其值固定为referer。 |
| contents | Array of strings | 用户标识字段内容。            |
   
 表6ActionInfo 
| 参数       | 参数类型                                                                  | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|
| category | String                                                                | 防护动作类型。源限速-其他模式下，不支持人机验证（captcha）和仅记（(log）。 - captcha：人机验证。   - block：阻断。   - dynamic_block：动态阻断。   - log：仅记录。   - js_challenge：JS挑战。    |
| detail   | [DetailInfo] object | 阻断页面信息。仅支持防护动作类型为阻断（block）和动态阻断（dynamic_block）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   
 表7DetailInfo 
| 参数       | 参数类型                                                                      | 描述      |
|:---|:---|:---|
| response | [PageRespInfo] object | 阻断页面信息。 |
   
 表8PageRespInfo 
| 参数           | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|
| content_type | String | 阻断页面类型。自定义阻断页面时。 - application/json   - text/html   - text/xml。    |
| content      | String | 阻断页面内容。自定义阻断页面时必填，最长8192字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
 表9FrequencyControlCondition 
| 参数              | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|
| category        | String           | 字段类型。 - url：路径。   - ip：IPv4。   - ipv6：IPv6。   - params：Params。   - cookie：Cookie。   - header：Header。   - response_code：Response Code。    |
| index           | String           | 子字段 - 当字段类型为ip或ipv6时，index必填且必须为以下值：client-ip：客户端IP、x-forwarded-for：X-Forwarded-For、TCP连接IP：$remote_addr   - 当字段类型（category）选择"params"、"cookie"、"header"时，请根据实际需求配置子字段且该参数必填。   - 当匹配逻辑为num_greater、num_less、num_equal、num_not_equal时，子字段必须为空。   - 当子字段不为空时，最大长度不超过2048。                                                                                                                                                                                                                                                                                                                                                     |
| logic_operation | String           | 条件列表匹配逻辑。 - 如果字段类型category是url， 匹配逻辑可以为：contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal或者len_not_equal。   - 如果字段类型category是ip、ipv6或response_code，匹配逻辑可以为： equal、not_equal。   - 如果字段类型category是params、cookie或者header, 匹配逻辑可以为：contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal、len_not_equal、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist。                                                                                                                                                                                                                                                                                                |
| contents        | Array of strings | 条件列表逻辑匹配内容。 - 当匹配逻辑为exist或not_exist时，contents必须为空，其他情况下contents必填且长度不超过2048。   - 当category为response_code时，contents状态码为200\~599，正则为\^(?:\[2-5\]\\d{2})$。   - 当匹配逻辑包含"len"时，contents必须为0\~65535的整数；当匹配逻辑包含"num"时，contents必须为0\~512的整数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
   
**状态码：400**
表10响应Body参数 
| 参数                | 参数类型   | 描述   |
|:---|:---|:---|
| error_code        | String | 错误码  |
| error_description | String | 错误描述 |
   
#### 请求示例
查询域名为74af0d26xxxxxxxxx579b0ccd的频率控制规则列表。
```
GET https://{endpoint}/v2/aad/policies/waf/frequency-control-rule?domain_name=74af0d26xxxxxxxxx579b0ccd
```
#### 响应示例
**状态码：200**
OK
```
{
  "total" : 1,
  "items" : [ {
    "id" : "09e8cab1-xxxx-xxxx-xxxx-57f9fc851118",
    "name" : "test",
    "action" : {
      "category" : "captcha"
    },
    "conditions" : [ {
      "category" : "url",
      "contents" : [ "100" ],
      "logic_operation" : "contain"
    }, {
      "category" : "ip",
      "index" : "client-ip",
      "contents" : [ "1.x.x.1" ],
      "logic_operation" : "equal"
    } ],
    "limit_num" : "2",
    "limit_period" : "60",
    "lock_time" : "0",
    "tag_type" : "ip",
    "domain_aggregation" : true,
    "region_aggregation" : true,
    "captcha_lock_time" : 60,
    "grayscale_time" : false
  } ]
}
```
#### 状态码
| 状态码 | 描述             |
|:---|:---|
| 200 | OK             |
| 400 | Error response |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-aad/ErrorCode.html)。
