public virtual SnapshotUpdateOperation Update(SnapshotUpdate snapshot, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (snapshot == null) { throw new ArgumentNullException(nameof(snapshot)); } using var scope = _clientDiagnostics.CreateScope("Snapshot.Update"); scope.Start(); try { var response = _restClient.Update(Id.ResourceGroupName, Id.Name, snapshot, cancellationToken); var operation = new SnapshotUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Name, snapshot).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <Snapshot> Update(bool waitForCompletion, SnapshotUpdate snapshot, CancellationToken cancellationToken = default) { if (snapshot == null) { throw new ArgumentNullException(nameof(snapshot)); } using var scope = _snapshotClientDiagnostics.CreateScope("Snapshot.Update"); scope.Start(); try { var response = _snapshotRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshot, cancellationToken); var operation = new ComputeArmOperation <Snapshot>(new SnapshotOperationSource(Client), _snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshot).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <SnapshotResource> Update(WaitUntil waitUntil, PatchableSnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Update"); scope.Start(); try { var response = _snapshotRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); var operation = new ComputeArmOperation <SnapshotResource>(new SnapshotOperationSource(Client), _snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }