调度策略相关接口
更新时间:2023-12-04
查询域名的调度策略
描述
- 查询指定域名的调度策略
请求参数
URI | GET /v1/domains/{domain_name}/strategy |
Query String | 无 |
Request Body | 无 |
示例:
Plain Text
1GET /v1/domains/www.mydomain.com/strategy HTTP/1.1
2Host: itm.baidubce.com
3Authorization: authorization string
4x-bce-date: 2022-11-18T06:22:24Z
返回数据
JSON
1{
2 "status": "start", // 域名调度状态: "", "start", "stop", "pause"
3 "strategy": {
4 "start": "根规则",
5 "rules": [
6 {
7 "type": "geoProximity",
8 "area": "none.CN",
9 "isp": "other",
10 "name": "根规则",
11 "enable": true,
12 "items": [
13 {"reference": "北京","weight": 0,"priority": 0,"usersets": ""}
14 ]
15 },
16 {
17 "type": "wrr",
18 "area": "beijing.CN",
19 "isp": "other",
20 "name": "北京",
21 "enable": true,
22 "items": [
23 {"reference": "220.181.38.135","weight": 1,"priority": 0,"usersets": ""}
24 ]
25 }
26 ]
27 },
28 "endpointsConf": [ // 调度策略中的端点配置信息
29 {"type": "A","value": "220.181.38.135","area": "beijing.CN","isp": "ct","evalHealth": true,"enable": true}
30 ]
31}
生成默认调度策略并启用默认策略
描述
- 为域名生成默认调度策略 & 启用此策略
请求参数
URI | POST /v1/domains/{domain_name}/recommend-strategy |
Query String | 无 |
Request Body | 无 |
示例:
Plain Text
1POST /v1/domains/www.mydomain.com/recommend-strategy HTTP/1.1
2Host: itm.baidubce.com
3Authorization: authorization string
4x-bce-date: 2022-11-18T06:22:24Z
返回数据
JSON
1null
修改或更新调度策略
描述
- 修改或更新域名的调度策略,支持批量操作
- 调度策略数据人工构造起来比较复杂,建议在前端界面处修改调度策略,或是在前端界面设计好调度策略后,从页面检查的update接口中获取构造好的调度策略数据,然后调用此接口
请求参数
URI | POST /v1/strategys/update-or-create |
Query String | 无 |
Request Body | 详见下述实例 |
示例:
JSON
1POST /v1//strategys/update-or-create HTTP/1.1
2Host: itm.baidubce.com
3Authorization: authorization string
4x-bce-date: 2022-11-18T06:22:24Z
5
6{
7 "itmdomain-test.com.4": {
8 "strategy": {
9 "start": "根规则",
10 "rules": [
11 {
12 "type": "geoProximity",
13 "area": "none.CN",
14 "isp": "other",
15 "name": "根规则",
16 "enable": true,
17 "items": [
18 {
19 "reference": "安徽",
20 "weight": 0,
21 "priority": 0,
22 "usersets": ""
23 }
24 ]
25 },
26 {
27 "type": "wrr",
28 "area": "anhui.CN",
29 "isp": "other",
30 "name": "安徽",
31 "enable": true,
32 "items": [
33 {
34 "reference": "1.1.1.1",
35 "weight": 1,
36 "priority": 0,
37 "usersets": ""
38 }
39 ]
40 }
41 ]
42 },
43 "endpointsConf": [
44 {
45 "type": "A",
46 "value": "1.1.1.1",
47 "area": "anhui.CN",
48 "isp": "ct",
49 "evalHealth": true,
50 "enable": true
51 }
52 ]
53 }
54}
返回数据
JSON
1null