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

Unified Diff: third_party/boto/boto/s3/lifecycle.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/boto/boto/s3/key.py ('k') | third_party/boto/boto/sdb/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/s3/lifecycle.py
===================================================================
--- third_party/boto/boto/s3/lifecycle.py (revision 33376)
+++ third_party/boto/boto/s3/lifecycle.py (working copy)
@@ -23,16 +23,18 @@
class Rule(object):
"""
- A Lifcycle rule for an S3 bucket.
+ A Lifecycle rule for an S3 bucket.
:ivar id: Unique identifier for the rule. The value cannot be longer
- than 255 characters.
+ than 255 characters. This value is optional. The server will
+ generate a unique value for the rule if no value is provided.
:ivar prefix: Prefix identifying one or more objects to which the
- rule applies.
+ rule applies. If prefix is not provided, Boto generates a default
+ prefix which will match all objects.
- :ivar status: If Enabled, the rule is currently being applied.
- If Disabled, the rule is not currently being applied.
+ :ivar status: If 'Enabled', the rule is currently being applied.
+ If 'Disabled', the rule is not currently being applied.
:ivar expiration: An instance of `Expiration`. This indicates
the lifetime of the objects that are subject to the rule.
@@ -44,7 +46,7 @@
def __init__(self, id=None, prefix=None, status=None, expiration=None,
transition=None):
self.id = id
- self.prefix = prefix
+ self.prefix = '' if prefix is None else prefix
self.status = status
if isinstance(expiration, (int, long)):
# retain backwards compatibility???
@@ -78,7 +80,8 @@
def to_xml(self):
s = '<Rule>'
- s += '<ID>%s</ID>' % self.id
+ if self.id is not None:
+ s += '<ID>%s</ID>' % self.id
s += '<Prefix>%s</Prefix>' % self.prefix
s += '<Status>%s</Status>' % self.status
if self.expiration is not None:
@@ -199,7 +202,8 @@
s += '</LifecycleConfiguration>'
return s
- def add_rule(self, id, prefix, status, expiration, transition=None):
+ def add_rule(self, id=None, prefix='', status='Enabled',
+ expiration=None, transition=None):
"""
Add a rule to this Lifecycle configuration. This only adds
the rule to the local copy. To install the new rule(s) on
@@ -208,7 +212,8 @@
:type id: str
:param id: Unique identifier for the rule. The value cannot be longer
- than 255 characters.
+ than 255 characters. This value is optional. The server will
+ generate a unique value for the rule if no value is provided.
:type prefix: str
:iparam prefix: Prefix identifying one or more objects to which the
« no previous file with comments | « third_party/boto/boto/s3/key.py ('k') | third_party/boto/boto/sdb/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698