public static async System.Threading.Tasks.Task <bool> Delete(this string fileNameGuid, string _awsAccessKey, string _awsSecretKey, string _bucketName)
{
IAmazonS3 client;
var s3Client = RegionEndpoint.USEast1;
try
{
using (client = new Amazon.S3.AmazonS3Client(_awsAccessKey, _awsSecretKey, s3Client))
{
DeleteObjectRequest request = new DeleteObjectRequest()
{
BucketName = _bucketName,
Key = fileNameGuid,
};
await client.DeleteObjectAsync(request);
client.Dispose();
}
}
catch (Exception exception)
{
Logging.Log("Upload Documents failure", "S3 File upload Extension Method", exception);
return(false);
}
return(true);
}