Class ACL (2.3.0) Stay organized with collections Save and categorize content based on your preferences.
- 3.8.0 (latest)
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.1
- 3.3.1
- 3.2.0
- 3.1.1
- 3.0.0
- 2.19.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.1
- 2.1.0
- 2.0.0
- 1.44.0
- 1.43.0
- 1.42.3
- 1.41.1
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.1
- 1.36.2
- 1.35.1
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.2
- 1.30.0
- 1.29.0
- 1.28.1
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.1
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
ACL()Container class representing a list of access controls.
Properties
client
Abstract getter for the object client.
Methods
add_entity
add_entity(entity)Add an entity to the ACL.
| Parameter | |
|---|---|
| Name | Description |
entity | The entity to add to this ACL. |
all
all()Factory method for an Entity representing all users.
| Returns | |
|---|---|
| Type | Description |
| An entity representing all users. |
all_authenticated
all_authenticated()Factory method for an Entity representing all authenticated users.
| Returns | |
|---|---|
| Type | Description |
| An entity representing all authenticated users. |
clear
clear(client=None,if_generation_match=None,if_generation_not_match=None,if_metageneration_match=None,if_metageneration_not_match=None,timeout=60,retry=<google.cloud.storage.retry.ConditionalRetryPolicyobject>)Remove all ACL entries.
Ifuser_project is set, bills the API request to that project.
Note that this won't actually removeALL the rules, but itwill remove all the non-default rules. In short, you'll stillhave access to a bucket that you created even after you clearACL rules with this method.
| Parameters | |
|---|---|
| Name | Description |
client | Client or(Optional) The client to use. If not passed, falls back to the |
if_generation_match | long(Optional) See :ref: |
if_generation_not_match | long(Optional) See :ref: |
if_metageneration_match | long(Optional) See :ref: |
if_metageneration_not_match | long(Optional) See :ref: |
timeout | float or tuple(Optional) The amount of time, in seconds, to wait for the server response. See: |
retry | google.api_core.retry.Retry orgoogle.cloud.storage.retry.ConditionalRetryPolicy(Optional) How to retry the RPC. See: |
domain
domain(domain)Factory method for a domain Entity.
| Parameter | |
|---|---|
| Name | Description |
domain | strThe domain for this entity. |
| Returns | |
|---|---|
| Type | Description |
| An entity corresponding to this domain. |
entity
entity(entity_type,identifier=None)Factory method for creating an Entity.
If an entity with the same type and identifier already exists,this will return a reference to that entity. If not, it willcreate a new one and add it to the list of known entities forthis ACL.
| Parameters | |
|---|---|
| Name | Description |
entity_type | strThe type of entity to create (ie, |
identifier | strThe ID of the entity (if applicable). This can be either an ID or an e-mail address. |
| Returns | |
|---|---|
| Type | Description |
| A new Entity or a reference to an existing identical entity. |
entity_from_dict
entity_from_dict(entity_dict)Build an _ACLEntity object from a dictionary of data.
An entity is a mutable object that represents a list of rolesbelonging to either a user or group or the special types for allusers and all authenticated users.
| Parameter | |
|---|---|
| Name | Description |
entity_dict | dictDictionary full of data from an ACL lookup. |
| Returns | |
|---|---|
| Type | Description |
| An Entity constructed from the dictionary. |
get_entities
get_entities()Get a list of all Entity objects.
| Returns | |
|---|---|
| Type | Description |
list of | A list of all Entity objects. |
get_entity
get_entity(entity,default=None)Gets an entity object from the ACL.
| Parameters | |
|---|---|
| Name | Description |
entity | The entity to get lookup in the ACL. |
default | anythingThis value will be returned if the entity doesn't exist. |
| Returns | |
|---|---|
| Type | Description |
| The corresponding entity or the value provided todefault. |
group
group(identifier)Factory method for a group Entity.
| Parameter | |
|---|---|
| Name | Description |
identifier | strAn id or e-mail for this particular group. |
| Returns | |
|---|---|
| Type | Description |
| An Entity corresponding to this group. |
has_entity
has_entity(entity)Returns whether or not this ACL has any entries for an entity.
| Parameter | |
|---|---|
| Name | Description |
entity | The entity to check for existence in this ACL. |
| Returns | |
|---|---|
| Type | Description |
bool | True of the entity exists in the ACL. |
reload
reload(client=None,timeout=60,retry=<google.api_core.retry.Retryobject>)Reload the ACL data from Cloud Storage.
Ifuser_project is set, bills the API request to that project.
| Parameters | |
|---|---|
| Name | Description |
client | Client or(Optional) The client to use. If not passed, falls back to the |
timeout | float or tuple(Optional) The amount of time, in seconds, to wait for the server response. See: |
retry | (Optional) How to retry the RPC. See: |
reset
reset()Remove all entities from the ACL, and clear theloaded flag.
save
save(acl=None,client=None,if_generation_match=None,if_generation_not_match=None,if_metageneration_match=None,if_metageneration_not_match=None,timeout=60,retry=<google.cloud.storage.retry.ConditionalRetryPolicyobject>)Save this ACL for the current bucket.
Ifuser_project is set, bills the API request to that project.
| Parameters | |
|---|---|
| Name | Description |
acl | ACL, or a compatible list.The ACL object to save. If left blank, this will save current entries. |
client | Client or(Optional) The client to use. If not passed, falls back to the |
if_generation_match | long(Optional) See :ref: |
if_generation_not_match | long(Optional) See :ref: |
if_metageneration_match | long(Optional) See :ref: |
if_metageneration_not_match | long(Optional) See :ref: |
timeout | float or tuple(Optional) The amount of time, in seconds, to wait for the server response. See: |
retry | google.api_core.retry.Retry orgoogle.cloud.storage.retry.ConditionalRetryPolicy(Optional) How to retry the RPC. See: |
save_predefined
save_predefined(predefined,client=None,if_generation_match=None,if_generation_not_match=None,if_metageneration_match=None,if_metageneration_not_match=None,timeout=60,retry=<google.cloud.storage.retry.ConditionalRetryPolicyobject>)Save this ACL for the current bucket using a predefined ACL.
Ifuser_project is set, bills the API request to that project.
| Parameters | |
|---|---|
| Name | Description |
predefined | strAn identifier for a predefined ACL. Must be one of the keys in |
client | Client or(Optional) The client to use. If not passed, falls back to the |
if_generation_match | long(Optional) See :ref: |
if_generation_not_match | long(Optional) See :ref: |
if_metageneration_match | long(Optional) See :ref: |
if_metageneration_not_match | long(Optional) See :ref: |
timeout | float or tuple(Optional) The amount of time, in seconds, to wait for the server response. See: |
retry | google.api_core.retry.Retry orgoogle.cloud.storage.retry.ConditionalRetryPolicy(Optional) How to retry the RPC. See: |
user
user(identifier)Factory method for a user Entity.
| Parameter | |
|---|---|
| Name | Description |
identifier | strAn id or e-mail for this particular user. |
| Returns | |
|---|---|
| Type | Description |
| An Entity corresponding to this user. |
validate_predefined
validate_predefined(predefined)Ensures predefined is in list of predefined json values
| Parameter | |
|---|---|
| Name | Description |
predefined | strvalidated JSON name of predefined acl |
| Exceptions | |
|---|---|
| Type | Description |
:exc | ValueError: If predefined is not a valid acl |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-29 UTC.