有没有办法使用golang azure blob存储SDK来检索区域信息?

huangapple go评论105阅读模式
英文:

Is there a way to retrieve region information using golang azure blob storage sdk?

问题

有没有任何 API 或其他方法可以在 Golang 中获取 Azure Blob 存储的容器区域信息?我们有服务和容器的 URL。

英文:

Is there any API or other way to get container region information for azure blob storage in golang?
We have service, container URL.

答案1

得分: 1

Azure存储帐户有一个REST API。

由于Blob容器的区域与存储帐户的区域相同,您可以使用Azure存储REST API来获取Blob存储的区域。

您可以使用以下API调用来获取存储帐户属性:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-04-01

如果您想要获取存储帐户的特定属性,比如位置,您可以使用扩展属性:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-04-01&$expand={$expand}

参考资料
存储帐户 - 获取属性 - REST API(Azure存储资源提供程序)| Microsoft Docs

Golang REST API参考
Golang REST API - 入门 - GoLang Docs

英文:

There is REST API for Azure Storage Account.

As the blob containers region is same as the Storage Account region, you can use the Azure Storage REST API to fetch the region of the blob storage.

You can use below API call to fetch the storage account properties :

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-04-01

If you want a specific property of a Storage Account like location, you can use expand property :

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-04-01&$expand={$expand}

Reference :
Storage Accounts - Get Properties - REST API (Azure Storage Resource Provider) | Microsoft Docs

Golang REST API reference :
Golang REST API - Getting Started - GoLang Docs

huangapple
  • 本文由 发表于 2021年9月16日 17:00:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/69205382.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定