Search in sources :

Example 1 with DBInstance

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);
}
Also used : DBInstance(com.amazonaws.services.rds.model.DBInstance) ArrayList(java.util.ArrayList) DescribeDBInstancesResult(com.amazonaws.services.rds.model.DescribeDBInstancesResult) DescribeDBInstancesRequest(com.amazonaws.services.rds.model.DescribeDBInstancesRequest)

Example 2 with DBInstance

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);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) DBInstance(com.amazonaws.services.rds.model.DBInstance)

Example 3 with DBInstance

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));
}
Also used : DBInstance(com.amazonaws.services.rds.model.DBInstance)

Example 4 with DBInstance

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);
}
Also used : DBInstance(com.amazonaws.services.rds.model.DBInstance)

Example 5 with DBInstance

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);
}
Also used : DBInstance(com.amazonaws.services.rds.model.DBInstance) ArrayList(java.util.ArrayList) GeneratedResources(org.sagebionetworks.stack.GeneratedResources) Before(org.junit.Before)

Aggregations

DBInstance (com.amazonaws.services.rds.model.DBInstance)16 DescribeDBInstancesRequest (com.amazonaws.services.rds.model.DescribeDBInstancesRequest)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 DeleteDBInstanceRequest (com.amazonaws.services.rds.model.DeleteDBInstanceRequest)3 DescribeDBInstancesResult (com.amazonaws.services.rds.model.DescribeDBInstancesResult)3 ArgumentCaptor (org.mockito.ArgumentCaptor)3 CreateDBInstanceRequest (com.amazonaws.services.rds.model.CreateDBInstanceRequest)2 DomainStatus (com.amazonaws.services.cloudsearchv2.model.DomainStatus)1 ServiceEndpoint (com.amazonaws.services.cloudsearchv2.model.ServiceEndpoint)1 DescribeAlarmsResult (com.amazonaws.services.cloudwatch.model.DescribeAlarmsResult)1 PutMetricAlarmRequest (com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)1 KeyPairInfo (com.amazonaws.services.ec2.model.KeyPairInfo)1 ApplicationVersionDescription (com.amazonaws.services.elasticbeanstalk.model.ApplicationVersionDescription)1 ServerCertificateMetadata (com.amazonaws.services.identitymanagement.model.ServerCertificateMetadata)1 DBInstanceNotFoundException (com.amazonaws.services.rds.model.DBInstanceNotFoundException)1 Endpoint (com.amazonaws.services.rds.model.Endpoint)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 Before (org.junit.Before)1