use of com.amazonaws.s3.model.DeleteObjectRequest in project stocator by CODAIT.
the class COSAPIClient method delete.
@Override
public boolean delete(String hostName, Path path, boolean recursive) throws IOException {
String key = pathToKey(path);
LOG.debug("Object name to delete {}. Path {}", key, path.toString());
try {
mClient.deleteObject(new DeleteObjectRequest(mBucket, key));
memoryCache.removeFileStatus(path.toString());
return true;
} catch (AmazonServiceException e) {
if (e.getStatusCode() != 404) {
throw new IOException(e);
}
}
LOG.warn("Delete on {} not found. Nothing to delete");
return false;
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project aws-sdk-java-v2 by aws.
the class S3WithUrlHttpClientIntegrationTest method deleteObject.
private static void deleteObject(String bucket, String key) {
DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder().bucket(bucket).key(key).build();
s3.deleteObject(deleteObjectRequest);
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project Insights by CognizantOneDevOps.
the class LambdaFunctionHandler method deleteObject.
/**
* Delete the S3 Object (S3 file)
* @param deleteKey
*/
public void deleteObject(S3Object deleteKey) {
try {
DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder().bucket(S3_BUCKET_NAME).key(deleteKey.key()).build();
s3.deleteObject(deleteObjectRequest);
} catch (Exception e) {
log.error("Error while deleting the object form S3" + e.toString());
}
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project automatiko-engine by automatiko-io.
the class S3Store method remove.
public void remove(String processId, String processVersion, String processInstanceId, String... name) {
String objectKey = createObjectKey(processId, processVersion, processInstanceId, name);
DeleteObjectRequest deleteRequest = DeleteObjectRequest.builder().bucket(bucket).key(objectKey).build();
s3.deleteObject(deleteRequest);
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project stocator by SparkTC.
the class COSAPIClient method delete.
@Override
public boolean delete(String hostName, Path path, boolean recursive) throws IOException {
String key = pathToKey(path);
LOG.debug("Object name to delete {}. Path {}", key, path.toString());
try {
mClient.deleteObject(new DeleteObjectRequest(mBucket, key));
memoryCache.removeFileStatus(path.toString());
return true;
} catch (AmazonServiceException e) {
if (e.getStatusCode() != 404) {
throw new IOException(e);
}
}
LOG.warn("Delete on {} not found. Nothing to delete");
return false;
}
Aggregations