/// <summary> /// Creates or updates a load balancer inbound NAT rule. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='loadBalancerName'> /// The name of the load balancer. /// </param> /// <param name='inboundNatRuleName'> /// The name of the inbound NAT rule. /// </param> /// <param name='inboundNatRuleParameters'> /// Parameters supplied to the create or update inbound NAT rule operation. /// </param> public static InboundNatRule BeginCreateOrUpdate(this IInboundNatRulesOperations operations, string resourceGroupName, string loadBalancerName, string inboundNatRuleName, InboundNatRule inboundNatRuleParameters) { return(operations.BeginCreateOrUpdateAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).GetAwaiter().GetResult()); }
/// <summary> /// Creates or updates a load balancer inbound NAT rule. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='loadBalancerName'> /// The name of the load balancer. /// </param> /// <param name='inboundNatRuleName'> /// The name of the inbound NAT rule. /// </param> /// <param name='inboundNatRuleParameters'> /// Parameters supplied to the create or update inbound NAT rule operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <InboundNatRule> BeginCreateOrUpdateAsync(this IInboundNatRulesOperations operations, string resourceGroupName, string loadBalancerName, string inboundNatRuleName, InboundNatRule inboundNatRuleParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public virtual InboundNatRulesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string loadBalancerName, string inboundNatRuleName, InboundNatRule inboundNatRuleParameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (loadBalancerName == null) { throw new ArgumentNullException(nameof(loadBalancerName)); } if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } if (inboundNatRuleParameters == null) { throw new ArgumentNullException(nameof(inboundNatRuleParameters)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRulesClient.StartCreateOrUpdate"); scope.Start(); try { var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, cancellationToken); return(new InboundNatRulesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }