/// <summary> /// The Begin Reset Virtual network Gateway operation resets an /// existing gateway. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations. /// </param> /// <param name='networkName'> /// Required. The name of the virtual network for this gateway. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Begin Reset Virtual Network /// Gateway operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static GatewayOperationResponse BeginReset(this IGatewayOperations operations, string networkName, ResetGatewayParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IGatewayOperations)s).BeginResetAsync(networkName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// The Begin Reset Virtual network Gateway operation resets an /// existing gateway. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations. /// </param> /// <param name='networkName'> /// Required. The name of the virtual network for this gateway. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Begin Reset Virtual Network /// Gateway operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<GatewayOperationResponse> BeginResetAsync(this IGatewayOperations operations, string networkName, ResetGatewayParameters parameters) { return operations.BeginResetAsync(networkName, parameters, CancellationToken.None); }
public GatewayGetOperationStatusResponse ResetVirtualNetworkGateway(string gatewayId, ResetGatewayParameters parameters) { return gatewayClient.ResetVirtualNetworkGateway(gatewayId, parameters); }
public GatewayGetOperationStatusResponse ResetGateway(string virtualNetworkSiteName, ResetGatewayParameters parameters) { return gatewayClient.Reset(virtualNetworkSiteName, parameters); }
/// <summary> /// The Begin Reset Virtual network Gateway operation resets an /// existing gateway. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations. /// </param> /// <param name='gatewayId'> /// Required. The virtual network for this gateway. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Begin Reset Virtual Network /// Gateway operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<GatewayOperationResponse> BeginResetVirtualNetworkGatewayAsync(this IGatewayOperations operations, string gatewayId, ResetGatewayParameters parameters) { return operations.BeginResetVirtualNetworkGatewayAsync(gatewayId, parameters, CancellationToken.None); }
/// <summary> /// The Begin Reset Virtual network Gateway operation resets an /// existing gateway. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations. /// </param> /// <param name='gatewayId'> /// Required. The virtual network for this gateway. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Reset Virtual Network Gateway /// operation. /// </param> /// <returns> /// The response body contains the status of the specified asynchronous /// operation, indicating whether it has succeeded, is in progress, or /// has failed. Note that this status is distinct from the HTTP status /// code returned for the Get Operation Status operation itself. If /// the asynchronous operation succeeded, the response body includes /// the HTTP status code for the successful request. If the /// asynchronous operation failed, the response body includes the HTTP /// status code for the failed request, and also includes error /// information regarding the failure. /// </returns> public static GatewayGetOperationStatusResponse ResetVirtualNetworkGateway(this IGatewayOperations operations, string gatewayId, ResetGatewayParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IGatewayOperations)s).ResetVirtualNetworkGatewayAsync(gatewayId, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
public void VirtualNetworkGatewayAPIsTests() { using (NetworkTestClient networkTestClient = new NetworkTestClient()) { string virtualNetworkSiteName = "coexistenceVirtualNetworkSiteName"; string vnetGatewayName = "coexistenceVnetGateway"; networkTestClient.EnsureNoNetworkConfigurationExists(virtualNetworkSiteName); // 1.CreateVirtualnetworkGateway API networkTestClient.SetNetworkConfiguration(NetworkTestConstants.CoexistenceFeatureNetworkConfigurationParameters); NetworkListResponse listResponse = networkTestClient.ListNetworkConfigurations(); Assert.NotNull(listResponse); Assert.True(listResponse.VirtualNetworkSites.Any(vnet => vnet.Name.Equals(virtualNetworkSiteName)), "Virtual network:" + virtualNetworkSiteName + " is not found!"); string vnetId = listResponse.First(vnet => vnet.Name.Equals(virtualNetworkSiteName)).Id; GatewayGetOperationStatusResponse response = networkTestClient.Gateways.CreateVirtualNetworkGateway( virtualNetworkSiteName, new VirtualNetworkGatewayCreateParameters() { GatewayName = vnetGatewayName, GatewayType = GatewayType.DynamicRouting }); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); // 2.Listvirtualnetworkgateways API ListVirtualNetworkGatewaysResponse listVirtualNetworkGatewaysResponse = networkTestClient.Gateways.ListVirtualNetworkGateways(); Assert.True(listVirtualNetworkGatewaysResponse.VirtualNetworkGateways.Count >= 1); string vnetGatewayId = listVirtualNetworkGatewaysResponse.VirtualNetworkGateways.First(vnetGateway => vnetGateway.GatewayName.Equals(vnetGatewayName)).GatewayId.ToString(); // 3.Getvirtualnetworkgateway API VirtualNetworkGatewayGetResponse virtualNetworkGatewayGetResponse = networkTestClient.Gateways.GetVirtualNetworkGateway(vnetGatewayId); Assert.NotNull(virtualNetworkGatewayGetResponse); Assert.Equal(HttpStatusCode.OK, virtualNetworkGatewayGetResponse.StatusCode); Assert.Equal(vnetGatewayName, virtualNetworkGatewayGetResponse.GatewayName); Assert.Equal(GatewaySKU.Default, virtualNetworkGatewayGetResponse.GatewaySKU); Assert.Equal(GatewayType.DynamicRouting, virtualNetworkGatewayGetResponse.GatewayType); // 4.ResizeVirtualnetworkGateway API ResizeGatewayParameters parameters = new ResizeGatewayParameters() { GatewaySKU = GatewaySKU.HighPerformance }; response = networkTestClient.Gateways.ResizeVirtualNetworkGateway(vnetGatewayId, parameters); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); virtualNetworkGatewayGetResponse = networkTestClient.Gateways.GetVirtualNetworkGateway(vnetGatewayId); Assert.NotNull(virtualNetworkGatewayGetResponse); Assert.Equal(HttpStatusCode.OK, virtualNetworkGatewayGetResponse.StatusCode); Assert.Equal(vnetGatewayName, virtualNetworkGatewayGetResponse.GatewayName); Assert.Equal(GatewaySKU.HighPerformance, virtualNetworkGatewayGetResponse.GatewaySKU); // 5.ResetVirtualnetworkGateway API ResetGatewayParameters resetGatewayParameters = new ResetGatewayParameters(); response = networkTestClient.Gateways.ResetVirtualNetworkGateway(vnetGatewayId, resetGatewayParameters); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); // 6.DeleteVirtualNetworkGateway API response = networkTestClient.Gateways.DeleteVirtualNetworkGateway(vnetGatewayId); Assert.NotNull(response); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); listVirtualNetworkGatewaysResponse = networkTestClient.Gateways.ListVirtualNetworkGateways(); Assert.False(listVirtualNetworkGatewaysResponse.VirtualNetworkGateways.Any(vnetGateway => vnetGateway.GatewayName.Equals(vnetGatewayName)), "Virtual network: " + virtualNetworkSiteName + " gateway: " + vnetGatewayName + " is not deleted even after DeleteVirtualNetworkGateway API call!"); } }