查询安全组规则列表
功能介绍
查询提交请求的租户有权限操作的所有安全组规则。单次查询最多返回2000条数据,超过2000后会返回分页标记。
调试
您可以在API Explorer中调试该接口。
URI
GET /v2.0/security-group-rules
样例:
GET https://{Endpoint}/v2.0/security-group-rules?security_group_id={security_group_id}&remote_group_id={remote_group_id}&direction={direction}&remote_ip_prefix={remote_ip_prefix}&protocol={protocol}&port_range_max={port_range_max}&port_range_min={port_range_min}ðertype={ethertype}&tenant_id ={tenant_id}
   分页查询样例:
GET https://{Endpoint}/v2.0/networks?limit=2&marker=07adc044-3f21-4eeb-bd57-5e5eb6024b7f&page_reverse=False
   参数说明请参见表1
| 
         名称  | 
       
         是否必选  | 
       
         参数类型  | 
       
         说明  | 
      
|---|---|---|---|
| 
         id  | 
       
         否  | 
       
         String  | 
       
         按照安全组规则对应的id过滤查询结果  | 
      
| 
         description  | 
       
         否  | 
       
         String  | 
       
         按照description过滤查询结果  | 
      
| 
         remote_group_id  | 
       
         否  | 
       
         String  | 
       
         按照与此安全组规则关联的远端安全组ID过滤查询结果  | 
      
| 
         security_group_id  | 
       
         否  | 
       
         String  | 
       
         按照与此安全组规则所属的安全组ID过滤查询结果  | 
      
| 
         direction  | 
       
         否  | 
       
         String  | 
       
         按照安全组规则的方向过滤查询结果,支持ingress和egress进行过滤  | 
      
| 
         protocol  | 
       
         否  | 
       
         String  | 
       
         按照安全组规则的IP协议过滤查询结果  | 
      
| 
         remote_ip_prefix  | 
       
         否  | 
       
         String  | 
       
         按照与此安全组规则匹配的远端IP网段过滤查询结果  | 
      
| 
         ethertype  | 
       
         否  | 
       
         String  | 
       
         按照网络类型过滤查询结果  | 
      
| 
         port_range_max  | 
       
         否  | 
       
         Integer  | 
       
         按照最大端口过滤查询结果  | 
      
| 
         port_range_min  | 
       
         否  | 
       
         Integer  | 
       
         按照最小端口过滤查询结果  | 
      
| 
         tenant_id  | 
       
         否  | 
       
         String  | 
       
         按照项目ID过滤查询结果  | 
      
| 
         marker  | 
       
         否  | 
       
         String  | 
       
         分页查询的起始资源ID,表示从指定资源的下一条记录开始查询。 marker需要和limit配合使用: 
  | 
      
| 
         limit  | 
       
         否  | 
       
         Integer  | 
       
         分页查询每页返回的记录个数,取值范围为0~intmax(2^31-1),默认值2000。 limit需要和marker配合使用,详细规则请见marker的参数说明。  | 
      
请求参数
无。
请求示例
GET https://{Endpoint}/v2.0/security-group-rules
  响应参数
| 
         参数名称  | 
       
         类型  | 
       
         说明  | 
      
|---|---|---|
| 
         security_group_rules  | 
       
         Array of Security Group Rule objects  | 
       
         security group rule对象列表。请参见表3。  | 
      
| 
         security_group_rules_links  | 
       
         Array of SecurityGroupRulesLink objects  | 
       
         分页信息。 只有在使用limit过滤,并且资源个数超过limit或者资源个数超过2000时(limit默认值),该参数的rel和href取值才会显示为next和其对应的link。  | 
      
| 
         参数名称  | 
       
         类型  | 
       
         说明  | 
      
|---|---|---|
| 
         id  | 
       
         String  | 
       
         安全组规则id 使用说明:查询安全组规则非必选  | 
      
| 
         description  | 
       
         String  | 
       
         安全组规则描述  | 
      
| 
         security_group_id  | 
       
         String  | 
       
         所属安全组id  | 
      
