更新时间:2025-12-29 GMT+08:00

查询防护规则

功能介绍

查询防护规则

URI

GET /v1/{project_id}/acl-rules

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户项目id

表2 Query参数

参数

是否必选

参数类型

描述

object_id

String

防护对象id,是创建云防火墙后用于区分互联网边界防护和VPC边界防护的标志id,可通过调用查询防火墙实例接口获得,通过返回值中的data.records.protect_objects.object_id(.表示各对象之间层级的区分)获得,注意type为0的为互联网边界防护对象id,type为1的为VPC边界防护对象id,type可通过data.records.protect_objects.type(.表示各对象之间层级的区分)获得

type

Integer

规则类型,0:互联网规则,1:vpc规则,2:nat规则

ip

String

ip地址

name

String

规则名称

direction

Integer

方向0:外到内1:内到外

status

Integer

规则下发状态 0:禁用,1:启用

action_type

Integer

动作0:permit,1:deny

address_type

Integer

地址Internet协议类型0 ipv4,1 ipv6

limit

Integer

每页显示个数,范围为1-1024

offset

Integer

偏移量:指定返回记录的开始位置,必须为数字,取值范围为大于或等于0,默认0

enterprise_project_id

String

企业项目ID,用户根据组织规划企业项目,对应的ID为企业项目ID,可通过如何获取企业项目ID获取,用户未开启企业项目时为0

fw_instance_id

String

防火墙id,可通过防火墙ID获取方式获取

tags_id

String

规则标签id,创建规则时产生。

source

String

源地址

destination

String

目的地址

service

String

服务端口

application

String

规则应用类型包括:“HTTP”,"HTTPS","TLS1",“DNS”,“SSH”,“MYSQL”,“SMTP”,“RDP”,“RDPS”,“VNC”,“POP3”,“IMAP4”,“SMTPS”,“POP3S”,“FTPS”,“ANY”,“BGP”等。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)

Content-Type

String

内容类型,只有application/json的值是适用的

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

data

data object

查询规则列表返回值数据

表5 data

参数

参数类型

描述

offset

Integer

偏移量:指定返回记录的开始位置,必须为数字,取值范围为大于或等于0,默认0

limit

Integer

每页显示个数,范围为1-1024

total

Integer

查询规则列表总条数

object_id

String

防护对象id,是创建云防火墙后用于区分互联网边界防护和VPC边界防护的标志id,可通过调用查询防火墙实例接口,注意type为0的为互联网边界防护对象id,type为1的为VPC边界防护对象id。

records

Array of records objects

查询规则列表记录

表6 records

参数

参数类型

描述

rule_id

String

规则id

address_type

Integer

地址Internet协议类型0 ipv4,1 ipv6

name

String

规则名称

direction

Integer

规则方向0:外到内1:内到外

action_type

Integer

动作0:permit,1:deny

status

Integer

规则下发状态 0:禁用,1:启用

description

String

描述

long_connect_time

Long

长连接时长

long_connect_enable

Integer

长连接支持

long_connect_time_hour

Long

长连接时长对应小时

long_connect_time_minute

Long

长连接时长对应分钟

long_connect_time_second

Long

长连接时长秒

source

RuleAddressDtoForResponse object

源地址对象

destination

RuleAddressDtoForResponse object

目的地址对象

service

RuleServiceDtoForResponse object

服务对象

type

Integer

规则类型,0:互联网规则,1:vpc规则,2:nat规则

created_date

String

规则创建时间,例如:"2024-08-12 08:40:00"

last_open_time

String

规则最后开启时间,例如:"2024-08-12 08:40:00"

tag

TagsVO object

规则附带标签对象

表7 RuleAddressDtoForResponse

参数

参数类型

描述

type

Integer

地址类型0手工输入,1关联IP地址组,2域名,3地理位置,4域名组,5多对象,6域名组-网络型,7域名组-应用型。

address_type

Integer

地址Internet协议类型0 ipv4,1 ipv6,当type为0手动输入类型时不能为空

address

String

IP地址信息

address_set_id

String

关联IP地址组ID

address_set_name

String

地址组名称

domain_address_name

String

域名地址名称

region_list_json

String

规则地域列表json值

region_list

Array of IpRegionDto objects

规则地域列表

domain_set_id

String

域名组id

domain_set_name

String

域名组名称

ip_address

Array of strings

IP地址列表

address_group

Array of strings

地址组id列表

address_group_names

Array of AddressGroupVO objects

地址组名称列表

address_set_type

Integer

地址组类型,0表示自定义地址组,1表示WAF回源IP地址组,2表示DDoS回源IP地址组,3表示NAT64转换地址组

