Skip to main content
The resource_restrictions client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
Restricting a resource prevents roles bound at higher hierarchy levels (space, org, account) from granting access to it. Only users with the PROJECT_RESTRICT permission can perform these actions. Currently only PROJECT resources are supported.

Restrict a Resource

This operation is idempotent — restricting an already-restricted resource returns the existing restriction without error.
restriction = client.resource_restrictions.restrict(
    resource_id="your-project-id",  # global ID of the resource to restrict
)

print(restriction)

Unrestrict a Resource

client.resource_restrictions.unrestrict(
    resource_id="your-project-id",  # global ID of the resource to unrestrict
)