功能介紹
創(chuàng)建安全組規(guī)則。
調(diào)試
您可以在API Explorer中調(diào)試該接口。
URI
POST /v2.0/security-group-rules
請求參數(shù)
參數(shù)名稱 |
類型 |
必選 |
說明 |
---|---|---|---|
security_group_rule |
是 |
屬性 |
是否必選 |
類型 |
說明 |
---|---|---|---|
description |
否 |
String |
安全組規(guī)則描述 |
security_group_id |
是 |
String |
所屬安全組id |
remote_group_id |
否 |
String |
所屬安全組的對端id 使用說明:和remote_ip_prefix,remote_address_group_id參數(shù)互斥 |
direction |
是 |
String |
規(guī)則方向 取值范圍:ingress(入方向)/egress(出方向) |
remote_ip_prefix |
否 |
String |
對端ip網(wǎng)段 使用說明:和remote_group_id,remote_address_group_id參數(shù)互斥 |
protocol |
否 |
String |
協(xié)議類型或直接指定IP協(xié)議號 取值范圍:tcp/udp/icmp或IP協(xié)議號 |
port_range_max |
否 |
Integer |
最大端口,當協(xié)議類型為ICMP時,該值表示ICMP的code 取值范圍:1-65535(當表示code時為0-255) |
port_range_min |
否 |
Integer |
最小端口,當協(xié)議類型為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)。 取值范圍:1-65535(當表示code時為0-255) |
ethertype |
否 |
String |
網(wǎng)絡類型 取值范圍:IPv4/IPv6 |
remote_address_group_id |
否 |
String |
|
請求示例
創(chuàng)建出方向安全組規(guī)則,所在安全組id為5cb9c1ee-00e0-4d0f-9623-55463cd26ff8,協(xié)議為tcp,對端ip為10.10.0.0/24。
POST https://{Endpoint}/v2.0/security-group-rules { "security_group_rule": { "security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8", "direction": "egress", "protocol": "tcp", "remote_ip_prefix": "10.10.0.0/24" } }
響應參數(shù)
參數(shù)名稱 |
類型 |
說明 |
---|---|---|
security_group_rule |
屬性 |
類型 |
說明 |
---|---|---|
id |
String |
安全組規(guī)則id 使用說明:查詢安全組規(guī)則非必選 |
description |
String |
安全組規(guī)則描述 |
security_group_id |
String |
所屬安全組id |
remote_group_id |
String |
所屬安全組的對端id |
direction |
String |
規(guī)則方向 |
remote_ip_prefix |
String |
對端ip網(wǎng)段 |
protocol |
String |
協(xié)議類型或直接指定IP協(xié)議號 |
port_range_max |
Integer |
最大端口,當協(xié)議類型為ICMP時,該值表示ICMP的code |
port_range_min |
Integer |
最小端口,當協(xié)議類型為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 |
網(wǎng)絡類型 支持IPv4,IPv6 |
tenant_id |
String |
項目ID |
remote_address_group_id |
String |
|
project_id |
String |
項目ID,請參見獲取項目ID。 |
created_at |
String |
資源創(chuàng)建時間,UTC時間 格式:yyyy-MM-ddTHH:mm:ss |
updated_at |
String |
資源更新時間,UTC時間 格式:yyyy-MM-ddTHH:mm:ss |
響應示例
{ "security_group_rule": { "remote_group_id": null, "direction": "egress", "remote_ip_prefix": "10.10.0.0/24", "protocol": "tcp", "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f", "port_range_max": null, "security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8", "port_range_min": null, "ethertype": "IPv4", "description": null, "id": "7c336b04-1603-4911-a6f4-f2af1d9a0488", "project_id": "6fbe9263116a4b68818cf1edce16bc4f", "created_at": "2018-09-20T02:15:34", "updated_at": "2018-09-20T02:15:34", "remote_address_group_id": null } }
狀態(tài)碼
請參見狀態(tài)碼。
錯誤碼
請參見錯誤碼。