/v1/firewall-policies/{uid}/attachmentsAttaches 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
uidstringRequiredThe firewall policy's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
Request body
resource_typestringRequiredKind of resource to attach the policy to. Case-insensitive.
One ofvmdatabasedeployment
resource_uidstringRequiredUID of the VM, database or deployment.
Response
The policy is attached to the resource.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredOn 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.
uidstringRequiredUnique identifier of the attachment. Use it to detach the policy.
resource_typestringRequiredKind of resource the policy is attached to.
One ofvmdatabasedeployment
resourceobjectRequiredShort description of the attached resource. All fields are empty strings if the resource no longer exists.
Show attributesHide attributes
uidstringRequiredUID of the VM, database or deployment.
namestringRequiredName of the resource.
slugstringRequiredSlug of the resource.
statusstringRequiredCurrent status of the resource. For VMs and databases this is the display status.
Errors
| Status | Meaning |
|---|---|
400 | The body is not valid JSON (invalid request) or resource_type is not supported (resource_type must be vm, database, or deployment). |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The 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.