public virtual FileShareCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string shareName, FileShareData fileShare, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); if (fileShare == null) { throw new ArgumentNullException(nameof(fileShare)); } using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.CreateOrUpdate"); scope.Start(); try { var response = _fileShareRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, shareName, fileShare, expand, cancellationToken); var operation = new FileShareCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual FileShareCreateOperation CreateOrUpdate(string shareName, FileShareData fileShare, string expand = null, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (shareName == null) { throw new ArgumentNullException(nameof(shareName)); } if (fileShare == null) { throw new ArgumentNullException(nameof(fileShare)); } using var scope = _clientDiagnostics.CreateScope("FileShareContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.Create(Id.ResourceGroupName, Id.Parent.Name, Id.Name, shareName, fileShare, expand, cancellationToken); var operation = new FileShareCreateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <FileShare> CreateOrUpdate(WaitUntil waitUntil, string shareName, FileShareData fileShare, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); Argument.AssertNotNull(fileShare, nameof(fileShare)); using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.CreateOrUpdate"); scope.Start(); try { var response = _fileShareRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, shareName, fileShare, expand, cancellationToken); var operation = new StorageArmOperation <FileShare>(Response.FromValue(new FileShare(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }