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

Side by Side Diff: third_party/gsutil/gslib/addlhelp/versioning.py

Issue 12042069: Scripts to download files from google storage based on sha1 sums (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Removed gsutil/tests and gsutil/docs Created 7 years, 10 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 2012 Google Inc.
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.help_provider import HELP_NAME
16 from gslib.help_provider import HELP_NAME_ALIASES
17 from gslib.help_provider import HELP_ONE_LINE_SUMMARY
18 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
23 _detailed_help_text = ("""
24 <B>OVERVIEW OF VERSIONING</B>
25 Versioning-enabled buckets will maintain an archive of overwritten objects,
26 thus providing a way to restore accidentally deleted or older versions of
27 your data.
28
29 For information about Google Cloud Storage versioning, see:
30 https://developers.google.com/storage/docs/object-versioning
31
32 Version-unaware gsutil commands will interact with the latest version of the
33 target object. The template for version-aware commands is to use the "-a"
34 flag to refer to all versions of an object and to use "-v" to indicate that
35 storage URI arguments should be parsed for version IDs or generation numbers.
36
37 Version-ful storage URIs are specified by appending a '#' character
38 followed by a version ID (S3) or generation number (GCS). Google Cloud
39 Storage users may also include a meta-generation number by further appending
40 a '.' character followed by the meta-generation, although all commands
41 currently ignore this value.
42
43 Examples of version-ful URIs:
44 gs://bucket/object#1348879296388002
45 gs://bucket/object#1348879296388002.6
46 s3://bucket/object#OQBvIrRQ6CLeBIi3oTnM3Jam..t0KGxo
47
48 Note that version-ful URIs must be used in conjunction with the "-v" flag in
49 order to distinguish these URIs from object names containing '#' characters.
50
51
52 <B>ENABLING VERSIONING</B>
53 The <B>getversioning</B> and <B>setversioning</B> subcommands allow users to
54 view and set the versioning property on cloud storage buckets respectively.
55
56
57 <B>LISTING OBJECT VERSIONS</B>
58 As described in the overview, listing respects the "-a" argument to show all
59 versions of objects. For example:
60
61 gsutil ls -a -l gs://bucket
62
63
64 <B>DELETING OBJECT VERSIONS</B>
65 Using the rm subcommand with "-a" will instruct gsutil to delete all versions
66 of the target object (use with caution).
67
68 gsutil rm -a gs://bucket/object
69
70 Remove also supports "-v" for specifying that the target URI is version-ful:
71
72 gsutil rm -v gs://bucket/object#1348879296388002
73
74
75 <B>OTHER VERSION-AWARE COMMANDS</B>
76 In addition to rm, the following commands also support the "-v" flag to
77 specify a target object's version:
78
79 cat, cp, getacl, setacl
80
81
82 <B>WARNING ABOUT USING SETMETA WITH VERSIONING ENABLED</B>
83
84 Note that if you use the gsutil setmeta command on an object in a bucket
85 with versioning enabled, it will create a new object version (and thus,
86 you will get charged for the space required for holding the additional version.
87 """)
88
89
90 class CommandOptions(HelpProvider):
91 """Additional help about object versioning."""
92
93 help_spec = {
94 # Name of command or auxiliary help info for which this help applies.
95 HELP_NAME : 'versioning',
96 # List of help name aliases.
97 HELP_NAME_ALIASES : ['versioning', 'versions'],
98 # Type of help:
99 HELP_TYPE : HelpType.ADDITIONAL_HELP,
100 # One line summary of this help.
101 HELP_ONE_LINE_SUMMARY : 'Working with object versions',
102 # The full help text.
103 HELP_TEXT : _detailed_help_text,
104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698