如何在Firebase Cloud Storage上创建存储桶 [英] How can i create bucket on Firebase Cloud Storage

查看:79
本文介绍了如何在Firebase Cloud Storage上创建存储桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名python开发人员.我们使用GCS(谷歌云存储)来存储我们过去几个月的图像,这很好,但对于android系统,则需要将所有存储桶导入到Firebase Cloud Storage(FCS)中进行访问.我们不希望任何手动集成.我们听说,如果我们在FCS上创建一个存储桶,该存储桶会自动反映在GCS上,那么这很好,不需要导入.

I'm a python developer.we use GCS (Google cloud storage) to store our images for past we months which is good but for android it requires to import all the buckets to Firebase Cloud Storage(FCS) for accessing it. We dont want any manual integration. we heard that if we create a bucket on FCS which automatically reflect on GCS which is good and there is no import required.

我们尝试直接在Firebase云存储上创建存储桶.我可以通过编程方式知道这可能吗?

We trying to create bucket directly on firebase cloud storage. may i know is that posstible by programmtically?

推荐答案

您可以按照 API文档.产品文档中也有信息.:

You can use the create_bucket function as described in the API documentation. There is also information in the product documentation:

from google.cloud import storage


def create_bucket_class_location(bucket_name):
    """Create a new bucket in specific location with storage class"""
    # bucket_name = "your-new-bucket-name"

    storage_client = storage.Client()

    bucket = storage_client.bucket(bucket_name)
    bucket.storage_class = "COLDLINE"
    new_bucket = storage_client.create_bucket(bucket, location="us")

这篇关于如何在Firebase Cloud Storage上创建存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