public virtual AfdOriginUpdateOperation Update(AfdOriginUpdateOptions originUpdateProperties, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (originUpdateProperties == null) { throw new ArgumentNullException(nameof(originUpdateProperties)); } using var scope = _clientDiagnostics.CreateScope("AfdOrigin.Update"); scope.Start(); try { var response = _afdOriginsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originUpdateProperties, cancellationToken); var operation = new AfdOriginUpdateOperation(this, _clientDiagnostics, Pipeline, _afdOriginsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originUpdateProperties).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <AfdOriginUpdateOperation> UpdateAsync(bool waitForCompletion, AfdOriginUpdateOptions originUpdateProperties, CancellationToken cancellationToken = default) { if (originUpdateProperties == null) { throw new ArgumentNullException(nameof(originUpdateProperties)); } using var scope = _afdOriginClientDiagnostics.CreateScope("AfdOrigin.Update"); scope.Start(); try { var response = await _afdOriginRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originUpdateProperties, cancellationToken).ConfigureAwait(false); var operation = new AfdOriginUpdateOperation(ArmClient, _afdOriginClientDiagnostics, Pipeline, _afdOriginRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originUpdateProperties).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }