List Security Groups
/v2.0/security-groupsSecurity 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.
Source: list-security-groups
Request
Query parameters
idstringFilter by security group ID. Can be repeated.
namestringFilter by security group name. Names are not unique.
descriptionstringFilter by description.
tenant_idstringFilter by owning project ID.
project_idstringAlias of tenant_id.
tagsstringComma-separated list; matches groups that have all the tags.
tags-anystringComma-separated list; matches groups that have at least one tag.
not-tagsstringComma-separated list; excludes groups that have all the tags.
limitintegerMaximum number of groups per page.
markerstringID of the last group on the previous page.
sort_keystringAttribute to sort by. Default: id.
sort_dirstringasc 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_groupsarrayrequiredList of security group objects.
idstringrequiredSecurity group ID.
namestringrequiredSecurity group name.
descriptionstringrequiredFree-form description.
statefulbooleanrequiredWhether the group is stateful: return traffic for allowed connections is permitted automatically.
tenant_idstringrequiredThe project that owns the group.
security_group_rulesarrayrequiredRules in this group. Each rule has direction, ethertype, protocol, port_range_min, port_range_max, remote_ip_prefix, and remote_group_id.
tagsarrayrequiredTags 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 Code | Description |
|---|---|
| 200 - OK | Request was successful. |
Error
| Status Code | Description |
|---|---|
| 401 - Unauthorized | User must authenticate before making a request. |
| 403 - Forbidden | Policy does not allow current user to do this operation. |
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.