public async virtual Task <FirewallRuleCreateOrUpdateOperation> CreateOrUpdateAsync(string firewallRuleName, FirewallRuleData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (firewallRuleName == null) { throw new ArgumentNullException(nameof(firewallRuleName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("FirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = await _firewallRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, parameters, cancellationToken).ConfigureAwait(false); var operation = new FirewallRuleCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <FirewallRuleResource> > UpdateAsync(WaitUntil waitUntil, FirewallRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _firewallRuleClientDiagnostics.CreateScope("FirewallRuleResource.Update"); scope.Start(); try { var response = await _firewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); var operation = new SqlArmOperation <FirewallRuleResource>(Response.FromValue(new FirewallRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <FirewallRule> > CreateOrUpdateAsync(bool waitForCompletion, string firewallRuleName, FirewallRuleData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _firewallRuleClientDiagnostics.CreateScope("FirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = await _firewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, parameters, cancellationToken).ConfigureAwait(false); var operation = new SqlArmOperation <FirewallRule>(Response.FromValue(new FirewallRule(Client, response), response.GetRawResponse())); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }