[英]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
,该参数确定将在请求正文中创建哪种存储帐户( Storage
或BlobStorage
)。
为了使用Azure Storage Java API,有一个枚举类Kind
包括两种存储帐户,您可以通过StorageAccount.DefinitionStages
接口的两个接口( WithGeneralPurposeAccountKind
和WithBlobStorageAccountKind
)选择所需的一种。
这是它们的常用用法。
通过define
方法创建默认的种类存储帐户,请参阅此处的完整示例代码。
StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create();
根据define
方法的源代码,默认的存储帐户类型为Storage
WithGeneralPurposeAccountKind
。
创建一个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.