How can i create bucket on Firebase Cloud Storage

邮差的信 提交于 2021-01-28 05:55:21

问题


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.

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


回答1:


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")



来源:https://stackoverflow.com/questions/64968685/how-can-i-create-bucket-on-firebase-cloud-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!