| 
         remote_group_id  | 
       
         String  | 
       
         所属安全组的对端id  | 
      
| 
         direction  | 
       
         String  | 
       
         规则方向  | 
      
| 
         remote_ip_prefix  | 
       
         String  | 
       
         对端ip网段  | 
      
| 
         protocol  | 
       
         String  | 
       
         协议类型或直接指定IP协议号  | 
      
| 
         port_range_max  | 
       
         Integer  | 
       
         最大端口,当协议类型为ICMP时,该值表示ICMP的code  | 
      
| 
         port_range_min  | 
       
         Integer  | 
       
         最小端口,当协议类型为ICMP时,该值表示ICMP的type。 protocol为tcp和udp时,port_range_max和port_range_min必须同时输入,且port_range_max应大于等于port_range_min。 protocol为icmp时,指定ICMP code(port_range_max)时,必须同时指定ICMP type(port_range_min)。  | 
      
| 
         ethertype  | 
       
         String  | 
       
         网络类型 支持IPv4,IPv6  | 
      
| 
         tenant_id  | 
       
         String  | 
       
         项目ID  | 
      
| 
         remote_address_group_id  | 
       
         String  | 
       
        
  | 
      
| 
         project_id  | 
       
         String  | 
       
         项目ID,请参见获取项目ID。  | 
      
| 
         created_at  | 
       
         String  | 
       
         资源创建时间,UTC时间 格式:yyyy-MM-ddTHH:mm:ss  | 
      
| 
         updated_at  | 
       
         String  | 
       
         资源更新时间,UTC时间 格式:yyyy-MM-ddTHH:mm:ss  | 
      
响应示例
{
    "security_group_rules": [
        {
            "remote_group_id": "1d8b19c7-7c56-48f7-a99b-4b40eb390967", 
            "direction": "ingress", 
            "remote_ip_prefix": null, 
            "protocol": null, 
            "tenant_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "port_range_max": null, 
            "security_group_id": "1d8b19c7-7c56-48f7-a99b-4b40eb390967", 
            "port_range_min": null, 
            "ethertype": "IPv6", 
            "description": null, 
            "id": "07adc044-3f21-4eeb-bd57-5e5eb6024b7f",
            "project_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "created_at": "2018-09-20T02:15:34",
            "updated_at": "2018-09-20T02:15:34",
            "remote_address_group_id": null
        }, 
        {
            "remote_group_id": null, 
            "direction": "egress", 
            "remote_ip_prefix": null, 
            "protocol": null, 
            "tenant_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "port_range_max": null, 
            "security_group_id": "328fb454-a2ee-4a11-bdb1-ee19bbdfde43", 
            "port_range_min": null, 
            "ethertype": "IPv6", 
            "description": null, 
            "id": "09358f83-f4a5-4386-9563-a1e3c373d655",
            "project_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "created_at": "2018-09-20T02:15:34",
            "updated_at": "2018-09-20T02:15:34",
            "remote_address_group_id": null
        }, 
        {
            "remote_group_id": "4c763030-366e-428c-be2b-d48f6baf5297", 
            "direction": "ingress", 
            "remote_ip_prefix": null, 
            "protocol": null, 
            "tenant_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "port_range_max": null, 
            "security_group_id": "4c763030-366e-428c-be2b-d48f6baf5297", 
            "port_range_min": null, 
            "ethertype": "IPv6", 
            "description": null, 
            "id": "219a6f56-1069-458b-bec0-df9270e7a074",
            "project_id": "6c9298ec8c874f7f99688489ab65f90e", 
            "created_at": "2018-09-20T02:15:34",
            "updated_at": "2018-09-20T02:15:34",
            "remote_address_group_id": null
        }
    ],
    "security_group_rules_links": [
       {    "rel": "previous", 
            "href": "https://{Endpoint}/v2.0/
security-group-rules?marker=07adc044-3f21-4eeb-bd57-5e5eb6024b7f&page_reverse=True"
        }
    ]
}
  状态码
请参见状态码。
错误码
请参见错误码。