Created
April 12, 2015 14:38
-
-
Save stephen-maina/d37b5ca8a0dd698981be to your computer and use it in GitHub Desktop.
AWS Delete File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void deleteAWS(String link) throws IOException { | |
AmazonS3 s3Conn = new AmazonS3Client( | |
new PropertiesCredentials( | |
Document.class | |
.getResourceAsStream("/com/api/AwsCredentials.properties"))); | |
DeleteObjectsRequest multiDelete = new DeleteObjectsRequest( | |
"schoolmart-document"); | |
List<KeyVersion> keys = new ArrayList<DeleteObjectsRequest.KeyVersion>(); | |
keys.add(new KeyVersion(link.replace( | |
"http://s3.amazonaws.com/doc-document/", ""))); | |
multiDelete.setKeys(keys); | |
s3Conn.deleteObjects(multiDelete); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment