Chuyển tới nội dung chính

Liệt kê security group

GET/v2.0/security-groups

Security 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.

Request​

Tham số query​

idstring

Lọc theo ID của security group. Có thể lặp lại.

namestring

Lọc theo tên security group. Tên không unique.

descriptionstring

Lọc theo mô tả.

tenant_idstring

Lọc theo ID của project sở hữu.

project_idstring

Alias của tenant_id.

tagsstring

Danh sách phân tách bằng dấu phẩy; khớp các group có tất cả tag.

tags-anystring

Danh 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-tagsstring

Danh sách phân tách bằng dấu phẩy; loại trừ các group có tất cả tag.

limitinteger

Số group tối đa mỗi trang.

markerstring

ID của group cuối cùng ở trang trước.

sort_keystring

Thuộc tính dùng để sắp xếp. Mặc định: id.

sort_dirstring

asc 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ộc

Danh sách object security group.

idstringbắt buộc

ID của security group.

namestringbắt buộc

Tên security group.

descriptionstringbắt buộc

Mô tả tự do.

statefulbooleanbắt buộc

Group 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ộc

Project sở hữu group.

security_group_rulesarraybắt buộc

Cá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ộc

Cá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 - OKRequest thành công.

Lỗi​

MãMô tả
401 - UnauthorizedCần xác thực trước khi gửi request.
403 - ForbiddenPolicy không cho phép user hiện tại thực hiện thao tác này.
note

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.