是否可以使用Azure存储Java API确定存储帐户是Blob存储还是通用存储
According to the Azure Storage REST API Create Storage Account
(only version 2016-01-01 and later), you can see a parameter kind
which determine what kind of storage account ( Storage
or BlobStorage
) will be created in the request body.
For using Azure Storage Java API, there is an enum class Kind
which includes the two kinds of storage account, you can select the one of you want via two interfaces ( WithGeneralPurposeAccountKind
and WithBlobStorageAccountKind
) of StorageAccount.DefinitionStages
interface.
Here are the usual usages of them.
Create a default kind storage account via define
method, see the completed sample code here .
StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create();
According to the source code of define
method, the default kind of storage account is Storage
via WithGeneralPurposeAccountKind
.
Create a storage account of BlobStorage
kind.
StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName) .withBlobStorageAccountKind() // Set the kind as `BlobStorage` .withRegion(Region.US_EAST) .withNewResourceGroup(rgName) .create();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.