From 8f3a7f4b0a9a88c76ab8b39fa650e4ab368aaa61 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 5 Jun 2017 16:10:16 -0400 Subject: [PATCH 1/2] Expose that settable properties are so. Closes #2610. --- storage/google/cloud/storage/bucket.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/storage/google/cloud/storage/bucket.py b/storage/google/cloud/storage/bucket.py index 506d1ce6e26d..f1c5be1abd8d 100644 --- a/storage/google/cloud/storage/bucket.py +++ b/storage/google/cloud/storage/bucket.py @@ -578,11 +578,14 @@ def id(self): @property def lifecycle_rules(self): - """Lifecycle rules configured for this bucket. + """Retrieve or set lifecycle rules configured for this bucket. See https://cloud.google.com/storage/docs/lifecycle and https://cloud.google.com/storage/docs/json_api/v1/buckets + :setter: Set lifestyle rules for this bucket. + :getter: Gets the lifestyle rules for this bucket. + :rtype: list(dict) :returns: A sequence of mappings describing each lifecycle rule. """ @@ -591,6 +594,14 @@ def lifecycle_rules(self): @lifecycle_rules.setter def lifecycle_rules(self, rules): + """Set lifestyle rules configured for this bucket. + + See https://cloud.google.com/storage/docs/lifecycle and + https://cloud.google.com/storage/docs/json_api/v1/buckets + + :type entries: list of dictionaries + :param entries: A sequence of mappings describing each CORS policy. + """ self._patch_property('lifecycle', {'rule': rules}) location = _scalar_property('location') @@ -691,10 +702,13 @@ def self_link(self): @property def storage_class(self): - """Retrieve the storage class for the bucket. + """Retrieve or set the storage class for the bucket. See https://cloud.google.com/storage/docs/storage-classes + :setter: Set the storage class for this bucket. + :getter: Gets the the storage class for this bucket. + :rtype: str or ``NoneType`` :returns: If set, one of "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", "STANDARD", or @@ -737,6 +751,9 @@ def versioning_enabled(self): See https://cloud.google.com/storage/docs/object-versioning for details. + :setter: Update whether versioning is enabled for this bucket. + :getter: Query whether versioning is enabled for this bucket. + :rtype: bool :returns: True if enabled, else False. """ From 840dfd2bd35e353f32b79083909b7abdfda0c339 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 7 Jun 2017 13:32:04 -0400 Subject: [PATCH 2/2] Fix docstring copy-pasta. [ci skip] --- storage/google/cloud/storage/bucket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/google/cloud/storage/bucket.py b/storage/google/cloud/storage/bucket.py index f1c5be1abd8d..940715f72070 100644 --- a/storage/google/cloud/storage/bucket.py +++ b/storage/google/cloud/storage/bucket.py @@ -600,7 +600,7 @@ def lifecycle_rules(self, rules): https://cloud.google.com/storage/docs/json_api/v1/buckets :type entries: list of dictionaries - :param entries: A sequence of mappings describing each CORS policy. + :param entries: A sequence of mappings describing each lifecycle rule. """ self._patch_property('lifecycle', {'rule': rules})