Skip to main content

List Security Groups

GET/v2.0/security-groups

Security groups are stateful firewall rule sets applied to the ports of a VM. Every project gets a default group when it is created. Use this call to get the group ID that you pass to a port or to the create VM request.

Request​

Query parameters​

idstring

Filter by security group ID. Can be repeated.

namestring

Filter by security group name. Names are not unique.

descriptionstring

Filter by description.

tenant_idstring

Filter by owning project ID.

project_idstring

Alias of tenant_id.

tagsstring

Comma-separated list; matches groups that have all the tags.

tags-anystring

Comma-separated list; matches groups that have at least one tag.

not-tagsstring

Comma-separated list; excludes groups that have all the tags.

limitinteger

Maximum number of groups per page.

markerstring

ID of the last group on the previous page.

sort_keystring

Attribute to sort by. Default: id.

sort_dirstring

asc or desc. Default: asc.

Sample Request​

curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
'https://api.vietnix.cloud:9696/v2.0/security-groups'

Response​

security_groupsarrayrequired

List of security group objects.

idstringrequired

Security group ID.

namestringrequired

Security group name.

descriptionstringrequired

Free-form description.

statefulbooleanrequired

Whether the group is stateful: return traffic for allowed connections is permitted automatically.

tenant_idstringrequired

The project that owns the group.

security_group_rulesarrayrequired

Rules in this group. Each rule has direction, ethertype, protocol, port_range_min, port_range_max, remote_ip_prefix, and remote_group_id.

tagsarrayrequired

Tags attached to the group.

Sample Response​

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": []
}
]
}

Status Code​

Success​

Status CodeDescription
200 - OKRequest was successful.

Error​

Status CodeDescription
401 - UnauthorizedUser must authenticate before making a request.
403 - ForbiddenPolicy does not allow current user to do this operation.
note

The default group allows all egress and only ingress from members of the same group. A VM created without an explicit security group lands in default, which means no inbound SSH or HTTP until you add a rule or attach another group.