public void DeleteNetworkMappingTest() { using (UndoContext context = UndoContext.Current) { context.Start(); var client = GetSiteRecoveryClient(CustomHttpHandler); // Get Servers var servers = client.Servers.List(RequestHeaders); // Get Network mappings var networkMappings = client.NetworkMappings.List(servers.Servers[0].ID, servers.Servers[1].ID, RequestHeaders); NetworkUnMappingInput mappingInput = new NetworkUnMappingInput(); mappingInput.PrimaryServerId = networkMappings.NetworkMappings[0].PrimaryServerId; mappingInput.PrimaryNetworkId = networkMappings.NetworkMappings[0].PrimaryNetworkId; mappingInput.RecoveryServerId = networkMappings.NetworkMappings[0].RecoveryServerId; var response = client.NetworkMappings.Delete(mappingInput, RequestHeaders); Assert.NotNull(response.Job); Assert.NotNull(response.Job.ID); Assert.True(response.Job.Errors.Count < 1, "Errors found while deleting network mapping"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }
/// <summary> /// Delete network mapping. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.SiteRecovery.INetworkMappingOperations. /// </param> /// <param name='parameters'> /// Required. Delete network mapping input. /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// The response model for the Job details object. /// </returns> public static JobResponse Delete(this INetworkMappingOperations operations, NetworkUnMappingInput parameters, CustomRequestHeaders customRequestHeaders) { return(Task.Factory.StartNew((object s) => { return ((INetworkMappingOperations)s).DeleteAsync(parameters, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Delete Azure Site Recovery Network Mapping. /// </summary> /// <param name="primaryServerId">Primary server Id</param> /// <param name="primaryNetworkId">Primary network Id</param> /// <param name="recoveryServerId">Recovery server Id</param> /// <returns>Job response</returns> public JobResponse RemoveAzureSiteRecoveryNetworkMapping( string primaryServerId, string primaryNetworkId, string recoveryServerId) { NetworkUnMappingInput networkUnMappingInput = new NetworkUnMappingInput(); networkUnMappingInput.PrimaryServerId = primaryServerId; networkUnMappingInput.PrimaryNetworkId = primaryNetworkId; networkUnMappingInput.RecoveryServerId = recoveryServerId; return(this.GetSiteRecoveryClient() .NetworkMappings .Delete(networkUnMappingInput, this.GetRequestHeaders())); }
/// <summary> /// Delete network mapping. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.SiteRecovery.INetworkMappingOperations. /// </param> /// <param name='parameters'> /// Required. Delete network mapping input. /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// The response model for the Job details object. /// </returns> public static Task <JobResponse> DeleteAsync(this INetworkMappingOperations operations, NetworkUnMappingInput parameters, CustomRequestHeaders customRequestHeaders) { return(operations.DeleteAsync(parameters, customRequestHeaders, CancellationToken.None)); }