| OLD | NEW |
| 1 # -*- coding: utf-8 -*- |
| 1 # Copyright 2012 Google Inc. All Rights Reserved. | 2 # Copyright 2012 Google Inc. All Rights Reserved. |
| 2 # | 3 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 6 # | 7 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 9 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 11 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and | 13 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. | 14 # limitations under the License. |
| 15 """Additional help about Google Cloud Storage projects.""" |
| 14 | 16 |
| 15 from gslib.help_provider import HELP_NAME | 17 from __future__ import absolute_import |
| 16 from gslib.help_provider import HELP_NAME_ALIASES | 18 |
| 17 from gslib.help_provider import HELP_ONE_LINE_SUMMARY | |
| 18 from gslib.help_provider import HelpProvider | 19 from gslib.help_provider import HelpProvider |
| 19 from gslib.help_provider import HELP_TEXT | |
| 20 from gslib.help_provider import HelpType | |
| 21 from gslib.help_provider import HELP_TYPE | |
| 22 | 20 |
| 23 _detailed_help_text = (""" | 21 _DETAILED_HELP_TEXT = (""" |
| 24 <B>OVERVIEW</B> | 22 <B>OVERVIEW</B> |
| 25 This section discusses how to work with projects in Google Cloud Storage. | 23 This section discusses how to work with projects in Google Cloud Storage. |
| 26 | 24 |
| 27 | 25 |
| 28 <B>PROJECT MEMBERS AND PERMISSIONS</B> | 26 <B>PROJECT MEMBERS AND PERMISSIONS</B> |
| 29 There are three groups of users associated with each project: | 27 There are three groups of users associated with each project: |
| 30 | 28 |
| 31 - Project Owners are allowed to list, create, and delete buckets, | 29 - Project Owners are allowed to list, create, and delete buckets, |
| 32 and can also perform administrative tasks like adding and removing team | 30 and can also perform administrative tasks like adding and removing team |
| 33 members and changing billing. The project owners group is the owner | 31 members and changing billing. The project owners group is the owner |
| 34 of all buckets within a project, regardless of who may be the original | 32 of all buckets within a project, regardless of who may be the original |
| 35 bucket creator. | 33 bucket creator. |
| 36 | 34 |
| 37 - Project Editors are allowed to list, create, and delete buckets. | 35 - Project Editors are allowed to list, create, and delete buckets. |
| 38 | 36 |
| 39 - All Project Team Members are allowed to list buckets within a project. | 37 - All Project Team Members are allowed to list buckets within a project. |
| 40 | 38 |
| 41 These projects make it easy to set up a bucket and start uploading objects | 39 These projects make it easy to set up a bucket and start uploading objects |
| 42 with access control appropriate for a project at your company, as the three | 40 with access control appropriate for a project at your company, as the three |
| 43 group memberships can be configured by your administrative staff. Control | 41 group memberships can be configured by your administrative staff. Control |
| 44 over projects and their associated memberships is provided by the | 42 over projects and their associated memberships is provided by the |
| 45 `Google Cloud Console <https://cloud.google.com/console#/project>`_. | 43 `Google Developers Console <https://cloud.google.com/console#/project>`_. |
| 46 | 44 |
| 47 | 45 |
| 48 <B>HOW PROJECT MEMBERSHIP IS REFLECTED IN BUCKET ACLS</B> | 46 <B>HOW PROJECT MEMBERSHIP IS REFLECTED IN BUCKET ACLS</B> |
| 49 When you create a bucket without specifying an ACL the bucket is given a | 47 When you create a bucket without specifying an ACL the bucket is given a |
| 50 "project-private" ACL, which grants the permissions described in the previous | 48 "project-private" ACL, which grants the permissions described in the previous |
| 51 section. Here's an example of such an ACL: | 49 section. Here's an example of such an ACL: |
| 52 | 50 |
| 53 <AccessControlList> | 51 [ |
| 54 <Owner> | 52 { |
| 55 <ID> | 53 "entity": "group-00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3
f3a776bf7", |
| 56 00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3f3a776bf7 | 54 "entityId": "00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3f3a7
76bf7", |
| 57 </ID> | 55 "role": "OWNER" |
| 58 </Owner> | 56 }, |
| 59 <Entries> | 57 { |
| 60 <Entry> | 58 "entity": "group-00b4903a977fd817e9da167bc81306489181a110456bb635f466d71
cf90a0d51", |
| 61 <Scope type="GroupById"> | 59 "entityId": "00b4903a977fd817e9da167bc81306489181a110456bb635f466d71cf90
a0d51", |
| 62 <ID> | 60 "role": "OWNER" |
| 63 00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3f3a776bf7 | 61 }, |
| 64 </ID> | 62 { |
| 65 </Scope> | 63 "entity": "00b4903a974898cc8fc309f2f2835308ba3d3df1b889d3fc7e33e187d52d8
e71", |
| 66 <Permission> | 64 "entityId": "00b4903a974898cc8fc309f2f2835308ba3d3df1b889d3fc7e33e187d52
d8e71", |
| 67 FULL_CONTROL | 65 "role": "READER" |
| 68 </Permission> | 66 } |
| 69 </Entry> | 67 ] |
| 70 <Entry> | |
| 71 <Scope type="GroupById"> | |
| 72 <ID> | |
| 73 00b4903a977fd817e9da167bc81306489181a110456bb635f466d71cf90a0d51 | |
| 74 </ID> | |
| 75 </Scope> | |
| 76 <Permission> | |
| 77 FULL_CONTROL | |
| 78 </Permission> | |
| 79 </Entry> | |
| 80 <Entry> | |
| 81 <Scope type="GroupById"> | |
| 82 <ID> | |
| 83 00b4903a974898cc8fc309f2f2835308ba3d3df1b889d3fc7e33e187d52d8e71 | |
| 84 </ID> | |
| 85 </Scope> | |
| 86 <Permission> | |
| 87 READ | |
| 88 </Permission> | |
| 89 </Entry> | |
| 90 </Entries> | |
| 91 </AccessControlList> | |
| 92 | 68 |
| 93 The three "GroupById" scopes are the canonical IDs for the Project Owners, | 69 The three "entityId"s are the canonical IDs for the Project Owners, |
| 94 Project Editors, and All Project Team Members groups. | 70 Project Editors, and All Project Team Members groups. |
| 95 | 71 |
| 96 You can edit the bucket ACL if you want to (see "gsutil help acl"), | 72 You can edit the bucket ACL if you want to (see "gsutil help acl"), |
| 97 but for many cases you'll never need to, and instead can change group | 73 but for many cases you'll never need to, and instead can change group |
| 98 membership via the | 74 membership via the |
| 99 `Google Cloud Console <https://cloud.google.com/console#/project>`_. | 75 `Google Developers Console <https://cloud.google.com/console#/project>`_. |
| 100 | 76 |
| 101 | 77 |
| 102 <B>IDENTIFYING PROJECTS WHEN CREATING AND LISTING BUCKETS</B> | 78 <B>IDENTIFYING PROJECTS WHEN CREATING AND LISTING BUCKETS</B> |
| 103 When you create a bucket or list your buckets, you need to provide the | 79 When you create a bucket or list your buckets, you need to provide the |
| 104 project ID that want to create or list (using the gsutil mb -p option or | 80 project ID that you want to create or list (using the gsutil mb -p option or |
| 105 the gsutil ls -p option, respectively). The project's name shown in the | 81 the gsutil ls -p option, respectively). The project's name shown in the |
| 106 Google Cloud Console is a user-friendly name that you can choose; this is | 82 Google Developers Console is a user-friendly name that you can choose; this is |
| 107 not the project ID required by the gsutil mb and ls commands. To find the | 83 not the project ID required by the gsutil mb and ls commands. To find the |
| 108 project ID, go to the Storage Access pane in the Google Cloud Console. Your | 84 project ID, go to the Cloud Storage pane in the Google Developers Console. |
| 109 project ID is listed under Identifying your project. | 85 The project ID is listed as "Project Number" in the Overview pane of your |
| 86 project. |
| 110 """) | 87 """) |
| 111 | 88 |
| 112 | 89 |
| 113 class CommandOptions(HelpProvider): | 90 class CommandOptions(HelpProvider): |
| 114 """Additional help about Access Control Lists.""" | 91 """Additional help about Google Cloud Storage projects.""" |
| 115 | 92 |
| 116 help_spec = { | 93 # Help specification. See help_provider.py for documentation. |
| 117 # Name of command or auxiliary help info for which this help applies. | 94 help_spec = HelpProvider.HelpSpec( |
| 118 HELP_NAME : 'projects', | 95 help_name='projects', |
| 119 # List of help name aliases. | 96 help_name_aliases=[ |
| 120 HELP_NAME_ALIASES : ['apis console', 'cloud console', 'console', | 97 'apis console', 'cloud console', 'console', 'dev console', 'project', |
| 121 'dev console', 'project', 'proj', 'project-id'], | 98 'proj', 'project-id'], |
| 122 # Type of help: | 99 help_type='additional_help', |
| 123 HELP_TYPE : HelpType.ADDITIONAL_HELP, | 100 help_one_line_summary='Working With Projects', |
| 124 # One line summary of this help. | 101 help_text=_DETAILED_HELP_TEXT, |
| 125 HELP_ONE_LINE_SUMMARY : 'Working With Projects', | 102 subcommand_help_text={}, |
| 126 # The full help text. | 103 ) |
| 127 HELP_TEXT : _detailed_help_text, | |
| 128 } | |
| OLD | NEW |