public DeleteObjectsRequest withKeys(ObjectKey... keys) { return withKeys(Arrays.asList(keys)); }
@Override public Object getEntity() { return getDeleteObjects(); }
public DeleteObjectsRequest(String bucketName) { super(Method.POST, bucketName, "", "delete"); property(RestUtil.PROPERTY_GENERATE_CONTENT_MD5, Boolean.TRUE); // sign the MD5 to prevent replays }
@Override public Void call() { s3.deleteObjects(new DeleteObjectsRequest(config.getBucketName()).withKeys(deleteVersions)); return null; } }, OPERATION_DELETE_OBJECTS);
@Override public DeleteObjectsResult deleteObjects(DeleteObjectsRequest request) { for (ObjectKey obj : request.getDeleteObjects().getKeys()) { this.deleteObject(request.getBucketName(), obj.getKey()); } return new DeleteObjectsResult(); }
TestContext() throws Exception { String bucketName = BUCKET_NAME_PREFIX + UUID.randomUUID().toString(); this.adapterConfig = ExtendedS3StorageConfig.builder() .with(ExtendedS3StorageConfig.BUCKET, bucketName) .with(ExtendedS3StorageConfig.ACCESS_KEY_ID, "x") .with(ExtendedS3StorageConfig.SECRET_KEY, "x") .with(ExtendedS3StorageConfig.ROOT, "test") .with(ExtendedS3StorageConfig.URI, endpoint) .build(); URI uri = URI.create(endpoint); s3Config = new S3Config(uri) .withIdentity(adapterConfig.getAccessKey()).withSecretKey(adapterConfig.getSecretKey()); s3Proxy = new S3ProxyImpl(endpoint, s3Config); s3Proxy.start(); client = new S3JerseyClientWrapper(s3Config, s3Proxy); client.createBucket(bucketName); List<ObjectKey> keys = client.listObjects(bucketName).getObjects().stream() .map(object -> new ObjectKey(object.getKey())) .collect(Collectors.toList()); if (!keys.isEmpty()) { client.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); } }
public DeleteObjectsRequest withKeys(String... keys) { ObjectKey[] objects = new ObjectKey[keys.length]; for (int i = 0; i < keys.length; i++) { objects[i] = new ObjectKey(keys[i]); } return withKeys(objects); } }
@Override public DeleteObjectsResult deleteObjects(DeleteObjectsRequest request) { request.getDeleteObjects().getKeys().forEach(key -> aclMap.remove(key)); return client.deleteObjects(request); }