public async virtual Task <TableCreateOperation> CreateOrUpdateAsync(string tableName, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } using var scope = _clientDiagnostics.CreateScope("TableCollection.CreateOrUpdate"); scope.Start(); try { var response = await _tableRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, tableName, cancellationToken).ConfigureAwait(false); var operation = new TableCreateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual TableCreateOperation CreateOrUpdate(string tableName, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } using var scope = _clientDiagnostics.CreateScope("TableContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.Create(Id.ResourceGroupName, Id.Parent.Name, Id.Name, tableName, cancellationToken); var operation = new TableCreateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }