Exemplo n.º 1
0
        public async Task <DeleteResult> DeleteAsync(IReadOnlyList <string> keys)
        {
            var batch = new DeleteBatch(keys);

            var request = new DeleteObjectBatchRequest(client.Host, bucketName, batch);

            var result = await client.DeleteObjectsAsync(request).ConfigureAwait(false);

            if (result.HasErrors)
            {
                throw new Exception(result.Errors[0].Message);
            }

            if (result.Deleted.Length != keys.Count)
            {
                throw new Exception($"Only {result.Deleted.Length} of {keys.Count} were deleted.");
            }

            return(result);
        }
Exemplo n.º 2
0
        public async Task <DeleteResult> DeleteObjectsAsync(DeleteObjectBatchRequest request)
        {
            var responseText = await SendAsync(request).ConfigureAwait(false);

            return(DeleteResult.Parse(responseText));
        }