查询用量封顶
更新时间:2023-10-12
查询用量封顶
接口描述
本接口用于查询指定加速域名的用量封顶配置。
请求接口
Method | Path | 说明 |
---|---|---|
GET | /v2/domain/{domain}/config?limitConsumption | 查询域名用量封顶配置 |
请求头域
除公共头域外,无其它特殊头域。
请求参数
除limitConsumption外无其他url参数,无body参数
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
limitConsumption | 必选 | limitConsumption | 用量封顶配置 |
limitConsumption类型说明
参数 | 类型 | 说明 |
---|---|---|
enabled | bool | 用量封顶配置是否开启。enabled=true开启 |
activated | bool | 是否已经触发阈值,执行action。activated=true表示已触发 |
type | string | 检测类型,取值flow、bandwidth、pv、qps |
threshold | string | 检测阈值,type不同时,阈值不同。type=flow,可填1GB、1TB、1PB,单位只能为GB或TB或PB。type=bandwidth,可填1Mbps、1Gbps、1Tbps,单位只能为Mbps或Gbps或Tbps。type=pv或qps,填数字即可,无需单位 |
statisticalCycle | int | 检测周期,单位s。取值300、3600、86400。当type=bandwidth或qps时,只能填300。例如type=flow,statisticalCycle=3600时,检测范围为最近一小时流量,延迟10min |
action | string | 达到阈值时触发的动作,取值deny、stop,"stop"表示stop加速域名,"deny"表示拒绝所有请求,访问会404 |
recoverAfterSeconds | int | 触发阈值,执行action后自动恢复的时间,单位s。取值-1、3600、86400、259200,-1表示不自动恢复,其他取值恢复时间存在一定延迟,最多延迟10min |
notification | list,元素类型为string | 触发阈值后的通知方式。sms(短信)、mail(邮件)、internal_message(站内信) |
请求示例
Plain Text
1GET /v2/domain/myself.baidu.com/config?limitConsumption HTTP/1.1
2Host: cdn.baidubce.com
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.1.10
3Date: Wed, 21 Jul 2021 08:39:42 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/7.2.28
8x-bce-request-id: cc72ab66-1798-aa32-6d3b-d1a4a600fd31
9
10未触发:
11{
12 "limitConsumption": {
13 "enabled": true,
14 "statisticalCycle": 300,
15 "action": "deny",
16 "recoverAfterSeconds": -1,
17 "notification": [
18 "mail"
19 ],
20 "type": "bandwidth",
21 "threshold": "500Mbps"
22 }
23}
24已触发:
25{
26 "limitConsumption": {
27 "enabled": true,
28 "activated": true,
29 "statisticalCycle": 300,
30 "action": "deny",
31 "recoverAfterSeconds": -1,
32 "notification": [
33 "mail"
34 ],
35 "type": "bandwidth",
36 "threshold": "500Mbps"
37 }
38}