public static async Task <DeleteBucketStatus> DeleteBucketRecursiveAsync(this IS3BucketClient client, string bucketName, CancellationToken token = default)
        {
            Validator.RequireNotNull(client);
            Validator.RequireNotNull(bucketName);

            DeleteBucketStatus emptyResp = await client.EmptyBucket(bucketName, token).ConfigureAwait(false);

            if (emptyResp != DeleteBucketStatus.Ok)
            {
                return(emptyResp);
            }

            DeleteBucketResponse delResponse = await client.DeleteBucketAsync(bucketName, null, token).ConfigureAwait(false);

            if (!delResponse.IsSuccess && delResponse.Error.Code == ErrorCode.BucketNotEmpty)
            {
                return(DeleteBucketStatus.BucketNotEmpty);
            }

            return(DeleteBucketStatus.Ok);
        }
Example #2
0
 public Task <DeleteBucketResponse> DeleteBucketAsync(string bucketName, Action <DeleteBucketRequest> config = null, CancellationToken token = default)
 {
     return(_bucketClient.DeleteBucketAsync(bucketName, config, token));
 }