List of usage examples for com.amazonaws.services.rds.model DeleteDBInstanceRequest setFinalDBSnapshotIdentifier
public void setFinalDBSnapshotIdentifier(String finalDBSnapshotIdentifier)
The DBSnapshotIdentifier
of the new DBSnapshot
created when the SkipFinalSnapshot
parameter is disabled.
From source file:com.cloudera.director.aws.rds.RDSProvider.java
License:Apache License
@Override public void delete(RDSInstanceTemplate template, Collection<String> virtualInstanceIds) throws InterruptedException { if (virtualInstanceIds.isEmpty()) { return;/* w w w . j a va2s . co m*/ } for (String virtualInstanceId : virtualInstanceIds) { LOG.info(">> Terminating {}", virtualInstanceId); DeleteDBInstanceRequest request = new DeleteDBInstanceRequest() .withDBInstanceIdentifier(virtualInstanceId); if (template.isSkipFinalSnapshot().or(false)) { request.setSkipFinalSnapshot(true); } else { String snapshotIdentifier = String.format("%s-director-final-snapshot-%d", virtualInstanceId, System.currentTimeMillis()); request.setFinalDBSnapshotIdentifier(snapshotIdentifier); } try { DBInstance deletedDbInstance = client.deleteDBInstance(request); LOG.info("<< Result {}", deletedDbInstance); } catch (DBInstanceNotFoundException e) { LOG.warn("<< Instance {} was not found, assuming already deleted", virtualInstanceId); } } }