Search in sources :

Example 1 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetup method deleteStackInstanceDatabaseInstance.

/*
	/*
	 * Delete  stack instance database
	 */
public void deleteStackInstanceDatabaseInstance() {
    // Build the request to delete the stack instance database
    DeleteDBInstanceRequest req = buildStackInstanceDeleteDBInstanceRequest();
    DBInstance inst = deleteDatabaseInstance(req);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) DBInstance(com.amazonaws.services.rds.model.DBInstance)

Example 2 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testBuildIdGeneratorDeleteDBInstanceRequestNonProduction.

@Test
public void testBuildIdGeneratorDeleteDBInstanceRequestNonProduction() throws IOException {
    setupDevelopmentConfig();
    DeleteDBInstanceRequest expectedReq = new DeleteDBInstanceRequest();
    expectedReq.setDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier());
    expectedReq.setSkipFinalSnapshot(Boolean.TRUE);
    DeleteDBInstanceRequest req = databaseSetup.buildIdGeneratorDeleteDBInstanceRequest();
    assertEquals(expectedReq, req);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) Test(org.junit.Test)

Example 3 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testDeleteDatabaseInstanceDoesNotExist.

@Test
public void testDeleteDatabaseInstanceDoesNotExist() {
    // Should just be a no-op
    DeleteDBInstanceRequest req = new DeleteDBInstanceRequest();
    when(mockClient.deleteDBInstance(req)).thenThrow(new DBInstanceNotFoundException("Database instance does not exist"));
    DBInstance inst = databaseSetup.deleteDatabaseInstance(req);
    assertNull(inst);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) DBInstanceNotFoundException(com.amazonaws.services.rds.model.DBInstanceNotFoundException) DBInstance(com.amazonaws.services.rds.model.DBInstance) Test(org.junit.Test)

Example 4 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testBuildStackInstanceDeleteDBInstanceRequestNonProduction.

@Test
public void testBuildStackInstanceDeleteDBInstanceRequestNonProduction() throws IOException {
    setupDevelopmentConfig();
    DeleteDBInstanceRequest expectedReq = new DeleteDBInstanceRequest();
    expectedReq.setDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
    expectedReq.setSkipFinalSnapshot(Boolean.TRUE);
    DeleteDBInstanceRequest req = databaseSetup.buildStackInstanceDeleteDBInstanceRequest();
    assertEquals(expectedReq, req);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) Test(org.junit.Test)

Example 5 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetup method buildIdGeneratorDeleteDBInstanceRequest.

/*
	 * NOTE: Do not call unless deleting shared resources!!!
	 */
DeleteDBInstanceRequest buildIdGeneratorDeleteDBInstanceRequest() {
    DeleteDBInstanceRequest req = new DeleteDBInstanceRequest();
    req.setDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier());
    if (config.isProductionStack()) {
        req.setSkipFinalSnapshot(Boolean.FALSE);
        // TODO: Come up with better name for final snapshot
        req.setFinalDBSnapshotIdentifier(config.getStack() + config.getStackInstance());
    } else {
        req.setSkipFinalSnapshot(Boolean.TRUE);
    }
    return req;
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest)

Aggregations

DeleteDBInstanceRequest (com.amazonaws.services.rds.model.DeleteDBInstanceRequest)9 Test (org.junit.Test)6 DBInstance (com.amazonaws.services.rds.model.DBInstance)3 DBInstanceNotFoundException (com.amazonaws.services.rds.model.DBInstanceNotFoundException)1