Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(storage): add documentation for blob and bucket name property #89

Merged
merged 8 commits into from
Apr 16, 2020
5 changes: 5 additions & 0 deletions google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,17 @@ def __init__(
kms_key_name=None,
generation=None,
):
"""
property :attr:`name`
Get the blob's name.
"""
name = _bytes_to_unicode(name)
super(Blob, self).__init__(name=name)

self.chunk_size = chunk_size # Check that setter accepts value.
self._bucket = bucket
self._acl = ObjectACL(self)
self._name = name
if encryption_key is not None and kms_key_name is not None:
raise ValueError(
"Pass at most one of 'encryption_key' " "and 'kms_key_name'"
Expand Down
5 changes: 5 additions & 0 deletions google/cloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,18 @@ class Bucket(_PropertyMixin):
"""Allowed values for :attr:`location_type`."""

def __init__(self, client, name=None, user_project=None):
"""
property :attr:`name`
Get the bucket's name.
"""
name = _validate_name(name)
super(Bucket, self).__init__(name=name)
self._client = client
self._acl = BucketACL(self)
self._default_object_acl = DefaultObjectACL(self)
self._label_removals = set()
self._user_project = user_project
self._name = name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still necessary?


def __repr__(self):
return "<Bucket: %s>" % (self.name,)
Expand Down