Liệt kê security group
/v2.0/security-groupsSecurity group là tập rule firewall stateful áp dụng cho port của VM. Mỗi project được cấp một group default khi được tạo. Dùng lệnh gọi này để lấy group ID cần truyền vào port hoặc vào request tạo VM.
Nguồn: list-security-groups
Request
Tham số query
idstringLọc theo ID của security group. Có thể lặp lại.
namestringLọc theo tên security group. Tên không unique.
descriptionstringLọc theo mô tả.
tenant_idstringLọc theo ID của project sở hữu.
project_idstringAlias của tenant_id.
tagsstringDanh sách phân tách bằng dấu phẩy; khớp các group có tất cả tag.
tags-anystringDanh sách phân tách bằng dấu phẩy; khớp các group có ít nhất một tag.
not-tagsstringDanh sách phân tách bằng dấu phẩy; loại trừ các group có tất cả tag.
limitintegerSố group tối đa mỗi trang.
markerstringID của group cuối cùng ở trang trước.
sort_keystringThuộc tính dùng để sắp xếp. Mặc định: id.
sort_dirstringasc hoặc desc. Mặc định: asc.
Request mẫu
curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
'https://api.vietnix.cloud:9696/v2.0/security-groups'
Response
security_groupsarraybắt buộcDanh sách object security group.
idstringbắt buộcID của security group.
namestringbắt buộcTên security group.
descriptionstringbắt buộcMô tả tự do.
statefulbooleanbắt buộcGroup có stateful hay không: lưu lượng phản hồi cho các kết nối được phép tự động được cho phép.
tenant_idstringbắt buộcProject sở hữu group.
security_group_rulesarraybắt buộcCác rule trong group này. Mỗi rule có direction, ethertype, protocol, port_range_min, port_range_max, remote_ip_prefix và remote_group_id.
tagsarraybắt buộcCác tag gắn với group.
Response mẫu
Response body
{
"security_groups": [
{
"id": "9a1c2f70-3b4d-4c8e-9d21-6f7e8a9b0c11",
"name": "default",
"description": "Default security group",
"stateful": true,
"tenant_id": "f5d834d636c642c7bfe8af86139c6f26",
"project_id": "f5d834d636c642c7bfe8af86139c6f26",
"security_group_rules": [
{
"id": "0d6f5e4c-3b2a-4190-8f7e-6d5c4b3a2f10",
"direction": "egress",
"ethertype": "IPv4",
"protocol": null,
"port_range_min": null,
"port_range_max": null,
"remote_ip_prefix": null,
"remote_group_id": null,
"security_group_id": "9a1c2f70-3b4d-4c8e-9d21-6f7e8a9b0c11"
},
{
"id": "1e7a6f5d-4c3b-4201-9a8f-7e6d5c4b3a21",
"direction": "ingress",
"ethertype": "IPv4",
"protocol": null,
"port_range_min": null,
"port_range_max": null,
"remote_ip_prefix": null,
"remote_group_id": "9a1c2f70-3b4d-4c8e-9d21-6f7e8a9b0c11",
"security_group_id": "9a1c2f70-3b4d-4c8e-9d21-6f7e8a9b0c11"
}
],
"tags": []
}
]
}
Mã trạng thái
Thành công
| Mã | Mô tả |
|---|---|
| 200 - OK | Request thành công. |
Lỗi
| Mã | Mô tả |
|---|---|
| 401 - Unauthorized | Cần xác thực trước khi gửi request. |
| 403 - Forbidden | Policy không cho phép user hiện tại thực hiện thao tác này. |
Group default cho phép toàn bộ lưu lượng egress và chỉ cho ingress từ các member cùng group. VM được tạo mà không chỉ định security group sẽ nằm trong default, nghĩa là không có SSH hay HTTP vào cho đến khi bạn thêm rule hoặc gắn group khác.