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