public async virtual Task <QueueCreateOperation> CreateOrUpdateAsync(string queueName, StorageQueueData queue, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (queueName == null) { throw new ArgumentNullException(nameof(queueName)); } if (queue == null) { throw new ArgumentNullException(nameof(queue)); } using var scope = _clientDiagnostics.CreateScope("StorageQueueCollection.CreateOrUpdate"); scope.Start(); try { var response = await _queueRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, queueName, queue, cancellationToken).ConfigureAwait(false); var operation = new QueueCreateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <StorageQueue> > CreateOrUpdateAsync(bool waitForCompletion, string queueName, StorageQueueData queue, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(queueName, nameof(queueName)); Argument.AssertNotNull(queue, nameof(queue)); using var scope = _storageQueueQueueClientDiagnostics.CreateScope("StorageQueueCollection.CreateOrUpdate"); scope.Start(); try { var response = await _storageQueueQueueRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, queueName, queue, cancellationToken).ConfigureAwait(false); var operation = new StorageArmOperation <StorageQueue>(Response.FromValue(new StorageQueue(Client, response), response.GetRawResponse())); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }