Virtual Machine
Add firewall rule to virtual machine
Creates a firewall rule and applies it to a virtual machine. Include the virtual machine ID in the path and the firewall rule configuration in the request body.
post/core/virtual-machines/{vm_id}/sg-rules
Request
- Base URL: https://infrahub-api.nexgencloud.com/v1
- URL: https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{vm_id}/sg-rules
- Auth: API key in header api_key
Path parameters
vm_idinteger required
ID of the vm.
Request body
Example request
{
"protocol": "any"
}Response
The firewall rule has been successfully added to the virtual machine.
Example response
{
"status": true,
"message": "Security Rule created successfully",
"security_rule": {
"id": 5341,
"direction": "ingress",
"protocol": "tcp",
"port_range_min": 22,
"port_range_max": 22,
"ethertype": "IPv4",
"remote_ip_prefix": "0.0.0.0/0",
"status": "pending",
"created_at": "2026-05-06T14:32:11Z"
}
}Changes
No recorded changes to this operation across all 1 revision of this API.