| OLD | NEW |
| (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 | |
| 33 _detailed_help_text = (""" | |
| 34 <B>SYNOPSIS</B> | |
| 35 gsutil getdefacl uri | |
| 36 | |
| 37 <B>DESCRIPTION</B> | |
| 38 Gets the default ACL XML for a bucket, which you can save and edit | |
| 39 for use with the setdefacl command. | |
| 40 """) | |
| 41 | |
| 42 | |
| 43 class GetDefAclCommand(Command): | |
| 44 """Implementation of gsutil getdefacl command.""" | |
| 45 | |
| 46 # Command specification (processed by parent class). | |
| 47 command_spec = { | |
| 48 # Name of command. | |
| 49 COMMAND_NAME : 'getdefacl', | |
| 50 # List of command name aliases. | |
| 51 COMMAND_NAME_ALIASES : [], | |
| 52 # Min number of args required by this command. | |
| 53 MIN_ARGS : 1, | |
| 54 # Max number of args required by this command, or NO_MAX. | |
| 55 MAX_ARGS : 1, | |
| 56 # Getopt-style string specifying acceptable sub args. | |
| 57 SUPPORTED_SUB_ARGS : '', | |
| 58 # True if file URIs acceptable for this command. | |
| 59 FILE_URIS_OK : False, | |
| 60 # True if provider-only URIs acceptable for this command. | |
| 61 PROVIDER_URIS_OK : False, | |
| 62 # Index in args of first URI arg. | |
| 63 URIS_START_ARG : 0, | |
| 64 # True if must configure gsutil before running command. | |
| 65 CONFIG_REQUIRED : True, | |
| 66 } | |
| 67 help_spec = { | |
| 68 # Name of command or auxiliary help info for which this help applies. | |
| 69 HELP_NAME : 'getdefacl', | |
| 70 # List of help name aliases. | |
| 71 HELP_NAME_ALIASES : [], | |
| 72 # Type of help: | |
| 73 HELP_TYPE : HelpType.COMMAND_HELP, | |
| 74 # One line summary of this help. | |
| 75 HELP_ONE_LINE_SUMMARY : 'Get default ACL XML for a bucket', | |
| 76 # The full help text. | |
| 77 HELP_TEXT : _detailed_help_text, | |
| 78 } | |
| 79 | |
| 80 # Command entry point. | |
| 81 def RunCommand(self): | |
| 82 if not self.suri_builder.StorageUri(self.args[-1]).names_bucket(): | |
| 83 raise CommandException('URI must name a bucket for the %s command' % | |
| 84 self.command_name) | |
| 85 self.GetAclCommandHelper() | |
| 86 return 0 | |
| OLD | NEW |