This method is used to delete files from the S3 bucket. It does not delete the S-Drive file records, so that needs to be done separately.

cg.SdriveTools.deleteS3Files(List awsLocationList, List versionIdList)

awsLocationList is the Key__c field
versionIdList is the version_id__c fields.

This returns void if the delete is successful and an exception if unsuccessful.

Example code:

List<cg__CaseFile__c> caseFiles = Database.query('Select id, cg__Key__c, cg__Version_Id__c from cg__CaseFile__c');
List<String> awsLocationList = new List<String>();
List<String> versionIdList = new List<String>();
for(cg__CaseFile__c caseFile : caseFiles)

cg.SdriveTools.deleteS3Files( awsLocationList, versionIdList);

//After delete from s3 is successful you should delete the records Salsforce as well like below.

delete caseFiles.