当前位置: 首页>>代码示例>>Python>>正文


Python Bucket.create方法代码示例

本文整理汇总了Python中gcloud.storage.bucket.Bucket.create方法的典型用法代码示例。如果您正苦于以下问题:Python Bucket.create方法的具体用法?Python Bucket.create怎么用?Python Bucket.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gcloud.storage.bucket.Bucket的用法示例。


在下文中一共展示了Bucket.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_bucket

# 需要导入模块: from gcloud.storage.bucket import Bucket [as 别名]
# 或者: from gcloud.storage.bucket.Bucket import create [as 别名]
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
开发者ID:Botanium,项目名称:gcloud-python,代码行数:37,代码来源:api.py

示例2: create_bucket

# 需要导入模块: from gcloud.storage.bucket import Bucket [as 别名]
# 或者: from gcloud.storage.bucket.Bucket import create [as 别名]
    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
开发者ID:kgruen01,项目名称:CSSI,代码行数:25,代码来源:client.py


注:本文中的gcloud.storage.bucket.Bucket.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。