S3Service { public List<String> listCommonPrefixesS3Objects(final String bucketName, final String prefix) { final List<String> commonPrefixes = Lists.newArrayList(); try { log.debug("Listing objects in bucket '{}' with prefix '{}'", bucketName, prefix); final ListObjectsRequest listObjectsRequest = new ListObjectsRequest() .withDelimiter("/") .withBucketName(bucketName) .withPrefix(prefix); ObjectListing objectListing; do { objectListing = s3client.listObjects(listObjectsRequest); objectListing.getCommonPrefixes().stream().map(S3Service::urlDecode).forEach(commonPrefixes::add); listObjectsRequest.setMarker(objectListing.getNextMarker()); } while (objectListing.isTruncated()); } catch (final AmazonServiceException e) { log.error("Could not list common prefixes in S3", e); } return commonPrefixes; } S3Service(@Value("${fullstop.processor.properties.s3Region:#{null}}") String s3Region); String writeToS3(final String accountId, final String region, final Date instanceBootTime,
                            final String logData, final String logType, final String instanceId); void putObjectToS3(final String bucket, final String fileName, final String keyName,
                              final ObjectMetadata metadata, final InputStream stream); List<String> listCommonPrefixesS3Objects(final String bucketName, final String prefix); List<String> listS3Objects(final String bucketName, final String prefix); String downloadObject(final String bucketName, final String key);  }
@Test public void testS3ServiceListObject() { final List<String> result = service.listCommonPrefixesS3Objects( "an-s3-bucket", "111222333444/eu-west-1/2016/01/15/"); log.info("{}", result); }