public virtual BlobContainerCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string containerName, BlobContainerData blobContainer, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); if (blobContainer == null) { throw new ArgumentNullException(nameof(blobContainer)); } using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainerCollection.CreateOrUpdate"); scope.Start(); try { var response = _blobContainerRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, containerName, blobContainer, cancellationToken); var operation = new BlobContainerCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual BlobContainerCreateOperation CreateOrUpdate(string containerName, BlobContainerData blobContainer, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (containerName == null) { throw new ArgumentNullException(nameof(containerName)); } if (blobContainer == null) { throw new ArgumentNullException(nameof(blobContainer)); } using var scope = _clientDiagnostics.CreateScope("BlobContainerContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.Create(Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, blobContainer, cancellationToken); var operation = new BlobContainerCreateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <BlobContainer> CreateOrUpdate(WaitUntil waitUntil, string containerName, BlobContainerData blobContainer, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); Argument.AssertNotNull(blobContainer, nameof(blobContainer)); using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainerCollection.CreateOrUpdate"); scope.Start(); try { var response = _blobContainerRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, containerName, blobContainer, cancellationToken); var operation = new StorageArmOperation <BlobContainer>(Response.FromValue(new BlobContainer(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }