def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.storage.exceptions.NotFound`. For example:: >>> try: >>> bucket = client.get_bucket('my-bucket') >>> except google.cloud.exceptions.NotFound: >>> print('Sorry, that bucket does not exist!') This implements "storage.buckets.get". :type bucket_name: string :param bucket_name: The name of the bucket to get. :rtype: :class:`google.cloud.storage.bucket.Bucket` :returns: The bucket matching the name provided. :raises: :class:`google.cloud.exceptions.NotFound` """ bucket = Bucket(self, name=bucket_name) bucket.reload(client=self) return bucket
def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.storage.exceptions.NotFound`. For example:: >>> try: >>> bucket = client.get_bucket('my-bucket') >>> except google.cloud.exceptions.NotFound: >>> print('Sorry, that bucket does not exist!') This implements "storage.buckets.get". :type bucket_name: str :param bucket_name: The name of the bucket to get. :rtype: :class:`google.cloud.storage.bucket.Bucket` :returns: The bucket matching the name provided. :raises: :class:`google.cloud.exceptions.NotFound` """ bucket = Bucket(self, name=bucket_name) bucket.reload(client=self) return bucket
def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.exceptions.NotFound`. For example: .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucket] This implements "storage.buckets.get". :type bucket_name: str :param bucket_name: The name of the bucket to get. :rtype: :class:`google.cloud.storage.bucket.Bucket` :returns: The bucket matching the name provided. :raises: :class:`google.cloud.exceptions.NotFound` """ bucket = Bucket(self, name=bucket_name) bucket.reload(client=self) return bucket
def get_bucket(self, bucket_or_name): """API call: retrieve a bucket via a GET request. See https://cloud.google.com/storage/docs/json_api/v1/buckets/get Args: bucket_or_name (Union[ \ :class:`~google.cloud.storage.bucket.Bucket`, \ str, \ ]): The bucket resource to pass or name to create. Returns: google.cloud.storage.bucket.Bucket The bucket matching the name provided. Raises: google.cloud.exceptions.NotFound If the bucket is not found. Examples: Retrieve a bucket using a string. .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucket] Get a bucket using a resource. >>> from google.cloud import storage >>> client = storage.Client() >>> # Set properties on a plain resource object. >>> bucket = client.get_bucket("my-bucket-name") >>> # Time passes. Another program may have modified the bucket ... # in the meantime, so you want to get the latest state. >>> bucket = client.get_bucket(bucket) # API request. """ bucket = None if isinstance(bucket_or_name, Bucket): bucket = bucket_or_name else: bucket = Bucket(self, name=bucket_or_name) bucket.reload(client=self) return bucket
def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.storage.exceptions.NotFound`. For example: .. literalinclude:: storage_snippets.py :start-after: [START get_bucket] :end-before: [END get_bucket] This implements "storage.buckets.get". :type bucket_name: str :param bucket_name: The name of the bucket to get. :rtype: :class:`google.cloud.storage.bucket.Bucket` :returns: The bucket matching the name provided. :raises: :class:`google.cloud.exceptions.NotFound` """ bucket = Bucket(self, name=bucket_name) bucket.reload(client=self) return bucket