* @param bucket Bucket name
* @param key The S3 object key
*/
ObjectVersionListing(@NotNull final AmazonS3 client,
@NotNull final String bucket, @NotNull final String key) {
VersionListing listing = client.listVersions(
new ListVersionsRequest().withPrefix(key).withBucketName(bucket)
);
final ImmutableList.Builder<S3VersionSummary> versions =
ImmutableList.builder();
versions.addAll(listing.getVersionSummaries());
while (listing.isTruncated()) {
listing = client.listNextBatchOfVersions(listing);
versions.addAll(listing.getVersionSummaries());
}
// @checkstyle LineLength (2 lines)
final Directives dirs = new Directives()
.add("versions").attr("object", key);
for (final S3VersionSummary version : versions.build()) {