Amazon Redshift Betriebsanweisung Seite 102

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 255
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 101
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
96
Amazon Redshift Management Guide
Managing Snapshots Using the AWS SDK for Java
Seitenansicht 101
1 2 ... 97 98 99 100 101 102 103 104 105 106 107 ... 254 255

Kommentare zu diesen Handbüchern

Keine Kommentare