Example usage for com.amazonaws.services.rds AmazonRDS createDBInstance

List of usage examples for com.amazonaws.services.rds AmazonRDS createDBInstance

Introduction

In this page you can find the example usage for com.amazonaws.services.rds AmazonRDS createDBInstance.

Prototype

DBInstance createDBInstance(CreateDBInstanceRequest createDBInstanceRequest);

Source Link

Document

Creates a new DB instance.

Usage

From source file:jp.classmethod.aws.gradle.rds.AmazonRDSCreateDBInstanceTask.java

License:Apache License

@TaskAction
public void createDBInstance() {
    // to enable conventionMappings feature
    String dbInstanceIdentifier = getDbInstanceIdentifier();
    String dbInstanceClass = getDbInstanceClass();
    String engine = getEngine();// w  ww. j a  va2s. c om

    if (dbInstanceClass == null) {
        throw new GradleException("dbInstanceClass is required");
    }
    if (dbInstanceIdentifier == null) {
        throw new GradleException("dbInstanceIdentifier is required");
    }
    if (engine == null) {
        throw new GradleException("engine is required");
    }

    AmazonRDSPluginExtension ext = getProject().getExtensions().getByType(AmazonRDSPluginExtension.class);
    AmazonRDS rds = ext.getClient();

    CreateDBInstanceRequest request = new CreateDBInstanceRequest().withDBName(getDbName())
            .withDBInstanceIdentifier(dbInstanceIdentifier).withAllocatedStorage(getAllocatedStorage())
            .withDBInstanceClass(dbInstanceClass).withEngine(engine).withMasterUsername(getMasterUsername())
            .withMasterUserPassword(getMasterUserPassword()).withVpcSecurityGroupIds(getVpcSecurityGroupIds())
            .withDBSubnetGroupName(getDbSubnetGroupName())
            .withPreferredMaintenanceWindow(getPreferredMaintenanceWindow())
            .withDBParameterGroupName(getDbParameterGroupName())
            .withBackupRetentionPeriod(getBackupRetentionPeriod())
            .withPreferredBackupWindow(getPreferredBackupWindow()).withPort(getPort()).withMultiAZ(getMultiAZ())
            .withEngineVersion(getEngineVersion()).withAutoMinorVersionUpgrade(getAutoMinorVersionUpgrade())
            .withLicenseModel(getLicenseModel()).withIops(getIops()).withOptionGroupName(getOptionGroupName())
            .withPubliclyAccessible(getPubliclyAccessible()).withCharacterSetName(getCharacterSetName())
            .withStorageType(getStorageType()).withTdeCredentialArn(getTdeCredentialArn())
            .withTdeCredentialPassword(getTdeCredentialPassword()).withStorageEncrypted(getStorageEncrypted())
            .withKmsKeyId(getKmsKeyId());
    dbInstance = rds.createDBInstance(request);
    getLogger().info("Create RDS instance requested: {}", dbInstance.getDBInstanceIdentifier());
}

From source file:jp.classmethod.aws.gradle.rds.AmazonRDSMigrateDBInstanceTask.java

License:Apache License

private void createDBInstance(AmazonRDS rds) {
    // to enable conventionMappings feature
    String dbInstanceIdentifier = getDbInstanceIdentifier();
    String dbInstanceClass = getDbInstanceClass();
    String engine = getEngine();/*from  w  ww .  j  a  v  a 2 s .co m*/

    if (dbInstanceClass == null) {
        throw new GradleException("dbInstanceClass is required");
    }
    if (dbInstanceIdentifier == null) {
        throw new GradleException("dbInstanceIdentifier is required");
    }
    if (engine == null) {
        throw new GradleException("engine is required");
    }

    CreateDBInstanceRequest request = new CreateDBInstanceRequest().withDBName(getDbName())
            .withDBInstanceIdentifier(dbInstanceIdentifier).withAllocatedStorage(getAllocatedStorage())
            .withDBInstanceClass(dbInstanceClass).withEngine(engine).withMasterUsername(getMasterUsername())
            .withMasterUserPassword(getMasterUserPassword()).withVpcSecurityGroupIds(getVpcSecurityGroupIds())
            .withDBSubnetGroupName(getDbSubnetGroupName())
            .withPreferredMaintenanceWindow(getPreferredMaintenanceWindow())
            .withDBParameterGroupName(getDbParameterGroupName())
            .withBackupRetentionPeriod(getBackupRetentionPeriod())
            .withPreferredBackupWindow(getPreferredBackupWindow()).withPort(getPort()).withMultiAZ(getMultiAZ())
            .withEngineVersion(getEngineVersion()).withAutoMinorVersionUpgrade(getAutoMinorVersionUpgrade())
            .withLicenseModel(getLicenseModel()).withIops(getIops()).withOptionGroupName(getOptionGroupName())
            .withPubliclyAccessible(getPubliclyAccessible()).withCharacterSetName(getCharacterSetName())
            .withStorageType(getStorageType()).withTdeCredentialArn(getTdeCredentialArn())
            .withTdeCredentialPassword(getTdeCredentialPassword()).withStorageEncrypted(getStorageEncrypted())
            .withKmsKeyId(getKmsKeyId());
    dbInstance = rds.createDBInstance(request);
    getLogger().info("Create RDS instance requested: {}", dbInstance.getDBInstanceIdentifier());
}

From source file:org.xmlsh.aws.gradle.rds.AmazonRDSCreateDBInstanceTask.java

License:BSD License

@TaskAction
public void createDBInstance() {
    // to enable conventionMappings feature
    String dbInstanceIdentifier = getDbInstanceIdentifier();
    String dbInstanceClass = getDbInstanceClass();
    String engine = getEngine();//from   w w  w .  ja  v a  2s.c  om

    if (dbInstanceClass == null)
        throw new GradleException("dbInstanceClass is required");
    if (dbInstanceIdentifier == null)
        throw new GradleException("dbInstanceIdentifier is required");
    if (engine == null)
        throw new GradleException("engine is required");

    AmazonRDSPluginExtension ext = getProject().getExtensions().getByType(AmazonRDSPluginExtension.class);
    AmazonRDS rds = ext.getClient();

    CreateDBInstanceRequest request = new CreateDBInstanceRequest().withDBName(getDbName())
            .withDBInstanceIdentifier(dbInstanceIdentifier).withAllocatedStorage(getAllocatedStorage())
            .withDBInstanceClass(dbInstanceClass).withEngine(engine).withMasterUsername(getMasterUsername())
            .withMasterUserPassword(getMasterUserPassword()).withVpcSecurityGroupIds(getVpcSecurityGroupIds())
            .withDBSubnetGroupName(getDbSubnetGroupName())
            .withPreferredMaintenanceWindow(getPreferredMaintenanceWindow())
            .withDBParameterGroupName(getDbParameterGroupName())
            .withBackupRetentionPeriod(getBackupRetentionPeriod())
            .withPreferredBackupWindow(getPreferredBackupWindow()).withPort(getPort()).withMultiAZ(getMultiAZ())
            .withEngineVersion(getEngineVersion()).withAutoMinorVersionUpgrade(getAutoMinorVersionUpgrade())
            .withLicenseModel(getLicenseModel()).withIops(getIops()).withOptionGroupName(getOptionGroupName())
            .withPubliclyAccessible(getPubliclyAccessible()).withCharacterSetName(getCharacterSetName())
            .withStorageType(getStorageType()).withTdeCredentialArn(getTdeCredentialArn())
            .withTdeCredentialPassword(getTdeCredentialPassword()).withStorageEncrypted(getStorageEncrypted())
            .withKmsKeyId(getKmsKeyId());
    dbInstance = rds.createDBInstance(request);
    getLogger().info("Create RDS instance requested: {}", dbInstance.getDBInstanceIdentifier());
}

From source file:org.xmlsh.aws.gradle.rds.AmazonRDSMigrateDBInstanceTask.java

License:BSD License

private void createDBInstance(AmazonRDS rds) {
    // to enable conventionMappings feature
    String dbInstanceIdentifier = getDbInstanceIdentifier();
    String dbInstanceClass = getDbInstanceClass();
    String engine = getEngine();/*from   ww  w .jav a  2  s .com*/

    if (dbInstanceClass == null)
        throw new GradleException("dbInstanceClass is required");
    if (dbInstanceIdentifier == null)
        throw new GradleException("dbInstanceIdentifier is required");
    if (engine == null)
        throw new GradleException("engine is required");

    CreateDBInstanceRequest request = new CreateDBInstanceRequest().withDBName(getDbName())
            .withDBInstanceIdentifier(dbInstanceIdentifier).withAllocatedStorage(getAllocatedStorage())
            .withDBInstanceClass(dbInstanceClass).withEngine(engine).withMasterUsername(getMasterUsername())
            .withMasterUserPassword(getMasterUserPassword()).withVpcSecurityGroupIds(getVpcSecurityGroupIds())
            .withDBSubnetGroupName(getDbSubnetGroupName())
            .withPreferredMaintenanceWindow(getPreferredMaintenanceWindow())
            .withDBParameterGroupName(getDbParameterGroupName())
            .withBackupRetentionPeriod(getBackupRetentionPeriod())
            .withPreferredBackupWindow(getPreferredBackupWindow()).withPort(getPort()).withMultiAZ(getMultiAZ())
            .withEngineVersion(getEngineVersion()).withAutoMinorVersionUpgrade(getAutoMinorVersionUpgrade())
            .withLicenseModel(getLicenseModel()).withIops(getIops()).withOptionGroupName(getOptionGroupName())
            .withPubliclyAccessible(getPubliclyAccessible()).withCharacterSetName(getCharacterSetName())
            .withStorageType(getStorageType()).withTdeCredentialArn(getTdeCredentialArn())
            .withTdeCredentialPassword(getTdeCredentialPassword()).withStorageEncrypted(getStorageEncrypted())
            .withKmsKeyId(getKmsKeyId());
    dbInstance = rds.createDBInstance(request);
    getLogger().info("Create RDS instance requested: {}", dbInstance.getDBInstanceIdentifier());
}