Java 类com.amazonaws.services.rds.model.CreateDBInstanceRequest 实例源码

项目:obevo    文件:CreateDbInstance.java   
public void createOracle(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("oracle-se2")
            //.withEngineVersion("12.1.0.2.v8")
            .withLicenseModel("license-included")
            .withAllocatedStorage(10)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            .withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
项目:obevo    文件:CreateDbInstance.java   
public void createPostgresql(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("postgres")
            .withEngineVersion("9.6.2")
            .withLicenseModel("postgresql-license")
            .withAllocatedStorage(5)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            .withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
项目:obevo    文件:CreateDbInstance.java   
public void createSqlServer(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("sqlserver-ex")
            .withEngineVersion("13.00.2164.0.v1")
            .withLicenseModel("license-included")
            .withAllocatedStorage(20)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            //.withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
项目:director-aws-plugin    文件:RDSProvider.java   
@Override
public void allocate(RDSInstanceTemplate template, Collection<String> virtualInstanceIds,
    int minCount) throws InterruptedException {
  int instanceCount = virtualInstanceIds.size();

  LOG.info(">> Requesting {} instances for {}", instanceCount, template);
  for (String virtualInstanceId : virtualInstanceIds) {
    CreateDBInstanceRequest request = buildCreateRequest(template, virtualInstanceId);
    client.createDBInstance(request);
  }
}
项目:director-aws-plugin    文件:RDSProvider.java   
/**
 * Returns a DB instance request based on the specified template.
 *
 * @param template          the template
 * @param virtualInstanceId the virtual instance ID
 * @return a DB instance request based on the specified template
 */
private CreateDBInstanceRequest buildCreateRequest(RDSInstanceTemplate template,
    String virtualInstanceId) {
  CreateDBInstanceRequest request = new CreateDBInstanceRequest()
      .withDBInstanceIdentifier(virtualInstanceId)
      .withDBInstanceClass(template.getInstanceClass())
      .withDBSubnetGroupName(template.getDbSubnetGroupName())
      .withVpcSecurityGroupIds(template.getVpcSecurityGroupIds())
      .withPubliclyAccessible(associatePublicIpAddresses)
      .withAllocatedStorage(template.getAllocatedStorage())
      .withEngine(template.getEngine())
      .withMasterUsername(template.getAdminUser())
      .withMasterUserPassword(template.getAdminPassword())  // masterPassword in AWS SDK 1.9+
      .withTags(convertToTags(template, virtualInstanceId));

  if (template.getEngineVersion().isPresent()) {
    request = request.withEngineVersion(template.getEngineVersion().get());
  }
  if (template.getAvailabilityZone().isPresent()) {
    request = request.withAvailabilityZone(template.getAvailabilityZone().get());
  }
  if (template.getAutoMinorVersionUpgrade().isPresent()) {
    request = request.withAutoMinorVersionUpgrade(template.getAutoMinorVersionUpgrade().get());
  }
  if (template.getBackupRetentionPeriod().isPresent()) {
    request = request.withBackupRetentionPeriod(template.getBackupRetentionPeriod().get());
  }
  if (template.getDbName().isPresent()) {
    request = request.withDBName(template.getDbName().get());
  }
  if (template.getDbParameterGroupName().isPresent()) {
    request = request.withDBParameterGroupName(template.getDbParameterGroupName().get());
  }
  if (template.getEngineVersion().isPresent()) {
    request = request.withEngineVersion(template.getEngineVersion().get());
  }
  if (template.getLicenseModel().isPresent()) {
    request = request.withLicenseModel(template.getLicenseModel().get());
  }
  if (template.isMultiAZ().isPresent()) {
    request = request.withMultiAZ(template.isMultiAZ().get());
  }
  if (template.getOptionGroupName().isPresent()) {
    request = request.withOptionGroupName(template.getOptionGroupName().get());
  }
  if (template.getPort().isPresent()) {
    request = request.withPort(template.getPort().get());
  }
  if (template.getPreferredBackupWindow().isPresent()) {
    request = request.withPreferredBackupWindow(template.getPreferredBackupWindow().get());
  }
  if (template.getPreferredMaintenanceWindow().isPresent()) {
    request =
        request.withPreferredMaintenanceWindow(template.getPreferredMaintenanceWindow().get());
  }
  if (template.isPubliclyAccessible().isPresent()) {
    request = request.withPubliclyAccessible(template.isPubliclyAccessible().get());
  }
  if (template.isStorageEncrypted().isPresent()) {
    request = request.withStorageEncrypted(template.isStorageEncrypted().get());
  }

  return request;
}
项目:DeployMan    文件:Launcher.java   
private DBInstance runDatabaseLaunch(Formation formation) {
  Rds rdsClient = new Rds();

  // if ( true )
  // return null;

  Database database = formation.getDatabase();
  DBInstance dbInstance = null;

  if (rdsClient.databaseExists(database.getInstanceIdentifier())) {
    this.console.writeNl("Database already exists");
    dbInstance = rdsClient.getDatabase(database.getInstanceIdentifier());
  } else {
    this.console.writeNl("Create database");

    CreateDBInstanceRequest request =
        new CreateDBInstanceRequest().withEngine(database.getEngine())
            .withEngineVersion(database.getEngineVersion())
            .withLicenseModel(database.getLicense())
            .withDBInstanceClass(database.getInstanceClass()).withMultiAZ(database.getMultiAz())
            .withAutoMinorVersionUpgrade(database.getAutoMinorVersionUpgrade())
            .withAllocatedStorage(database.getAllocatedStorage())
            .withDBInstanceIdentifier(database.getInstanceIdentifier())
            .withMasterUsername(database.getUsername())
            .withMasterUserPassword(database.getPassword()).withDBName(database.getName())
            .withPort(database.getPort());
    // .withVpcSecurityGroupIds( database.getSecurityGroup() );

    dbInstance = rdsClient.getClient().createDBInstance(request);
  }

  this.console.writeNl("Starting...");

  waitForDatabaseState(dbInstance.getDBInstanceIdentifier(), "available");

  // sleep 10 seconds to get it really ready...
  // no idea why the state 'available isn't enough
  sleep(10000);

  dbInstance = rdsClient.getDatabase(dbInstance.getDBInstanceIdentifier());
  runSetup(dbInstance, database);
  return dbInstance;
}
项目:cloudml    文件:BeanstalkConnector.java   
public void createDBInstance(String engine, String version, String dbInstanceIdentifier, String dbName, String username, String password,
                             Integer allocatedSize, String dbInstanceClass, String securityGroup) {

    if(allocatedSize<=0)   //default minimal size for rds
        allocatedSize = 5;

    String groupName = dbInstanceIdentifier + "-security-group";
    CreateDBSecurityGroupRequest csg = new CreateDBSecurityGroupRequest()
            .withDBSecurityGroupName(groupName)
            .withDBSecurityGroupDescription(groupName);


    try {
        rdsClient.createDBSecurityGroup(csg);
    } catch (Exception e) {
        journal.log(Level.INFO, ">> Security Group " + groupName + " already exists.");
    }


    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withDBName(null)
            .withAllocatedStorage(allocatedSize)
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            .withDBName(dbName)
            .withMasterUsername(username)
            .withMasterUserPassword(password)
            .withEngine(engine)
            .withPubliclyAccessible(true)
            .withEngineVersion(version);
    request.getDBSecurityGroups().add(groupName);
    if(!securityGroup.equals(""))
        request.getDBSecurityGroups().add(securityGroup);

    previousRequests.put(dbInstanceIdentifier, request);
    if (dbInstanceClass == null || dbInstanceClass.length() == 0) {
        request.setDBInstanceClass("db.t1.micro");
    } else {
        request.setDBInstanceClass(dbInstanceClass);
    }
    DBInstance instance = rdsClient.createDBInstance(request);
    journal.log(Level.INFO, String.format(">> RDS instance created: %s, at %s", instance.toString(),instance.getEndpoint()));

    createdInstances.put(dbInstanceIdentifier, instance);

}