更新时间:2024-08-01 GMT+08:00

查询安全组规则

功能介绍

查询单个安全组规则。

URI

GET /v3/{project_id}/vpc/security-group-rules/{security_group_rule_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID。

获取方法请参见获取项目ID

security_group_rule_id

String

安全组规则ID

请求参数

请求示例

  • 查询安全组规则详情
    "GET https://{Endpoint}/v3/{project_id}/vpc/security-group-rules/01a772b2-463e-47e3-a95d-bac85ee8adc6"

响应参数

状态码为 200 时:

表2 响应Body参数

参数

参数类型

描述

request_id

String

请求ID

security_group_rule

SecurityGroupRule object

安全组规则详情响应体

表3 SecurityGroupRule

参数

参数类型

描述

id

String

  • 功能描述:安全组规则对应的唯一标识。
  • 取值范围:带“-”的标准UUID格式。

description

String

  • 功能说明:安全组的描述信息。
  • 取值范围:0-255个字符,不能包含“<”和“>”。

security_group_id

String

  • 功能说明:安全组规则所属的安全组ID。

direction

String

  • 功能说明:安全组规则的出入控制方向。
  • 取值范围:ingress表示入方向,egress表示出方向。

protocol

String

  • 功能说明:协议类型。
  • 取值范围:icmp、tcp、udp、icmpv6或IP协议号。
  • 约束:
    • 为空表示支持所有协议。
    • 协议为icmpv6时,网络类型应该为IPv6。
    • 协议为icmp时,网络类型应该为IPv4。

ethertype

String

  • 功能说明:IP地址协议类型。
  • 取值范围:IPv4,IPv6
  • 约束:不填默认值为IPv4。

multiport

String

  • 功能说明:端口取值范围。
  • 取值范围:支持单端口(80),连续端口(1-30)以及不连续端口(22,3389,80)。

action

String

  • 功能说明:安全组规则生效策略。
  • 取值范围:
    • allow表示允许。
    • deny表示拒绝。
  • 约束:默认值为deny。

priority

Integer

  • 功能说明:优先级。
  • 取值范围:1~100,1代表最高优先级。

remote_group_id

String

  • 功能说明:远端安全组ID,表示该安全组内的流量允许或拒绝。
  • 取值范围:租户下存在的安全组ID。
  • 约束:与remote_ip_prefix,remote_address_group_id功能互斥。

remote_ip_prefix

String

  • 功能说明:远端IP地址。当direction是egress时,为虚拟机访问端的地址,当direction是ingress时,为访问虚拟机的地址。
  • 取值范围:IP地址,或者cidr格式
  • 约束:
    • 与remote_group_id、remote_address_group_id互斥。
    • 为空,表示没有限制远端IP地址,允许或拒绝所有远端地址的流量。

remote_address_group_id

String

  • 功能说明:远端地址组ID。
  • 取值范围:租户下存在的地址组ID。
  • 约束:与remote_ip_prefix,remote_group_id功能互斥。

created_at

String

  • 功能说明:安全组规则创建时间。
  • 取值范围:UTC时间格式,yyyy-MM-ddTHH:mm:ssZ

updated_at

String

  • 功能说明:安全组规则更新时间。
  • 取值范围:UTC时间格式,yyyy-MM-ddTHH:mm:ssZ

project_id

String

  • 功能说明:安全组规则所属项目ID。

响应示例

状态码为 200 时:

OK
{
    "security_group_rule": {
        "id": "f626eb24-d8bd-4d26-ae0b-c16bb65730cb", 
        "project_id": "060576782980d5762f9ec014dd2f1148", 
        "security_group_id": "0552091e-b83a-49dd-88a7-4a5c86fd9ec3", 
        "remote_group_id": null, 
        "direction": "ingress", 
        "protocol": "tcp", 
        "description": "security group rule description", 
        "created_at": "2020-08-13T07:12:36Z", 
        "updated_at": "2020-08-13T07:12:36Z", 
        "ethertype": "IPv4", 
        "remote_ip_prefix": "10.10.0.0/16", 
        "multiport": "333", 
        "remote_address_group_id": null, 
        "action": "allow", 
        "priority": 1
    }, 
    "request_id": "034c4840bde0b1263a4b2e66fbd74d5f"
}

状态码

请参见状态码

错误码

请参见错误码