Skip to content

Commit

Permalink
docs(storage): add documentation for blob and bucket name property
Browse files Browse the repository at this point in the history
  • Loading branch information
HemangChothani committed Mar 30, 2020
1 parent a50cdd1 commit 4fe3494
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def __init__(
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 All @@ -193,6 +194,24 @@ def __init__(
if generation is not None:
self._properties["generation"] = generation

@property
def name(self):
""" Get the blob's name.
:rtype: str
:returns: The name for the blob object.
"""
return self._name

@name.setter
def name(self, value):
"""Set the blob's name.
:type value: str
:param value: The blob name to set.
"""
self._name = value

@property
def bucket(self):
"""Bucket which contains the object.
Expand Down
19 changes: 19 additions & 0 deletions google/cloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,29 @@ def __init__(self, client, name=None, user_project=None):
self._default_object_acl = DefaultObjectACL(self)
self._label_removals = set()
self._user_project = user_project
self._name = name

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

@property
def name(self):
""" Get the bucket's name.
:rtype: str
:returns: The name for the bucket object.
"""
return self._name

@name.setter
def name(self, value):
"""Set the bucket's name.
:type value: str
:param value: The bucket name to set.
"""
self._name = value

@property
def client(self):
"""The client bound to this bucket."""
Expand Down

0 comments on commit 4fe3494

Please sign in to comment.