有没有办法使用Azure存储Java API来确定存储帐户是blob存储还是通用存储
发布于 2017-05-27 03:55:35
根据Azure Storage REST API Create Storage Account(仅限版本2016-01-01及更高版本),您可以看到一个参数kind,该参数确定将在请求正文中创建哪种类型的存储帐户(Storage或BlobStorage)。
为了使用Azure Storage Java API,有一个枚举类Kind,它包含了两种存储帐户,你可以通过StorageAccount.DefinitionStages接口的两个接口(WithGeneralPurposeAccountKind和WithBlobStorageAccountKind)选择你想要的一个。
下面是它们的常用用法。
define方法创建一个默认的kind存储账号,参见完整的示例代码here。StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create();
根据define方法的源码,通过WithGeneralPurposeAccountKind.
Storage,是BlobStorage类型的存储帐号。StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withBlobStorageAccountKind() //设置种类为BlobStorage .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create();
https://stackoverflow.com/questions/44204065
复制相似问题