public async Task DropBucketAsync(string bucketName, DropBucketOptions options = null) { options = options ?? new DropBucketOptions(); var uri = GetUri(bucketName); Logger.LogInformation($"Attempting to drop bucket with name {bucketName} - {uri}"); try { // perform drop var result = await _client.DeleteAsync(uri, options.CancellationToken).ConfigureAwait(false); if (result.StatusCode == HttpStatusCode.NotFound) { throw new BucketNotFoundException(bucketName); } result.EnsureSuccessStatusCode(); } catch (BucketNotFoundException) { Logger.LogError($"Unable to drop bucket with name {bucketName} because it does not exist"); } catch (Exception exception) { Logger.LogError(exception, $"Failed to drop bucket with name {bucketName}"); throw; } }
public static Task DropBucketAsync(this IBucketManager bucketManager, string bucketName, Action <DropBucketOptions> configureOptions) { var options = new DropBucketOptions(); configureOptions(options); return(bucketManager.DropBucketAsync(bucketName, options)); }