use of com.amazonaws.services.rds.model.DBInstance in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetup method describeResources.
public void describeResources() {
DescribeDBInstancesRequest req;
DescribeDBInstancesResult res;
req = buildIdGeneratorDescribeDBInstanceRequest();
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
resources.setIdGeneratorDatabase(res.getDBInstances().get(0));
}
req = buildStackInstanceDescribeDBInstanceRequest();
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
resources.setStackInstancesDatabase(res.getDBInstances().get(0));
}
// TODO: Describe table DB instances
List<DBInstance> descDbInstResults = new ArrayList<DBInstance>();
int numTableInstances = Integer.parseInt(this.config.getNumberTableInstances());
for (int i = 0; i < numTableInstances; i++) {
req = buildStackTableDBInstanceDescribeDBInstanceRequest(i);
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
descDbInstResults.add(res.getDBInstances().get(0));
}
}
resources.setStackInstanceTablesDatabases(descDbInstResults);
}
use of com.amazonaws.services.rds.model.DBInstance 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);
}
use of com.amazonaws.services.rds.model.DBInstance in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetup method describeResources.
public void describeResources() {
// This is the topic where all alarm notification are sent
String topicArn = resources.getStackInstanceNotificationTopicArn();
// setup the alarms for the id generator
DBInstance instance = resources.getIdGeneratorDatabase();
resources.setIdGeneratorDatabaseAlarms(describeAllAlarmsForDatabase(instance));
// setup the alarms for the stack instances database.
instance = resources.getStackInstancesDatabase();
resources.setStackInstancesDatabaseAlarms(describeAllAlarmsForDatabase(instance));
}
use of com.amazonaws.services.rds.model.DBInstance in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetup method deleteAllAlarms.
/**
* Delete all alarms.
*/
public void deleteAllAlarms() {
DBInstance instance;
// Delete the alarms for the stack instances database.
instance = resources.getStackInstancesDatabase();
deleteAllAlarmsForDatabase(instance);
}
use of com.amazonaws.services.rds.model.DBInstance in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetupTest method before.
@Before
public void before() throws IOException {
databaseIdentifer = "db-id-foo";
dbInstance = new DBInstance().withDBInstanceClass(DATABASE_INSTANCE_CLASS_M1_SMALL).withDBInstanceIdentifier(databaseIdentifer);
// Give this 10 GB
dbInstance.setAllocatedStorage(10);
topicArn = "arn:123:456";
config = TestHelper.createTestConfig("dev");
mockClient = factory.createCloudWatchClient();
resources = new GeneratedResources();
resources.setStackInstanceNotificationTopicArn(topicArn);
resources.setStackInstancesDatabase(new DBInstance().withAllocatedStorage(50).withDBInstanceClass(DATABASE_INSTANCE_CLASS_M1_SMALL).withDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier()));
resources.setIdGeneratorDatabase(new DBInstance().withAllocatedStorage(10).withDBInstanceClass(DATABASE_INSTANCE_CLASS_M1_SMALL).withDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier()));
List<DBInstance> stackInstanceTablesDatabases = new ArrayList<DBInstance>();
int numTableInstances = Integer.parseInt(config.getNumberTableInstances());
for (int i = 0; i < numTableInstances; i++) {
DBInstance stackInstanceDatabase = new DBInstance().withAllocatedStorage(10).withDBInstanceClass(DATABASE_INSTANCE_CLASS_M1_SMALL).withDBInstanceIdentifier(config.getStackTableDBInstanceDatabaseIdentifier(i));
stackInstanceTablesDatabases.add(stackInstanceDatabase);
}
resources.setStackInstanceTablesDatabases(stackInstanceTablesDatabases);
setup = new RdsAlarmSetup(factory, config, resources);
}
Aggregations