Skip to content

Protect an instance against deletion, or lift the protection

  • Method: PUT
  • Path: /v1/orgs/{org}/compute/vms/{vm_id}/protection
  • Operation ID: setVmProtection
  • Tag: Compute

Send Authorization: Bearer <credential>. The credential is either an API key (vsk_…) created for an organization, or an OIDC access token obtained by signing in to VirtScale.

Name Type Required Description
vm_id string (uuid) Yes VirtScale instance id
org string (uuid) Yes The organization’s id.

Content type application/json, schema VmProtectionRequest, required.

Field Type Required Enum Description
protected boolean Yes
Field Type Required Enum Description
allowed_actions array of string Yes What may be asked of this instance where it is, from the vocabulary start, stop, reboot, console, resize, rebuild, rescue, unrescue, delete, firewall, public_ip, protection, in that order. Any action not listed is refused with 409 vm_action_not_allowed. An instance in a region whose disks are single copies on one host allows start, stop, reboot and console only, and start and console only while it is protected; any other instance allows every action, less delete while it is protected. This is policy, not state: a listed action can still be refused for the state the instance is in.
created_at string (date-time) Yes
desired_state string Yes
disk_gb integer Yes
error_class string, nullable Yes
error_detail string, nullable Yes A fixed phrase and a non-identifying context label. Never a vendor exception, endpoint or response body.
fqdn string, nullable Yes Null for a customer account: the zone is VirtScale’s own, and publishing a customer hostname in it would be a namespace nobody asked to share.
id string (uuid) Yes
image ImageRef Yes
image.glance_id string Yes
image.name string Yes
memory_mb integer Yes
name string Yes
network_profile_id string Yes
observed_addresses object, nullable Yes
observed_at string (date-time), nullable Yes
observed_status string, nullable Yes
org_id string (uuid) Yes
protected boolean Yes While true, deleting the instance is refused with 409 vm_protected. An owner of the organization switches it with PUT /v1/orgs/{org}/compute/vms/{vm_id}/protection.
region_id string Yes
ssh_key_names array of string Yes Names of the SSH keys attached to the instance. No key material.
state string Yes
storage_pool_id string Yes
updated_at string (date-time) Yes
user_data_present boolean Yes
vcpus integer Yes
workload_type string Yes

Every error response is application/problem+json (schema Problem).

Status Meaning
400 The request is malformed or failed validation.
401 The credential is missing or invalid.
403 The credential does not have permission to perform this operation.
404 The resource does not exist.
default Any other status is possible; the code field identifies the error.
curl -X PUT "https://api.virtscale.nl/v1/orgs/$ORG_ID/compute/vms/$VM_ID/protection" \
  -H "Authorization: Bearer $VIRTSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  --data @body.json