我对在C#应用程序中以编程方式创建存储桶时更改Google Cloud Storage存储桶区域感兴趣。方法如下:
StorageClient storageClient = StorageClient.Create();
storageClient.CreateBucket(projectId, bucketName);
但是似乎无法更改默认区域。这应该很简单,但是我找不到任何信息。
答案 0 :(得分: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}.");
}