2020import org .apache .hadoop .ozone .client .OzoneClient ;
2121import org .apache .hadoop .ozone .client .OzoneSnapshot ;
2222import org .apache .hadoop .ozone .shell .Handler ;
23+ import org .apache .hadoop .ozone .shell .ListOptions ;
2324import org .apache .hadoop .ozone .shell .OzoneAddress ;
2425import org .apache .hadoop .ozone .shell .bucket .BucketUri ;
2526import picocli .CommandLine ;
@@ -39,6 +40,9 @@ public class ListSnapshotHandler extends Handler {
3940 @ CommandLine .Mixin
4041 private BucketUri snapshotPath ;
4142
43+ @ CommandLine .Mixin
44+ private ListOptions listOptions ;
45+
4246 @ Override
4347 protected OzoneAddress getAddress () {
4448 return snapshotPath .getValue ();
@@ -51,8 +55,9 @@ protected void execute(OzoneClient client, OzoneAddress address)
5155 String bucketName = snapshotPath .getValue ().getBucketName ();
5256
5357 Iterator <? extends OzoneSnapshot > snapshotInfos = client .getObjectStore ()
54- .listSnapshot (volumeName , bucketName , null , null );
55- int counter = printAsJsonArray (snapshotInfos , Integer .MAX_VALUE );
58+ .listSnapshot (volumeName , bucketName , listOptions .getPrefix (),
59+ listOptions .getStartItem ());
60+ int counter = printAsJsonArray (snapshotInfos , listOptions .getLimit ());
5661 if (isVerbose ()) {
5762 err ().printf ("Found : %d snapshots for o3://%s/%s %n" , counter ,
5863 volumeName , bucketName );
0 commit comments