use of org.jclouds.openstack.cinder.v1.domain.Snapshot in project legacy-jclouds-examples by jclouds.
the class DeleteSnapshot method main.
/**
* To get a username and API key see
* http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username The second argument
* (args[1]) must be your API key
*/
public static void main(String[] args) {
DeleteSnapshot deleteSnapshot = new DeleteSnapshot();
try {
deleteSnapshot.init(args);
Snapshot snapshot = deleteSnapshot.getSnapshot();
deleteSnapshot.deleteSnapshot(snapshot);
} catch (Exception e) {
e.printStackTrace();
} finally {
deleteSnapshot.close();
}
}
use of org.jclouds.openstack.cinder.v1.domain.Snapshot in project legacy-jclouds-examples by jclouds.
the class CreateSnapshot method createSnapshot.
private void createSnapshot(Volume volume) throws TimeoutException {
System.out.println("Create Snapshot");
CreateSnapshotOptions options = CreateSnapshotOptions.Builder.name(Constants.NAME).description("Snapshot of " + volume.getId());
Snapshot snapshot = snapshotApi.create(volume.getId(), options);
// /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!SnapshotPredicates.awaitAvailable(snapshotApi).apply(snapshot)) {
throw new TimeoutException("Timeout on volume: " + volume);
}
System.out.println(" " + snapshot);
}
Aggregations