public async virtual Task <AfdRouteUpdateOperation> UpdateAsync(bool waitForCompletion, RouteUpdateOptions routeUpdateProperties, CancellationToken cancellationToken = default) { if (routeUpdateProperties == null) { throw new ArgumentNullException(nameof(routeUpdateProperties)); } using var scope = _clientDiagnostics.CreateScope("AfdRoute.Update"); scope.Start(); try { var response = await _afdRoutesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, routeUpdateProperties, cancellationToken).ConfigureAwait(false); var operation = new AfdRouteUpdateOperation(this, _clientDiagnostics, Pipeline, _afdRoutesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, routeUpdateProperties).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <AfdRouteResource> > UpdateAsync(WaitUntil waitUntil, AfdRoutePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _afdRouteClientDiagnostics.CreateScope("AfdRouteResource.Update"); scope.Start(); try { var response = await _afdRouteRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); var operation = new CdnArmOperation <AfdRouteResource>(new AfdRouteOperationSource(Client), _afdRouteClientDiagnostics, Pipeline, _afdRouteRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, 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; } }