表8 IpRegionDto

参数

参数类型

描述

region_id

String

区域id,可通过获取账号、IAM用户、项目、用户组、区域、委托的名称和ID获取。

region_type

Integer

区域类型,0表示国家,1表示省份,2表示大洲,可通过地域信息表获取。

表9 AddressGroupVO

参数

参数类型

描述

address_set_type

Integer

地址组类型,0表示自定义地址组,1表示WAF回源IP地址组,2表示DDoS回源IP地址组,3表示NAT64转换地址组

name

String

关联IP地址组名称,可通过查询地址组列表接口查询获得,通过返回值中的data.records.name(.表示各对象之间层级的区分)获得。

set_id

String

关联IP地址组ID,可通过查询地址组列表接口查询获得,通过返回值中的data.records.set_id(.表示各对象之间层级的区分)获得。

表10 RuleServiceDtoForResponse

参数

参数类型

描述

type

Integer

服务输入类型,0为手动输入类型,1为自动输入类型

protocol

Integer

协议类型:TCP为6,UDP为17,ICMP为1,ICMPV6为58,ANY为-1,手动类型不为空,自动类型为空

protocols

Array of integers

协议列表,协议类型:TCP为6,UDP为17,ICMP为1,ICMPV6为58,ANY为-1,手动类型不为空,自动类型为空

source_port

String

源端口

dest_port

String

目的端口

service_set_id

String

服务组id

service_set_name

String

服务组名称

custom_service

Array of ServiceItem objects

自定义服务

service_group

Array of strings

服务组id列表

service_group_names

Array of ServiceGroupVO objects

服务组名称列表

service_set_type

Integer

服务组类型,0表示自定义服务组,1表示常用WEB服务,2表示常用远程登录和PING,3表示常用数据库

表11 ServiceItem

参数

参数类型

描述

protocol

Integer

协议类型:TCP为6,UDP为17,ICMP为1,ICMPV6为58,ANY为-1,RuleServiceDto.type为0时不能为空。

source_port

String

源端口

dest_port

String

目的端口

description

String

服务成员描述

name

String

服务成员名称

表12 ServiceGroupVO

参数

参数类型

描述

name

String

服务组名称

protocols

Array of integers

协议列表,协议类型:TCP为6,UDP为17,ICMP为1,ICMPV6为58,ANY为-1

service_set_type

Integer

服务组类型,0表示自定义服务组,1表示预定义服务组

set_id

String

服务组id,可通过获取服务组列表接口查询获得,通过返回值中的data.records.set_id(.表示各对象之间层级的区分)获得。

表13 TagsVO

参数

参数类型

描述

tag_id

String

规则标签id

tag_key

String

规则标签键

tag_value

String

规则标签值

状态码:400

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

查询项目id为9d80d070b6d44942af73c9c3d38e0429,防护对象id为e12bd2cd-ebfc-4af7-ad6f-ebe6da398029的第一页,limit为10的数据

示例URL https://{Endpoint}/v1/9d80d070b6d44942af73c9c3d38e0429/acl-rules?object_id=e12bd2cd-ebfc-4af7-ad6f-ebe6da398029&limit=10&offset=0

响应示例

状态码:200

查询规则列表返回值

{
  "data" : {
    "limit" : 10,
    "object_id" : "cfebd347-b655-4b84-b938-3c54317599b2",
    "offset" : 0,
    "records" : [ {
      "action_type" : 0,
      "address_type" : 0,
      "destination" : {
        "address" : "0.0.0.0/0",
        "address_type" : 0,
        "type" : 0
      },
      "direction" : 1,
      "long_connect_enable" : 0,
      "created_date" : "2024-02-27 04:01:17",
      "last_open_time" : "2024-02-27 04:01:17",
      "description" : "description",
      "name" : "eip_ipv4_n_w_allow",
      "rule_id" : "ffe9af47-d893-483b-86e3-ee5242e8cb15",
      "service" : {
        "dest_port" : "0",
        "protocol" : -1,
        "source_port" : "0",
        "type" : 0
      },
      "source" : {
        "address_set_id" : "48bfb09b-6f3a-4371-8ddb-05d5d7148bcc",
        "address_set_name" : "ip_group",
        "address_type" : 0,
        "type" : 1
      },
      "status" : 1,
      "type" : "0"
    } ],
    "total" : 1
  }
}

状态码:400

Bad Request

{
  "error_code" : "CFW.0020016",
  "error_msg" : "实例状态错误"
}

状态码

状态码

描述

200

查询规则列表返回值

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

错误码

请参见错误码