在 C# 应用程序中创建时更改默认 Google Cloud Storage 存储桶区域
Change default Google Cloud Storage bucket region when creating it in C# application
我有兴趣在 C# 应用程序中以编程方式创建存储桶时更改 Google Cloud Storage 存储桶区域。方法如下:
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}.");
}
我有兴趣在 C# 应用程序中以编程方式创建存储桶时更改 Google Cloud Storage 存储桶区域。方法如下:
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}.");
}