Example usage for com.amazonaws.services.rds.model DescribeDBSnapshotsRequest DescribeDBSnapshotsRequest

List of usage examples for com.amazonaws.services.rds.model DescribeDBSnapshotsRequest DescribeDBSnapshotsRequest

Introduction

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

Prototype

DescribeDBSnapshotsRequest

Source Link

Usage

From source file:br.com.objectos.aws.rds.maven.plugin.CreateSnapshotMojo.java

License:Apache License

private DBSnapshot describeSnapshot(AmazonRDSClient client) {
    DBSnapshot snapshot = null;/*from   w ww  .j  av a2  s  . c o m*/

    DescribeDBSnapshotsRequest describeDBSnapshotsRequest = new DescribeDBSnapshotsRequest()
            .withDBSnapshotIdentifier(dBSnapshotIdentifier);

    DescribeDBSnapshotsResult describeDBSnapshots = client.describeDBSnapshots(describeDBSnapshotsRequest);
    List<DBSnapshot> list = describeDBSnapshots.getDBSnapshots();

    if (!list.isEmpty()) {
        snapshot = list.get(0);
    }

    return snapshot;
}

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;/*from  w ww . j  av a 2s  . com*/
        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();
            }
        }
    });
}