Example usage for com.amazonaws.services.rds.model DescribeDBSnapshotsResult getMarker

List of usage examples for com.amazonaws.services.rds.model DescribeDBSnapshotsResult getMarker

Introduction

In this page you can find the example usage for com.amazonaws.services.rds.model DescribeDBSnapshotsResult getMarker.

Prototype


public String getMarker() 

Source Link

Document

An optional pagination token provided by a previous request.

Usage

From source file:com.github.blacklocus.rdsecho.utl.RdsFind.java

License:Open Source License

public Iterable<DBSnapshot> snapshots(final String dbInstanceIdentifier,
        final Predicate<DBSnapshot> predicate) {
    return new PagingIterable<DBSnapshot>(new Supplier<Iterable<DBSnapshot>>() {

        String marker = null;// w  w w.  j  ava 2s.  c  om
        boolean isTruncated = true;

        @Override
        public Iterable<DBSnapshot> get() {
            if (isTruncated) {
                DescribeDBSnapshotsRequest request = new DescribeDBSnapshotsRequest()
                        .withDBInstanceIdentifier(dbInstanceIdentifier).withMarker(marker);
                DescribeDBSnapshotsResult result = rds.describeDBSnapshots(request);
                marker = result.getMarker();
                isTruncated = result.getMarker() != null;
                return Iterables.filter(result.getDBSnapshots(), predicate);

            } else {
                return Collections.emptyList();
            }
        }
    });
}