def create_bucket(bucket_name, project=None, connection=None): """Create a new bucket. For example:: >>> from gcloud import storage >>> storage.set_defaults() >>> bucket = storage.create_bucket('my-bucket') >>> print bucket <Bucket: my-bucket> This implements "storage.buckets.insert". If the bucket already exists, will raise :class:`gcloud.exceptions.Conflict`. :type project: string :param project: Optional. The project to use when creating bucket. If not provided, falls back to default. :type bucket_name: string :param bucket_name: The bucket name to create. :type connection: :class:`gcloud.storage.connection.Connection` or ``NoneType`` :param connection: Optional. The connection to use when sending requests. If not provided, falls back to default. :rtype: :class:`gcloud.storage.bucket.Bucket` :returns: The newly created bucket. """ connection = _require_connection(connection) bucket = Bucket(bucket_name, connection=connection) bucket.create(project) return bucket
def create_bucket(bucket_name, project=None, connection=None): """Create a new bucket. For example:: >>> from gcloud import storage >>> bucket = storage.create_bucket('my-bucket') >>> print bucket <Bucket: my-bucket> This implements "storage.buckets.insert". If the bucket already exists, will raise :class:`gcloud.exceptions.Conflict`. :type project: string :param project: Optional. The project to use when creating bucket. If not provided, falls back to default. :type bucket_name: string :param bucket_name: The bucket name to create. :type connection: :class:`gcloud.storage.connection.Connection` or ``NoneType`` :param connection: Optional. The connection to use when sending requests. If not provided, falls back to default. :rtype: :class:`gcloud.storage.bucket.Bucket` :returns: The newly created bucket. """ connection = _require_connection(connection) bucket = Bucket(bucket_name, connection=connection) bucket.create(project, connection=connection) return bucket
def create_bucket(self, bucket_name): """Create a new bucket. For example:: >>> bucket = client.create_bucket('my-bucket') >>> print bucket <Bucket: my-bucket> This implements "storage.buckets.insert". If the bucket already exists, will raise :class:`gcloud.exceptions.Conflict`. :type bucket_name: string :param bucket_name: The bucket name to create. :rtype: :class:`gcloud.storage.bucket.Bucket` :returns: The newly created bucket. """ bucket = Bucket(self, name=bucket_name) bucket.create(client=self) return bucket
def create_bucket(self, bucket_name): """Create a new bucket. For example:: >>> bucket = client.create_bucket('my-bucket') >>> print bucket <Bucket: my-bucket> This implements "storage.buckets.insert". If the bucket already exists, will raise :class:`gcloud.exceptions.Conflict`. :type bucket_name: string :param bucket_name: The bucket name to create. :rtype: :class:`gcloud.storage.bucket.Bucket` :returns: The newly created bucket. """ bucket = Bucket(self, name=bucket_name) bucket.create(client=self) return bucket