我有兴趣在以编程方式在C#应用程序中创建存储桶时更改Google云存储存储区域。这是方法:
StorageClient storageClient = StorageClient.Create();
storageClient.CreateBucket(projectId, bucketName);
但似乎没有办法改变默认区域。这应该是一件非常简单的事情,但我找不到任何相关信息。
来自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}.");
}