public virtual DiskAccessCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string diskAccessName, DiskAccessData diskAccess, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(diskAccessName, nameof(diskAccessName)); if (diskAccess == null) { throw new ArgumentNullException(nameof(diskAccess)); } using var scope = _diskAccessClientDiagnostics.CreateScope("DiskAccessCollection.CreateOrUpdate"); scope.Start(); try { var response = _diskAccessRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, diskAccess, cancellationToken); var operation = new DiskAccessCreateOrUpdateOperation(ArmClient, _diskAccessClientDiagnostics, Pipeline, _diskAccessRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, diskAccess).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual DiskAccessCreateOrUpdateOperation CreateOrUpdate(string diskAccessName, DiskAccessData diskAccess, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (diskAccessName == null) { throw new ArgumentNullException(nameof(diskAccessName)); } if (diskAccess == null) { throw new ArgumentNullException(nameof(diskAccess)); } using var scope = _clientDiagnostics.CreateScope("DiskAccessContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, diskAccessName, diskAccess, cancellationToken); var operation = new DiskAccessCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, diskAccessName, diskAccess).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <DiskAccessResource> CreateOrUpdate(WaitUntil waitUntil, string diskAccessName, DiskAccessData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(diskAccessName, nameof(diskAccessName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _diskAccessClientDiagnostics.CreateScope("DiskAccessCollection.CreateOrUpdate"); scope.Start(); try { var response = _diskAccessRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, data, cancellationToken); var operation = new ComputeArmOperation <DiskAccessResource>(new DiskAccessOperationSource(Client), _diskAccessClientDiagnostics, Pipeline, _diskAccessRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }