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

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

Introduction

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

Prototype


public java.util.List<DBSnapshot> getDBSnapshots() 

Source Link

Document

A list of DBSnapshot instances.

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   ww  w.  j  a v  a 2  s . co  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  ava 2s . c  o  m
        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();
            }
        }
    });
}