Create a resource lock

Beta Create a lock for a resource, to help prevent you from inadvertently deleting it or modifying some aspects of it. You can apply a lock to a single resource, or to a resource and all of its sub-resources. This operation can only be accessed by account users with unrestricted access. Talk to your local account administrator about access management.

Once a resource has a lock, that resource (and its sub-resources, if applicable) can't be deleted, regardless of your user permission. You can unlock a resource by running the Delete a resource lock operation for the specific lock.

👍

There's a tutorial

We offer an example API workflow you can follow to set up a resource lock on a Linode.

Permissions and scopes

To call this operation, you need the following:

  • OAuth scopes. Your user needs these scopes assigned. Learn more.

    • Scopes: account:read_write

CLI

linode-cli resource-locks create \
--entity_id 8642531 \
--entity_type linode \
--lock_type cannot_delete \

Learn more

Path Params
string
enum
required

Enum Call the v4beta URL for operations still only in beta.

Allowed:
Body Params
integer
required

The unique identifier assigned to the resource where you want to apply the lock. Get this value by running the list operation for the appropriate resource. For example, if your resource is one of your Linodes, run the List Linode instances operation and store the id for the appropriate Linode from the response.

📘

Your user needs to have access to the target resource.

string
enum
required

The type of resource where you want to apply the lock. Use linode for a resource lock on a Linode, nodebalancer for a NodeBalancer, or volume for a Block Storage volume.

Allowed:
string
enum
required

The type of lock you want to apply to the resource. A single resource can have one of these lock types set for it:

  • cannot_delete. The resource itself can't be deleted. Any sub-resources attached to it can be freely deleted. You need to unlock the resource by deleting its lock to delete it.

  • cannot_delete_with_subresources. The resource and its various sub-resources can't be deleted. For example, if a Linode instance has a configuration profile interface assigned to it, this lock prevents you from deleting either of them. You need to unlock the resource by deleting its lock. Then you can delete the resource and any of its sub-resources.

Allowed:
Responses

Language
Credentials
LoadingLoading…
Response
Choose an example:
application/json