创建安全组规则
请求路径
POST
/api/rio/v1/compute/security_group/:id/rule
请求参数
名称 | 类型 | 位置 | 必须 | 描述 |
---|---|---|---|---|
x-rio-zone-id | string | header | 是 | 地域 ID |
id | string | path | 是 | 安全组 ID |
direction | string | body | 是 | 流量方向:
|
type | string | body | 是 | 安全组授权类型:
|
remote_security_group_id | []string | body | 否 | 远端安全组 ID 列表,安全组授权类型为安全组时必传 |
cidr | []string | body | 否 | CIDR 列表,安全组授权类型为Ipv4地址时必传 |
protocol | string | body | 是 | IP协议类型:
|
port_range | []string | body | 是 | 目的端安全组开放的传输层协议相关的端口范围数组。取值范围:
|
description | string | body | 否 | 安全组描述信息 |
返回值
名称 | 类型 | 描述 |
---|---|---|
request_id | string | 请求 ID |
data | SecurityGroupRule | 安全组对规则象 |
SecurityGroupRule 安全组规则对象
名称 | 类型 | 描述 |
---|---|---|
security_group_rule_id | string | 安全组规则 ID |
protocol | string | IP协议类型:
|
direction | string | 流量方向:
|
remote_security_group_id | string | 远端安全组ID |
from_port | integer | 最小端口号 |
to_port | integer | 最大端口号 |
cidr | string | CIDR |
type | string | 安全组授权类型:
|
created_at | integer | 安全组规则创建时间 |
请求示例
{
"direction": "all",
"protocol": "tcp",
"port_range": [
"80/80",
"1433/1433"
],
"type": 2,
"cidr": [
"0.0.0.0/0"
]
}
返回值示例
{
"request_id": "HtPfEovdw3k898sW",
"data": [
{
"security_group_rule_id": "75a8d1c5-bfb8-47e6-97e2-c7309244524e",
"direction": "ingress",
"type": 2,
"remote_security_group_id": null,
"cidr": "0.0.0.0/0",
"protocol": "",
"from_port": 80,
"to_port": 80,
"description": "",
"created_at": 0
},
{
"security_group_rule_id": "6137f4a1-d391-4cc4-a26e-6640b7161053",
"direction": "egress",
"type": 2,
"remote_security_group_id": null,
"cidr": "0.0.0.0/0",
"protocol": "",
"from_port": 80,
"to_port": 80,
"description": "",
"created_at": 0
},
{
"security_group_rule_id": "b72d95e2-f676-4dc6-997e-8eb15f2eeeed",
"direction": "ingress",
"type": 2,
"remote_security_group_id": null,
"cidr": "0.0.0.0/0",
"protocol": "",
"from_port": 1433,
"to_port": 1433,
"description": "",
"created_at": 0
},
{
"security_group_rule_id": "803ae933-ca47-4e97-81cc-cabd82d65012",
"direction": "egress",
"type": 2,
"remote_security_group_id": null,
"cidr": "0.0.0.0/0",
"protocol": "",
"from_port": 1433,
"to_port": 1433,
"description": "",
"created_at": 0
}
]
}
文档反馈
(如有产品使用问题,请 提交工单)