Exemplo n.º 1
0
 /// <summary>
 /// Swaps VIPs between two load balancers.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='location'>
 /// The region where load balancers are located at.
 /// </param>
 /// <param name='parameters'>
 /// Parameters that define which VIPs should be swapped.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task BeginSwapPublicIpAddressesAsync(this ILoadBalancersOperations operations, string location, LoadBalancerVipSwapRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.BeginSwapPublicIpAddressesWithHttpMessagesAsync(location, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Exemplo n.º 2
0
        public virtual LoadBalancerSwapPublicIpAddressesOperation SwapPublicIpAddresses(LoadBalancerVipSwapRequest parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var scope = _clientDiagnostics.CreateScope("LoadBalancer.SwapPublicIpAddresses");
            scope.Start();
            try
            {
                var response  = _restClient.SwapPublicIpAddresses(Id.Name, parameters, cancellationToken);
                var operation = new LoadBalancerSwapPublicIpAddressesOperation(_clientDiagnostics, Pipeline, _restClient.CreateSwapPublicIpAddressesRequest(Id.Name, parameters).Request, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Swaps VIPs between two load balancers.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='location'>
 /// The region where load balancers are located at.
 /// </param>
 /// <param name='parameters'>
 /// Parameters that define which VIPs should be swapped.
 /// </param>
 public static void BeginSwapPublicIpAddresses(this ILoadBalancersOperations operations, string location, LoadBalancerVipSwapRequest parameters)
 {
     operations.BeginSwapPublicIpAddressesAsync(location, parameters).GetAwaiter().GetResult();
 }