Skip to content

Commit

Permalink
Document '{Bucket,Blob}._STORAGE_CLASSES'.
Browse files Browse the repository at this point in the history
Re-order to match canonical order in docs.

Add docstrings with links to relevant docs.

Explain why the two lists differ.
  • Loading branch information
tseaver committed Feb 24, 2017
1 parent f1a03ea commit c34cd86
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
22 changes: 21 additions & 1 deletion storage/google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,27 @@ class Blob(_PropertyMixin):
"""Number (256 KB, in bytes) that must divide the chunk size."""

_STORAGE_CLASSES = (
'STANDARD', 'NEARLINE', 'MULTI_REGIONAL', 'REGIONAL', 'COLDLINE')
'NEARLINE',
'MULTI_REGIONAL',
'REGIONAL',
'COLDLINE',
'STANDARD', # alias for MULTI_REGIONAL/REGIONAL, based on location
)
"""Allowed values for :attr:`storage_class`.
See:
https://cloud.google.com/storage/docs/json_api/v1/objects#storageClass
https://cloud.google.com/storage/docs/per-object-storage-class
.. note::
This list does not include 'DURABLE_REDUCED_AVAILABILITY', which
is only documented for buckets (and deprectated.
.. note::
The documentation does *not* mention 'STANDARD', but it is the value
assigned by the back-end for objects created in buckets with 'STANDARD'
set as their 'storage_class'.
"""

def __init__(self, name, bucket, chunk_size=None, encryption_key=None):
super(Blob, self).__init__(name=name)
Expand Down
16 changes: 14 additions & 2 deletions storage/google/cloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,20 @@ class Bucket(_PropertyMixin):
This is used in Bucket.delete() and Bucket.make_public().
"""

_STORAGE_CLASSES = ('STANDARD', 'NEARLINE', 'DURABLE_REDUCED_AVAILABILITY',
'MULTI_REGIONAL', 'REGIONAL', 'COLDLINE')
_STORAGE_CLASSES = (
'MULTI_REGIONAL',
'REGIONAL',
'NEARLINE',
'COLDLINE'
'STANDARD', # alias for MULTI_REGIONAL/REGIONAL, based on location
'DURABLE_REDUCED_AVAILABILITY', # deprecated
)
"""Allowed values for :attr:`storage_class`.
See:
https://cloud.google.com/storage/docs/json_api/v1/buckets#storageClass
https://cloud.google.com/storage/docs/storage-classes
"""

def __init__(self, client, name=None):
super(Bucket, self).__init__(name=name)
Expand Down

0 comments on commit c34cd86

Please sign in to comment.