public void Undo()
 {
     GatewaySetIPsecParametersParameters oldParameters = new GatewaySetIPsecParametersParameters()
     {
         Parameters = oldIPsecParameters.IPsecParameters,
     };
     gatewayClient.SetIPsecParameters(virtualNetworkSiteName, localNetworkSiteName, oldParameters);
 }
        public SetIPsecParameters(IGatewayOperations gatewayClient, string virtualNetworkSiteName, string localNetworkSiteName, GatewaySetIPsecParametersParameters parameters)
        {
            this.gatewayClient = gatewayClient;
            this.virtualNetworkSiteName = virtualNetworkSiteName;
            this.localNetworkSiteName = localNetworkSiteName;
            this.parameters = parameters;

            oldIPsecParameters = gatewayClient.GetIPsecParameters(virtualNetworkSiteName, localNetworkSiteName);
        }
 /// <summary>
 /// The Begin Set Virtual Network Gateway IPsec Parameters operation
 /// sets the IPsec parameters on the virtual network gateway for the
 /// specified connection to the specified local network in Azure.
 /// </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='localNetworkName'>
 /// Required. The name of the local network.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set IPsec Parameters request.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<GatewayOperationResponse> BeginSetIPsecParametersAsync(this IGatewayOperations operations, string networkName, string localNetworkName, GatewaySetIPsecParametersParameters parameters)
 {
     return operations.BeginSetIPsecParametersAsync(networkName, localNetworkName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Begin Set Virtual Network Gateway IPsec Parameters operation
 /// sets the IPsec parameters on the virtual network gateway for the
 /// specified connection to the specified local network in Azure.
 /// </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='localNetworkName'>
 /// Required. The name of the local network.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set IPsec Parameters request.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static GatewayOperationResponse BeginSetIPsecParameters(this IGatewayOperations operations, string networkName, string localNetworkName, GatewaySetIPsecParametersParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IGatewayOperations)s).BeginSetIPsecParametersAsync(networkName, localNetworkName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 public GatewayGetOperationStatusResponse SetIPsecParametersV2(string gatewayId, string connectedentityId, GatewaySetIPsecParametersParameters parameters)
 {
     return gatewayClient.SetIPsecParametersV2(gatewayId, connectedentityId, parameters);
 }
        public GatewayGetOperationStatusResponse SetIPsecParameters(string virtualNetworkSiteName, string localNetworkSiteName, GatewaySetIPsecParametersParameters parameters)
        {
            SetIPsecParameters operation = new SetIPsecParameters(gatewayClient, virtualNetworkSiteName, localNetworkSiteName, parameters);

            testClient.InvokeTestOperation(operation);

            return operation.InvokeResponse;
        }
 /// <summary>
 /// The Begin Set Virtual Network Gateway IPsec Parameters V2 operation
 /// sets the IPsec parameters on the virtual network gateway
 /// connection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='gatewayId'>
 /// Required. The virtual network for this gateway Id.
 /// </param>
 /// <param name='connectedentityId'>
 /// Required. The connected entity Id.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set IPsec Parameters V2 request.
 /// </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 Task<GatewayGetOperationStatusResponse> SetIPsecParametersV2Async(this IGatewayOperations operations, string gatewayId, string connectedentityId, GatewaySetIPsecParametersParameters parameters)
 {
     return operations.SetIPsecParametersV2Async(gatewayId, connectedentityId, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Begin Set Virtual Network Gateway IPsec Parameters V2 operation
 /// sets the IPsec parameters on the virtual network gateway
 /// connection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='gatewayId'>
 /// Required. The virtual network for this gateway Id.
 /// </param>
 /// <param name='connectedentityId'>
 /// Required. The connected entity Id.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set IPsec Parameters V2 request.
 /// </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 SetIPsecParametersV2(this IGatewayOperations operations, string gatewayId, string connectedentityId, GatewaySetIPsecParametersParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IGatewayOperations)s).SetIPsecParametersV2Async(gatewayId, connectedentityId, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }