功能介紹
查詢提交請求的租戶有權限操作的所有安全組規(guī)則。單次查詢最多返回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
名稱 |
是否必選 |
參數類型 |
說明 |
---|---|---|---|
id |
否 |
String |
按照安全組規(guī)則對應的id過濾查詢結果 |
description |
否 |
String |
按照description過濾查詢結果 |
remote_group_id |
否 |
String |
按照與此安全組規(guī)則關聯(lián)的遠端安全組ID過濾查詢結果 |
security_group_id |
否 |
String |
按照與此安全組規(guī)則所屬的安全組ID過濾查詢結果 |
direction |
否 |
String |
按照安全組規(guī)則的方向過濾查詢結果,支持ingress和egress進行過濾 |
protocol |
否 |
String |
按照安全組規(guī)則的IP協(xié)議過濾查詢結果 |
remote_ip_prefix |
否 |
String |
按照與此安全組規(guī)則匹配的遠端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配合使用,詳細規(guī)則請見marker的參數說明。 |
請求參數
無。
請求示例
GET https://{Endpoint}/v2.0/security-group-rules
響應參數
參數名稱 |
類型 |
說明 |
---|---|---|
security_group_rules |
||
security_group_rules_links |
分頁信息。 只有在使用limit過濾,并且資源個數超過limit或者資源個數超過2000時(limit默認值),該參數的rel和href取值才會顯示為next和其對應的link。 |
屬性 |
類型 |
說明 |
---|---|---|
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網段 |
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 |
網絡類型 支持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_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" } ] }
狀態(tài)碼
請參見狀態(tài)碼。
錯誤碼
請參見錯誤碼。