在C#应用程序中创建默认Google Cloud Storage存储区域时,请更改此区域

问题描述 投票:0回答:1

我有兴趣在以编程方式在C#应用程序中创建存储桶时更改Google云存储存储区域。这是方法:

StorageClient storageClient = StorageClient.Create();        
storageClient.CreateBucket(projectId, bucketName);

但似乎没有办法改变默认区域。这应该是一件非常简单的事情,但我找不到任何相关信息。

c# google-cloud-platform google-cloud-storage bucket
1个回答
1
投票

来自official Google Cloud Storage sample

    private void CreateRegionalBucket(string location, string bucketName)
    {
        var storage = StorageClient.Create();
        Bucket bucket = new Bucket { Location = location, Name = bucketName };
        storage.CreateBucket(s_projectId, bucket);
        Console.WriteLine($"Created {bucketName}.");
    }
© www.soinside.com 2019 - 2024. All rights reserved.