Search in sources :

Example 1 with Encryption

use of com.microsoft.azure.management.storage.Encryption in project azure-tools-for-java by Microsoft.

the class AzureSDKManager method createStorageAccount.

public static StorageAccount createStorageAccount(String subscriptionId, String name, String region, boolean newResourceGroup, String resourceGroup, Kind kind, AccessTier accessTier, boolean enableEncription, String skuName) throws Exception {
    AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
    Azure azure = azureManager.getAzure(subscriptionId);
    StorageAccount.DefinitionStages.WithGroup newStorageAccountBlank = azure.storageAccounts().define(name).withRegion(region);
    StorageAccount.DefinitionStages.WithCreate newStorageAccountWithGroup;
    if (newResourceGroup) {
        newStorageAccountWithGroup = newStorageAccountBlank.withNewResourceGroup(resourceGroup);
    } else {
        newStorageAccountWithGroup = newStorageAccountBlank.withExistingResourceGroup(resourceGroup);
    }
    if (kind == Kind.BLOB_STORAGE) {
        newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobStorageAccountKind().withAccessTier(accessTier);
    } else {
        newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKind();
    }
    if (enableEncription) {
        newStorageAccountWithGroup = newStorageAccountWithGroup.withEncryption(new Encryption());
    }
    return newStorageAccountWithGroup.withSku(SkuName.fromString(skuName)).create();
}
Also used : Azure(com.microsoft.azure.management.Azure) AzureManager(com.microsoft.azuretools.sdkmanage.AzureManager) Encryption(com.microsoft.azure.management.storage.Encryption)

Aggregations

Azure (com.microsoft.azure.management.Azure)1 Encryption (com.microsoft.azure.management.storage.Encryption)1 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)1