-
Notifications
You must be signed in to change notification settings - Fork 167
docs: fix c.g.c structure #982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| ACL | ||
| === | ||
|
|
||
| Cloud Storage uses access control lists (ACLs) to manage object and bucket access. | ||
| ACLs are the mechanism you use to share files with other users and allow | ||
| other users to access your buckets and files. | ||
|
|
||
| ACLs are suitable for fine-grained control, but you may prefer using IAM to | ||
| control access at the project level. See also: | ||
| `Cloud Storage Control Access to Data <https://cloud.google.com/storage/docs/access-control>`_ | ||
|
|
||
|
|
||
| :class:`google.cloud.storage.bucket.Bucket` has a getting method that creates | ||
| an ACL object under the hood, and you can interact with that using | ||
| :func:`google.cloud.storage.bucket.Bucket.acl`: | ||
|
|
||
| .. code-block:: python | ||
| client = storage.Client() | ||
| bucket = client.get_bucket(bucket_name) | ||
| acl = bucket.acl | ||
| Adding and removing permissions can be done with the following methods | ||
| (in increasing order of granularity): | ||
|
|
||
| - :func:`ACL.all` | ||
| corresponds to access for all users. | ||
| - :func:`ACL.all_authenticated` corresponds | ||
| to access for all users that are signed into a Google account. | ||
| - :func:`ACL.domain` corresponds to access on a | ||
| per Google Apps domain (ie, ``example.com``). | ||
| - :func:`ACL.group` corresponds to access on a | ||
| per group basis (either by ID or e-mail address). | ||
| - :func:`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**: | ||
| :func:`_ACLEntity.grant_read` and :func:`_ACLEntity.revoke_read` | ||
| - **Writing**: | ||
| :func:`_ACLEntity.grant_write` and :func:`_ACLEntity.revoke_write` | ||
| - **Owning**: | ||
| :func:`_ACLEntity.grant_owner` and :func:`_ACLEntity.revoke_owner` | ||
|
|
||
| You can use any of these like any other factory method (these happen to | ||
| be :class:`_ACLEntity` factories): | ||
|
|
||
| .. code-block:: python | ||
| acl.user("[email protected]").grant_read() | ||
| acl.all_authenticated().grant_write() | ||
| After that, you can save any changes you make with the | ||
| :func:`google.cloud.storage.acl.ACL.save` method: | ||
|
|
||
| .. code-block:: python | ||
| acl.save() | ||
| You can alternatively save any existing :class:`google.cloud.storage.acl.ACL` | ||
| object (whether it was created by a factory method or not) from a | ||
| :class:`google.cloud.storage.bucket.Bucket`: | ||
|
|
||
| .. code-block:: python | ||
| bucket.acl.save(acl=acl) | ||
| To get the list of ``entity`` and ``role`` for each unique pair, the | ||
| :class:`ACL` class is iterable: | ||
|
|
||
| .. code-block:: python | ||
| print(list(acl)) | ||
| # [{'role': 'OWNER', 'entity': 'allUsers'}, ...] | ||
| This list of tuples can be used as the ``entity`` and ``role`` fields | ||
| when sending metadata for ACLs to the API. | ||
|
|
||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,88 +1,5 @@ | ||
| ACL | ||
| === | ||
|
|
||
| Cloud Storage uses access control lists (ACLs) to manage object and bucket access. | ||
| ACLs are the mechanism you use to share files with other users and allow | ||
| other users to access your buckets and files. | ||
|
|
||
| ACLs are suitable for fine-grained control, but you may prefer using IAM to | ||
| control access at the project level. See also: | ||
| `Cloud Storage Control Access to Data <https://cloud.google.com/storage/docs/access-control>`_ | ||
|
|
||
|
|
||
| :class:`google.cloud.storage.bucket.Bucket` has a getting method that creates | ||
| an ACL object under the hood, and you can interact with that using | ||
| :func:`google.cloud.storage.bucket.Bucket.acl`: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| client = storage.Client() | ||
| bucket = client.get_bucket(bucket_name) | ||
| acl = bucket.acl | ||
|
|
||
| Adding and removing permissions can be done with the following methods | ||
| (in increasing order of granularity): | ||
|
|
||
| - :func:`ACL.all` | ||
| corresponds to access for all users. | ||
| - :func:`ACL.all_authenticated` corresponds | ||
| to access for all users that are signed into a Google account. | ||
| - :func:`ACL.domain` corresponds to access on a | ||
| per Google Apps domain (ie, ``example.com``). | ||
| - :func:`ACL.group` corresponds to access on a | ||
| per group basis (either by ID or e-mail address). | ||
| - :func:`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**: | ||
| :func:`_ACLEntity.grant_read` and :func:`_ACLEntity.revoke_read` | ||
| - **Writing**: | ||
| :func:`_ACLEntity.grant_write` and :func:`_ACLEntity.revoke_write` | ||
| - **Owning**: | ||
| :func:`_ACLEntity.grant_owner` and :func:`_ACLEntity.revoke_owner` | ||
|
|
||
| You can use any of these like any other factory method (these happen to | ||
| be :class:`_ACLEntity` factories): | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| acl.user("[email protected]").grant_read() | ||
| acl.all_authenticated().grant_write() | ||
|
|
||
| After that, you can save any changes you make with the | ||
| :func:`google.cloud.storage.acl.ACL.save` method: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| acl.save() | ||
|
|
||
|
|
||
| You can alternatively save any existing :class:`google.cloud.storage.acl.ACL` | ||
| object (whether it was created by a factory method or not) from a | ||
| :class:`google.cloud.storage.bucket.Bucket`: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| bucket.acl.save(acl=acl) | ||
|
|
||
|
|
||
| To get the list of ``entity`` and ``role`` for each unique pair, the | ||
| :class:`ACL` class is iterable: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| print(list(acl)) | ||
| # [{'role': 'OWNER', 'entity': 'allUsers'}, ...] | ||
|
|
||
|
|
||
| This list of tuples can be used as the ``entity`` and ``role`` fields | ||
| when sending metadata for ACLs to the API. | ||
|
|
||
|
|
||
| ACL Module | ||
| ---------- | ||
| ----------- | ||
|
|
||
| .. automodule:: google.cloud.storage.acl | ||
| :members: | ||
|
|
||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| Buckets | ||
| Bucket | ||
| ~~~~~~~ | ||
|
|
||
| .. automodule:: google.cloud.storage.bucket | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the structure and moving the guides up. With this update, I plan to modify this guide to include both ACL and IAM. I'll create a separate PR once this is merged in :)