CDNHAO使用文档

获取acl列表

GET /v1/acls
pageinteger
当前页码
limitinteger
单页显示数量
enableboolean
禁用或启用
{
	"code": 0,
	"count": 1,
	"data": [{
		"create_at": null,
		"create_at2": "2021-11-25 09:29:42",
		"data": "[{\"acl_action\": \"allow\", \"acl_matcher\": {\"country_iso_code\": {\"operator\": \"=\", \"value\": \"CN\"}}}]",
		"default_action": "reject",
		"des": "",
		"enable": 1,
		"id": 1,
		"name": "只允许中国",
		"state": null,
		"task_id": null,
		"uid": 2,
		"update_at": null,
		"update_at2": "2021-11-25 09:29:42",
		"username": "jason",
		"version": 1
	}]
}

添加acl

POST /v1/acls
namestring
requiredacl名称
des
备注
default_action
required默认策略,可选为reject、allow
data
acl规则,格式为数组,数组元素格式为{"acl_action":"allow","acl_matcher":{"ip":{"operator":"=","value":"1.1.1.1"}}}。acl_action可选值为reject、allow;acl_matcher可选的键值有ip、host、accept_language、user_agent、referer、uri、req_uri、req_method、country_iso_code,operator可选值有=、!=、!contain、contain、!AC、AC。当operator值为!AC或AC时,value值格式需要为数组。
{
  "code": 0, 
  "data": "1", 
  "msg": "ACL添加成功"
}
{
	"name": "只允许中国",
	"des": "",
	"data": [{
		"acl_action": "allow",
		"acl_matcher": {
			"country_iso_code": {
				"operator": "=",
				"value": "CN"
			}
		}
	}],
	"default_action": "reject"
}

批量修改acl (提交格式为数组)

PUT /v1/acls
idinteger
requiredacl id
namestring
acl名称
des
备注
default_action
默认策略,可选为reject、allow
data
acl规则,格式为数组,数组元素格式为{"acl_action":"allow","acl_matcher":{"ip":{"operator":"=","value":"1.1.1.1"}}}。acl_action可选值为reject、allow;acl_matcher可选的键值有ip、host、accept_language、user_agent、referer、uri、req_uri、req_method、country_iso_code,operator可选值有=、!=、!contain、contain、!AC、AC。当operator值为!AC或AC时,value值格式需要为数组。
enableboolean
禁用或启用
{
  "code": 0, 
  "data": "", 
  "msg": "更新ACL成功"
}
[{
	"id": 1,
	"enable": 0
}, {
	"id": 2,
	"enable": 0
}]

获取单个acl

GET /v1/acls/<Acl ID>
{
    "code": 0,
    "data": {
        "create_at": null,
        "data": "[{\"acl_action\": \"allow\", \"acl_matcher\": {\"country_iso_code\": {\"operator\": \"=\", \"value\": \"CN\"}}}]",
        "default_action": "reject",
        "des": "",
        "enable": 1,
        "id": 1,
        "name": "只允许中国",
        "task_id": null,
        "uid": 2,
        "update_at": null,
        "version": 1
    },
    "msg": ""
}

修改单个acl

PUT /v1/acls/<Acl ID>
namestring
acl名称
des
备注
default_action
默认策略,可选为reject、allow
data
acl规则,格式为数组,数组元素格式为{"acl_action":"allow","acl_matcher":{"ip":{"operator":"=","value":"1.1.1.1"}}}。acl_action可选值为reject、allow;acl_matcher可选的键值有ip、host、accept_language、user_agent、referer、uri、req_uri、req_method、country_iso_code,operator可选值有=、!=、!contain、contain、!AC、AC。当operator值为!AC或AC时,value值格式需要为数组。
enableboolean
禁用或启用
{
  "code": 0, 
  "data": "", 
  "msg": "更新ACL成功"
}
{
  "name": "new acl", 
}

删除acl

DELETE /v1/acls/<Acl ID,多个以逗号分隔>
{
  "code": 0, 
  "data": "", 
  "msg": "ACL删除成功"
}