public void BackupProtectedItem() { string rsVaultRgName = "pstestrg"; string rsVaultName = "pstestrsvault"; string fabricName = CommonTestHelper.GetSetting(TestConstants.ProviderTypeAzureIaasVM); string containerName = "IaasVMContainer;iaasvmcontainerv2;pstestrg;pstestv2vm1"; string protectedItemName = "VM;iaasvmcontainerv2;pstestrg;pstestv2vm1"; var response = Client.Backups.TriggerBackup(rsVaultRgName, rsVaultName, CommonTestHelper.GetCustomRequestHeaders(), fabricName, containerName, protectedItemName); Assert.NotNull(response); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); Assert.NotNull(response.Location); Assert.NotNull(response.AzureAsyncOperation); Assert.NotNull(response.RetryAfter); var operationResponse = Client.ProtectedItems.GetProtectedItemOperationResultByURLAsync(response.Location, CommonTestHelper.GetCustomRequestHeaders()); while (operationResponse.Result.StatusCode == HttpStatusCode.Accepted) { if (HttpMockServer.Mode == HttpRecorderMode.Record) { System.Threading.Thread.Sleep(5 * 1000); } operationResponse = Client.ProtectedItems.GetProtectedItemOperationResultByURLAsync(response.Location, CommonTestHelper.GetCustomRequestHeaders()); } var operationStatusResponse = Client.GetOperationStatusByURLAsync(response.AzureAsyncOperation, CommonTestHelper.GetCustomRequestHeaders()); var operationJobResponse = (OperationStatusJobExtendedInfo)operationStatusResponse.Result.OperationStatus.Properties; Assert.NotNull(operationJobResponse.JobId); }
public ProtectionPolicyResponse AddOrUpdateProtectionPolicy( string policyName, ProtectionPolicyRequest request) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectionPolicyResponse response = Client.ProtectionPolicies.CreateOrUpdateAsync(rsVaultRgName, rsVaultName, policyName, request, CommonTestHelper.GetCustomRequestHeaders()).Result; Assert.NotNull(response); if (response.StatusCode == HttpStatusCode.OK) { Assert.Null(response.Location); Assert.Null(response.AzureAsyncOperation); Assert.Null(response.RetryAfter); Assert.NotNull(response.Item); Assert.NotNull(response.Item.Id); Assert.NotNull(response.Item.Name); Assert.NotNull(response.Item.Type); } else { Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); Assert.NotNull(response.Location); Assert.NotNull(response.AzureAsyncOperation); Assert.NotNull(response.RetryAfter); } return(response); }
public BaseRecoveryServicesJobResponse DeleteProtectedItem(string fabricName, string containerName, string protectedItemName) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); var customHeader = CommonTestHelper.GetCustomRequestHeaders(); BaseRecoveryServicesJobResponse response = Client.ProtectedItems.DeleteProtectedItem(rsVaultRgName, rsVaultName, fabricName, containerName, protectedItemName, customHeader); Assert.NotNull(response); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); Assert.NotNull(response.Location); Assert.NotNull(response.AzureAsyncOperation); Assert.NotNull(response.RetryAfter); var operationStatusResponse = Client.GetOperationStatusByURLAsync(response.AzureAsyncOperation, customHeader); while (operationStatusResponse.Result.OperationStatus.Status == OperationStatusValues.InProgress) { if (HttpMockServer.Mode == HttpRecorderMode.Record) { System.Threading.Thread.Sleep(5 * 1000); } operationStatusResponse = Client.GetOperationStatusByURLAsync(response.AzureAsyncOperation, customHeader); } operationStatusResponse = Client.GetOperationStatusByURLAsync(response.AzureAsyncOperation, CommonTestHelper.GetCustomRequestHeaders()); var operationJobResponse = (OperationStatusJobExtendedInfo)operationStatusResponse.Result.OperationStatus.Properties; Assert.NotNull(operationJobResponse.JobId); Assert.Equal(OperationStatusValues.Succeeded, operationStatusResponse.Result.OperationStatus.Status); return(response); }
public AzureOperationResponse UnregisterContainer(string containerName) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); AzureOperationResponse response = Client.Containers.Unregister(rsVaultRgName, rsVaultName, containerName, CommonTestHelper.GetCustomRequestHeaders()); Assert.NotNull(response); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); return(response); }
public AzureOperationResponse DeleteProtectionPolicy(string policyName) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); AzureOperationResponse response = Client.ProtectionPolicies.DeleteAsync(rsVaultRgName, rsVaultName, policyName, CommonTestHelper.GetCustomRequestHeaders()).Result; Assert.NotNull(response); return(response); }
public ProtectionContainerListResponse ListMABContainers(ProtectionContainerListQueryParams queryParams) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectionContainerListResponse response = Client.Containers.List(rsVaultRgName, rsVaultName, queryParams, CommonTestHelper.GetCustomRequestHeaders()); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.NotNull(response.ItemList); return(response); }
public ProtectionPolicyListResponse ListProtectionPolicy(ProtectionPolicyQueryParameters queryParams) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectionPolicyListResponse response = Client.ProtectionPolicies.ListAsync(rsVaultRgName, rsVaultName, queryParams, CommonTestHelper.GetCustomRequestHeaders()).Result; Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.StatusCode); return(response); }
public BackupEngineListResponse ListBackupEngine(BackupEngineListQueryParams queryParams, PaginationRequest paginationParam) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); BackupEngineListResponse response = Client.BackupEngines.List(rsVaultRgName, rsVaultName, queryParams, paginationParam, CommonTestHelper.GetCustomRequestHeaders()); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.NotNull(response.ItemList); return(response); }
public ProtectableObjectListResponse ListProtectableObjects(ProtectableObjectListQueryParameters queryParams, PaginationRequest paginationParams) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectableObjectListResponse response = Client.ProtectableObjects.List(rsVaultRgName, rsVaultName, queryParams, paginationParams, CommonTestHelper.GetCustomRequestHeaders()); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.NotNull(response.ItemList); return(response); }
public ProtectionPolicyResponse GetProtectionPolicy(string policyName) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); ProtectionPolicyResponse response = Client.ProtectionPolicies.GetAsync(rsVaultRgName, rsVaultName, policyName, CommonTestHelper.GetCustomRequestHeaders()).Result; Assert.NotNull(response); Assert.Null(response.Location); Assert.Null(response.AzureAsyncOperation); Assert.Null(response.RetryAfter); Assert.Equal(response.Item.Name, policyName); Assert.Equal(HttpStatusCode.OK, response.StatusCode); return(response); }
public BaseRecoveryServicesJobResponse RefreshContainer(string fabricName) { string rsVaultRgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); string rsVaultName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); BaseRecoveryServicesJobResponse response = Client.Containers.BeginRefresh(rsVaultRgName, rsVaultName, CommonTestHelper.GetCustomRequestHeaders(), fabricName); Assert.NotNull(response); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); while (response.StatusCode == HttpStatusCode.Accepted) { response = Client.Containers.GetRefreshOperationResultByURL(response.Location); if (HttpMockServer.Mode == HttpRecorderMode.Record) { System.Threading.Thread.Sleep(5 * 1000); } } Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); return(response); }
public JobTestHelper(RecoveryServicesBackupManagementClient client) { this.rgName = CommonTestHelper.GetSetting(TestConstants.RsVaultRgName); this.rName = CommonTestHelper.GetSetting(TestConstants.RsVaultName); this.Client = client; }