Exemple #1
0
        public async Task S3Service_Should_Delete_A_File_To_A_Bucket()
        {
            var bucketName = Guid.NewGuid().ToString();

            await CreateTestBucket(bucketName);
            await UploadTestFile(bucketName : bucketName, key : Key);

            DeleteObjectResponse deleteObjectResponse = await AmazonS3.DeleteObjectAsync(bucketName, Key);

            Assert.Equal(HttpStatusCode.NoContent, deleteObjectResponse.HttpStatusCode);
        }
Exemple #2
0
        public async Task DeleteAsync(S3FileKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            var request = new DeleteObjectRequest
            {
                BucketName = BucketNameConstructor.GetBucketName(key),
                Key        = key.Key
            };

            await AmazonS3.DeleteObjectAsync(request);
        }