public virtual async Task <ArmOperation <AfdCustomDomainResource> > UpdateAsync(WaitUntil waitUntil, AfdCustomDomainPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _afdCustomDomainClientDiagnostics.CreateScope("AfdCustomDomainResource.Update"); scope.Start(); try { var response = await _afdCustomDomainRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); var operation = new CdnArmOperation <AfdCustomDomainResource>(new AfdCustomDomainOperationSource(Client), _afdCustomDomainClientDiagnostics, Pipeline, _afdCustomDomainRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <AfdCustomDomainUpdateOperation> UpdateAsync(bool waitForCompletion, AfdCustomDomainUpdateOptions customDomainUpdateProperties, CancellationToken cancellationToken = default) { if (customDomainUpdateProperties == null) { throw new ArgumentNullException(nameof(customDomainUpdateProperties)); } using var scope = _clientDiagnostics.CreateScope("AfdCustomDomain.Update"); scope.Start(); try { var response = await _afdCustomDomainsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties, cancellationToken).ConfigureAwait(false); var operation = new AfdCustomDomainUpdateOperation(this, _clientDiagnostics, Pipeline, _afdCustomDomainsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }