繁体   English   中英

Azure:使用存储API查找存储是通用存储还是Blob存储

[英]Azure: find if storage is general purpose or blob storage using storage API

是否可以使用Azure存储Java API确定存储帐户是Blob存储还是通用存储

根据Azure存储REST API Create Storage Account (仅适用于2016-01-01版及更高版本),您可以看到一个参数kind ,该参数确定将在请求正文中创建哪种存储帐户( StorageBlobStorage )。

为了使用Azure Storage Java API,有一个枚举类Kind包括两种存储帐户,您可以通过StorageAccount.DefinitionStages接口的两个接口( WithGeneralPurposeAccountKindWithBlobStorageAccountKind )选择所需的一种。

这是它们的常用用法。

  1. 通过define方法创建默认的种类存储帐户,请参阅此处的完整示例代码。

     StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create(); 

    根据define方法的源代码,默认的存储帐户类型为Storage WithGeneralPurposeAccountKind

  2. 创建一个BlobStorage类型的存储帐户。

     StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withBlobStorageAccountKind() // Set the kind as `BlobStorage` .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create(); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM