/** * Parses a serialized value to a Kind instance. * * @param value the serialized value to parse. * @return the parsed Kind object, or null if unable to parse. */ @JsonCreator public static Kind fromString(String value) { Kind[] items = Kind.values(); for (Kind item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; }
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(); }
/** * Parses a serialized value to a Kind instance. * * @param value the serialized value to parse. * @return the parsed Kind object, or null if unable to parse. */ @JsonCreator public static Kind fromString(String value) { Kind[] items = Kind.values(); for (Kind item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; }