EasyManua.ls Logo

Amazon Redshift

Amazon Redshift
131 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
DescribeClusterSnapshotsRequest request = new DescribeClusterSnapshots
Request()
.withEndTime(creationDate)
.withClusterIdentifier(clusterIdentifier)
.withSnapshotType("manual");
DescribeClusterSnapshotsResult result = client.describeClusterSnap
shots(request);
for (Snapshot s : result.getSnapshots()) {
DeleteClusterSnapshotRequest deleteRequest = new DeleteClusterSnap
shotRequest()
.withSnapshotIdentifier(s.getSnapshotIdentifier());
Snapshot deleteResult = client.deleteClusterSnapshot(deleteRequest);
System.out.format("Deleted snapshot %s\n", deleteResult.getSnap
shotIdentifier());
}
}
private static void printResultSnapshots(DescribeClusterSnapshotsResult
result) {
System.out.println("\nSnapshot listing:");
for (Snapshot snapshot : result.getSnapshots()) {
System.out.format("Identifier: %s\n", snapshot.getSnapshotIdentifi
er());
System.out.format("Snapshot type: %s\n", snapshot.getSnapshotType());
System.out.format("Snapshot create time: %s\n", snapshot.getSnap
shotCreateTime());
System.out.format("Snapshot status: %s\n\n", snapshot.getStatus());
}
}
private static Boolean waitForSnapshotAvailable(String snapshotId) throws
InterruptedException {
Boolean snapshotAvailable = false;
System.out.println("Wating for snapshot to become available.");
while (!snapshotAvailable) {
DescribeClusterSnapshotsResult result = client.describeClusterSnap
shots(new DescribeClusterSnapshotsRequest()
.withSnapshotIdentifier(snapshotId));
String status = (result.getSnapshots()).get(0).getStatus();
if (status.equalsIgnoreCase("available")) {
snapshotAvailable = true;
}
else {
System.out.print(".");
Thread.sleep(sleepTime*1000);
}
}
return snapshotAvailable;
}
}
API Version 2012-12-01
61
Amazon Redshift Management Guide
Managing Snapshots Using AWS SDK for Java

Table of Contents

Related product manuals