Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/gsutil/gslib/commands/setdefacl.py

Issue 2280023003: depot_tools: Remove third_party/gsutil (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2011 Google Inc. All Rights Reserved.
2 #
3 # 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 obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from gslib.command import Command
16 from gslib.command import COMMAND_NAME
17 from gslib.command import COMMAND_NAME_ALIASES
18 from gslib.command import CONFIG_REQUIRED
19 from gslib.command import FILE_URIS_OK
20 from gslib.command import MAX_ARGS
21 from gslib.command import MIN_ARGS
22 from gslib.command import PROVIDER_URIS_OK
23 from gslib.command import SUPPORTED_SUB_ARGS
24 from gslib.command import URIS_START_ARG
25 from gslib.exception import CommandException
26 from gslib.help_provider import HELP_NAME
27 from gslib.help_provider import HELP_NAME_ALIASES
28 from gslib.help_provider import HELP_ONE_LINE_SUMMARY
29 from gslib.help_provider import HELP_TEXT
30 from gslib.help_provider import HelpType
31 from gslib.help_provider import HELP_TYPE
32 from gslib.util import NO_MAX
33
34 _detailed_help_text = ("""
35 <B>SYNOPSIS</B>
36 gsutil setdefacl file-or-canned_acl_name uri...
37
38
39 <B>DESCRIPTION</B>
40
41 The setdefacl command sets default object ACLs for the specified buckets. If
42 you specify a default object ACL for a certain bucket, Google Cloud Storage
43 applies the default object ACL to all new objects uploaded to that bucket.
44
45 Similar to the setacl command, the file-or-canned_acl_name names either a
46 canned ACL or the path to a file that contains ACL XML. (See "gsutil
47 help setacl" for examples of editing and setting ACLs via the
48 getacl/setacl commands.)
49
50 If you don't set a default object ACL on a bucket, the bucket's default
51 object ACL will be project-private.
52
53 Setting a default object ACL on a bucket provides a convenient way
54 to ensure newly uploaded objects have a specific ACL, and avoids the
55 need to back after the fact and set ACLs on a large number of objects
56 for which you forgot to set the ACL at object upload time (which can
57 happen if you don't set a default object ACL on a bucket, and get the
58 default project-private ACL).
59 """)
60
61
62 class SetDefAclCommand(Command):
63 """Implementation of gsutil setdefacl command."""
64
65 # Command specification (processed by parent class).
66 command_spec = {
67 # Name of command.
68 COMMAND_NAME : 'setdefacl',
69 # List of command name aliases.
70 COMMAND_NAME_ALIASES : [],
71 # Min number of args required by this command.
72 MIN_ARGS : 2,
73 # Max number of args required by this command, or NO_MAX.
74 MAX_ARGS : NO_MAX,
75 # Getopt-style string specifying acceptable sub args.
76 SUPPORTED_SUB_ARGS : '',
77 # True if file URIs acceptable for this command.
78 FILE_URIS_OK : False,
79 # True if provider-only URIs acceptable for this command.
80 PROVIDER_URIS_OK : False,
81 # Index in args of first URI arg.
82 URIS_START_ARG : 1,
83 # True if must configure gsutil before running command.
84 CONFIG_REQUIRED : True,
85 }
86 help_spec = {
87 # Name of command or auxiliary help info for which this help applies.
88 HELP_NAME : 'setdefacl',
89 # List of help name aliases.
90 HELP_NAME_ALIASES : ['default acl'],
91 # Type of help:
92 HELP_TYPE : HelpType.COMMAND_HELP,
93 # One line summary of this help.
94 HELP_ONE_LINE_SUMMARY : 'Set default ACL on buckets',
95 # The full help text.
96 HELP_TEXT : _detailed_help_text,
97 }
98
99 # Command entry point.
100 def RunCommand(self):
101 if not self.suri_builder.StorageUri(self.args[-1]).names_bucket():
102 raise CommandException('URI must name a bucket for the %s command' %
103 self.command_name)
104 self.SetAclCommandHelper()
105 return 0
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/commands/setcors.py ('k') | third_party/gsutil/gslib/commands/setmeta.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698