public virtual ArmOperation <IscsiTargetResource> Update(WaitUntil waitUntil, IscsiTargetPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _iscsiTargetClientDiagnostics.CreateScope("IscsiTargetResource.Update"); scope.Start(); try { var response = _iscsiTargetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); var operation = new StoragePoolArmOperation <IscsiTargetResource>(new IscsiTargetOperationSource(Client), _iscsiTargetClientDiagnostics, Pipeline, _iscsiTargetRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual IscsiTargetUpdateOperation Update(bool waitForCompletion, IscsiTargetUpdate iscsiTargetUpdatePayload, CancellationToken cancellationToken = default) { if (iscsiTargetUpdatePayload == null) { throw new ArgumentNullException(nameof(iscsiTargetUpdatePayload)); } using var scope = _iscsiTargetClientDiagnostics.CreateScope("IscsiTarget.Update"); scope.Start(); try { var response = _iscsiTargetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, iscsiTargetUpdatePayload, cancellationToken); var operation = new IscsiTargetUpdateOperation(ArmClient, _iscsiTargetClientDiagnostics, Pipeline, _iscsiTargetRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, iscsiTargetUpdatePayload).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) { scope.Failed(e); throw; } }