public void EnableAzureBackupProtectionTest() { using (UndoContext context = UndoContext.Current) { context.Start(); string resourceNamespace = ConfigurationManager.AppSettings["ResourceNamespace"]; var client = GetServiceClient<RecoveryServicesBackupManagementClient>(resourceNamespace); ProtectedItemCreateOrUpdateRequest input = new ProtectedItemCreateOrUpdateRequest(); AzureIaaSClassicComputeVMProtectedItem iaasVmProtectedItem = new AzureIaaSClassicComputeVMProtectedItem(); iaasVmProtectedItem.PolicyId = ConfigurationManager.AppSettings["RsVaultIaasVMDefaultPolicyId"]; ProtectedItemResource protectedItemResource = new ProtectedItemResource(); protectedItemResource.Properties = iaasVmProtectedItem; input.Item = protectedItemResource; string itemUniqueName = ConfigurationManager.AppSettings["RsVaultIaasV1ContainerUniqueName"]; string containerUniqueName = ConfigurationManager.AppSettings["RsVaultIaasV1ContainerUniqueName"]; string containeType = ConfigurationManager.AppSettings["IaaSVMContainerType"]; string itemType = ConfigurationManager.AppSettings["IaaSVMItemType"]; string containerName = containeType + ";" + containerUniqueName; string itemName = itemType + ";" + itemUniqueName; string fabricName = ConfigurationManager.AppSettings["AzureBackupFabricName"]; string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectedItemTestHelper protectedItemTestHelper = new ProtectedItemTestHelper(client); var response = protectedItemTestHelper.AddOrUpdateProtectedItem(fabricName, containerName, itemName, input); } }
public void ListProtectedItemsTest() { using (UndoContext context = UndoContext.Current) { context.Start(); string resourceNamespace = ConfigurationManager.AppSettings["ResourceNamespace"]; var client = GetServiceClient<RecoveryServicesBackupManagementClient>(resourceNamespace); ProtectedItemListQueryParam queryParams = new ProtectedItemListQueryParam(); queryParams.BackupManagementType = CommonTestHelper.GetSetting(TestConstants.ProviderTypeAzureIaasVM); queryParams.DatasourceType = CommonTestHelper.GetSetting(TestConstants.WorkloadTypeVM); ProtectedItemTestHelper itemTestHelper = new ProtectedItemTestHelper(client); var response = itemTestHelper.ListProtectedItems(queryParams); string itemName = ConfigurationManager.AppSettings["RsVaultIaasV1ContainerUniqueName"]; Assert.True(response.ItemList.Value.Any(item => { return item.Properties.GetType().IsSubclassOf(typeof(AzureIaaSVMProtectedItem)) && item.Name.Contains(itemName); }), "Retrieved list of items doesn't contain AzureIaaSVMProtectedItem test item"); } }
public void RemoveAzureBackupProtectionTest() { using (UndoContext context = UndoContext.Current) { context.Start(); string resourceNamespace = ConfigurationManager.AppSettings["ResourceNamespace"]; var client = GetServiceClient<RecoveryServicesBackupManagementClient>(resourceNamespace); string itemUniqueName = ConfigurationManager.AppSettings["RsVaultIaasV1ContainerUniqueName"]; string containerUniqueName = ConfigurationManager.AppSettings["RsVaultIaasV1ContainerUniqueName"]; string containeType = ConfigurationManager.AppSettings["IaaSVMContainerType"]; string itemType = ConfigurationManager.AppSettings["IaaSVMItemType"]; string containerName = containeType + ";" + containerUniqueName; string itemName = itemType + ";" + itemUniqueName; string fabricName = ConfigurationManager.AppSettings["AzureBackupFabricName"]; string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectedItemTestHelper protectedItemTestHelper = new ProtectedItemTestHelper(client); var response = protectedItemTestHelper.DeleteProtectedItem(fabricName, containerName, itemName); } }