/// <summary>
 /// Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the
 /// existing gateway.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name of the P2SVpnGateway.
 /// </param>
 /// <param name='gatewayName'>
 /// The name of the gateway.
 /// </param>
 /// <param name='p2SVpnGatewayParameters'>
 /// Parameters supplied to create or Update a virtual wan p2s vpn gateway.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <P2SVpnGateway> BeginCreateOrUpdateAsync(this IP2sVpnGatewaysOperations operations, string resourceGroupName, string gatewayName, P2SVpnGateway p2SVpnGatewayParameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the
 /// existing gateway.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name of the P2SVpnGateway.
 /// </param>
 /// <param name='gatewayName'>
 /// The name of the gateway.
 /// </param>
 /// <param name='p2SVpnGatewayParameters'>
 /// Parameters supplied to create or Update a virtual wan p2s vpn gateway.
 /// </param>
 public static P2SVpnGateway CreateOrUpdate(this IP2sVpnGatewaysOperations operations, string resourceGroupName, string gatewayName, P2SVpnGateway p2SVpnGatewayParameters)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).GetAwaiter().GetResult());
 }
Ejemplo n.º 3
0
        public virtual P2SVpnGatewaysCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string gatewayName, P2SVpnGateway p2SVpnGatewayParameters, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (gatewayName == null)
            {
                throw new ArgumentNullException(nameof(gatewayName));
            }
            if (p2SVpnGatewayParameters == null)
            {
                throw new ArgumentNullException(nameof(p2SVpnGatewayParameters));
            }

            using var scope = _clientDiagnostics.CreateScope("P2SVpnGatewaysClient.StartCreateOrUpdate");
            scope.Start();
            try
            {
                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, gatewayName, p2SVpnGatewayParameters, cancellationToken);
                return(new P2SVpnGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, gatewayName, p2SVpnGatewayParameters).Request, originalResponse));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }