Skip to content

Attach a firewall policy

POST/v1/firewall-policies/{uid}/attachments

Attaches the policy to a VM, database or deployment in the workspace and queues a firewall.apply operation for that resource. From then on the resource only accepts traffic allowed by its attached policies.

Attaching a policy that is already attached to the resource changes nothing. It returns the existing attachment with 201 and an empty operation_id.

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Path parameters

uidstringRequired

The firewall policy's uid.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

Request body

resource_typestringRequired

Kind of resource to attach the policy to. Case-insensitive.

One ofvmdatabasedeployment

resource_uidstringRequired

UID of the VM, database or deployment.

Response

201

The policy is attached to the resource.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

On Attach a firewall policy, the UID of the firewall.apply operation queued for the resource. An empty string when the policy was already attached or no operation could be queued, and always empty when attachments are returned inside a policy.

uidstringRequired

Unique identifier of the attachment. Use it to detach the policy.

resource_typestringRequired

Kind of resource the policy is attached to.

One ofvmdatabasedeployment

resourceobjectRequired

Short description of the attached resource. All fields are empty strings if the resource no longer exists.

Show attributes
uidstringRequired

UID of the VM, database or deployment.

namestringRequired

Name of the resource.

slugstringRequired

Slug of the resource.

statusstringRequired

Current status of the resource. For VMs and databases this is the display status.

Errors

StatusMeaning
400The body is not valid JSON (invalid request) or resource_type is not supported (resource_type must be vm, database, or deployment).
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The policy or the resource does not exist in this workspace. Messages: firewall policy not found, vm not found, database not found or deployment not found.

Errors use the standard error format.