public String getStorageAccountType() { return StringUtils.isBlank(storageAccountType) ? SkuName.STANDARD_LRS.toString() : storageAccountType; }
/** * Parses a serialized value to a SkuName instance. * * @param value the serialized value to parse. * @return the parsed SkuName object, or null if unable to parse. */ @JsonCreator public static SkuName fromString(String value) { SkuName[] items = SkuName.values(); for (SkuName item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; }
.withRegion(location) .withExistingResourceGroup(resourceGroupName) .withSku(SkuName.fromString(targetStorageAccountType)) .create();
public static List<String> getAvailableStorageAccounts(Azure azureClient, String vmImageSizeType) { List<String> result = new ArrayList<>(); if (azureClient != null) { for (StorageAccount storageAccount : azureClient.storageAccounts().list()) { if (vmImageSizeType != null) { if (storageAccount.sku().name().name().toLowerCase().equals(vmImageSizeType.toLowerCase())) { result.add(storageAccount.name()); } } else { result.add(storageAccount.name()); } } } return result; }
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); } switch (kind) { case STORAGE: newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKind(); break; case STORAGE_V2: newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKindV2(); break; case BLOB_STORAGE: newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobStorageAccountKind().withAccessTier(accessTier); break; default: throw new Exception("Unknown Storage Account Kind:" + kind.toString()); } if (enableEncription) { newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobEncryption(); } return newStorageAccountWithGroup.withSku(StorageAccountSkuType.fromSkuName(SkuName.fromString(skuName))).create(); }
public static List<AzureDockerStorageAccount> getStorageAccounts(Azure azureClient) { List<AzureDockerStorageAccount> result = new ArrayList<>(); if (azureClient != null) { for (StorageAccount storageAccount : azureClient.storageAccounts().list()) { AzureDockerStorageAccount dockerStorageAccount = new AzureDockerStorageAccount(); dockerStorageAccount.name = storageAccount.name(); dockerStorageAccount.region = storageAccount.regionName(); dockerStorageAccount.resourceGroup = storageAccount.resourceGroupName(); dockerStorageAccount.sid = azureClient.subscriptionId(); dockerStorageAccount.skuType = storageAccount.sku().name().name(); result.add(dockerStorageAccount); } } return result; }
public ListBoxModel doFillStorageAccountTypeItems( @QueryParameter String virtualMachineSize) throws IOException, ServletException { ListBoxModel model = new ListBoxModel(); model.add("--- Select Storage Account Type ---", ""); model.add(SkuName.STANDARD_LRS.toString()); /*As introduced in Azure Docs, the size contains 'S' supports premium storage*/ if (virtualMachineSize.matches(".*_[a-zA-Z]([0-9]+[Mm]?[Ss]|[Ss][0-9]+).*")) { model.add(SkuName.PREMIUM_LRS.toString()); } return model; }
/** * Parses a serialized value to a SkuName instance. * * @param value the serialized value to parse. * @return the parsed SkuName object, or null if unable to parse. */ @JsonCreator public static SkuName fromString(String value) { SkuName[] items = SkuName.values(); for (SkuName item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; }
newAccount.withGeneralPurposeAccountKind().withSku(SkuName.fromString(newStorageAccount.getType())); withCreate = withCreate.withNewStorageAccount(newAccount); } else {
storageAccountType = SkuName.STANDARD_LRS.toString();
azureClient.storageAccounts().listByResourceGroup(resourceGroupName); for (StorageAccount storageAccount : storageAccountList) { if (storageAccount.sku().name().toString().equalsIgnoreCase(storageAccountType)) { model.add(storageAccount.name());