Reference API documentation for google-cloud-storage
.
Modules
acl
Manipulate access control lists that Cloud Storage provides.
Bucket has a getting method that creates an ACL object under the hood, and you can interact with that using acl:
.. literalinclude:: snippets.py :start-after: [START client_bucket_acl] :end-before: [END client_bucket_acl] :dedent: 4
Adding and removing permissions can be done with the following methods (in increasing order of granularity):
ACL.all
corresponds to access for all users.ACL.all_authenticated
corresponds to access for all users that are signed into a Google account.ACL.domain
corresponds to access on a per Google Apps domain (ie,example.com
).ACL.group
corresponds to access on a per group basis (either by ID or e-mail address).ACL.user
corresponds to access on a per user basis (either by ID or e-mail address).
And you are able to grant
and revoke
the following roles:
- Reading:
_ACLEntity.grant_read
and_ACLEntity.revoke_read
- Writing:
_ACLEntity.grant_write
and_ACLEntity.revoke_write
- Owning:
_ACLEntity.grant_owner
and_ACLEntity.revoke_owner
You can use any of these like any other factory method (these happen to
be _ACLEntity
factories):
.. literalinclude:: snippets.py :start-after: [START acl_user_settings] :end-before: [END acl_user_settings] :dedent: 4
After that, you can save any changes you make with the save method:
.. literalinclude:: snippets.py :start-after: [START acl_save] :end-before: [END acl_save] :dedent: 4
You can alternatively save any existing ACL object (whether it was created by a factory method or not) from a Bucket:
.. literalinclude:: snippets.py :start-after: [START acl_save_bucket] :end-before: [END acl_save_bucket] :dedent: 4
To get the list of entity
and role
for each unique pair, the
ACL
class is iterable:
.. literalinclude:: snippets.py :start-after: [START acl_print] :end-before: [END acl_print] :dedent: 4
This list of tuples can be used as the entity
and role
fields
when sending metadata for ACLs to the API.
batch
Batch updates / deletes of storage buckets / blobs.
See https://cloud.google.com/storage/docs/json_api/v1/how-tos/batch
blob
Create / interact with Google Cloud Storage blobs.
bucket
Create / interact with Google Cloud Storage buckets.
client
Client for interacting with the Google Cloud Storage API.
constants
Constants used acros google.cloud.storage modules.
hmac_key
API documentation for storage.hmac_key
module.
notification
Support for bucket notification resources.
retry
API documentation for storage.retry
module.