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)
Parameters:
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 awsLocationList = new List();
List versionIdList = new List();
for(cg__CaseFile__c caseFile : caseFiles){
awsLocationList.add(caseFile.cg__Key__c);
versionIdList.add(caseFile.cg__version_id__c);
}
cg.SdriveTools.deleteS3Files( awsLocationList, versionIdList);
After delete from s3 is successful you should delete the records Salsforce as well like below.
delete caseFiles.