<commit_before>var novaform = require('novaform')
    , Template = require('./template')
    , _ = require('underscore');

/**
    Refs include:
    - subnet-group: rds.DBSubnetGroup
    - instance: rds.DBInstance
**/
function Rds(options) {
    if (!(this instanceof Rds)) {
        return new Rds(options);
    }

    Template.call(this);

    var subnets = options.subnets;
    var name = options.name || 'mydb';
    var allocatedStorage = options.allocatedStorage || 5;
    var multiAz = typeof options.multiAz === 'boolean' ? options.multiAz : true;
    var availabilityZone = options.availabilityZone = 'None';
    var instanceClass = options.instanceClass || 'db.t1.micro';
    var username = options.username || 'root';
    var password = options.password || '<PASSWORD>';

    var originalName = name;
    name = name.charAt(0).toUpperCase() + name.slice(1);

    function mkname(str) {
        return name + str;
    }

    var subnetGroup = this._addResource(novaform.rds.DBSubnetGroup(mkname('PrivateSubnet'), {
        DBSubnetGroupDescription: originalName + ' db private subnets',
        SubnetIds: subnets,
        Tags: {
            Application: novaform.refs.StackId,
            Name: novaform.join('-', [novaform.refs.StackName, mkname('PrivateSubnet')])
        }
    }));

    var dbinstance = this._addResource(novaform.rds.DBInstance(mkname('Instance'), {
        AllocatedStorage: allocatedStorage,
        DBInstanceClass: instanceClass,
        DBName: originalName,
        DBSubnetGroupName: subnetGroup,
        Engine: 'postgres',
        EngineVersion: '9.3.3',
        MasterUsername: username,
        MasterPassword: password,
        Tags: {
            Application: novaform.refs.StackId,
            Name: novaform.join('-', [novaform.refs.StackName, mkname('Instance')])
        }<commit_msg>Fixed RDS deployment<commit_after>var novaform = require('novaform')
    , Template = require('./template')
    , _ = require('underscore');

/**
    Refs include:
    - subnet-group: rds.DBSubnetGroup
    - instance: rds.DBInstance
**/
function Rds(options) {
    if (!(this instanceof Rds)) {
        return new Rds(options);
    }

    Template.call(this);

    var subnets = options.subnets;
    var name = options.name || 'mydb';
    var allocatedStorage = options.allocatedStorage || 5;
    var multiAz = typeof options.multiAz === 'boolean' ? options.multiAz : true;
    var availabilityZone = options.availabilityZone = 'None';
    var instanceClass = options.instanceClass || 'db.t1.micro';
    var username = options.username || 'root';
    var password = options.password;

    if (typeof password !== 'string') {
        throw new Error('RDS password was not specified');
    }
    if (password.length < 8) {
        throw new Error('RDS password has to be at least 8 characters');
    }

    var originalName = name;
    name = name.charAt(0).toUpperCase() + name.slice(1);

    function mkname(str) {
        return name + str;
    }

    var subnetGroup = this._addResource(novaform.rds.DBSubnetGroup(mkname('PrivateSubnet'), {
        DBSubnetGroupDescription: originalName + ' db private subnets',
        SubnetIds: subnets,
        Tags: {
            Application: novaform.refs.StackId,
            Name: novaform.join('-', [novaform.refs.StackName, mkname('PrivateSubnet')])
        }
    }));

    var dbinstance = this._addResource(novaform.rds.DBInstance(mkname('Instance'), {
        AllocatedStorage: allocatedStorage,
        DBInstanceClass: instanceClass,
        DBName: originalName,
        DBSubnetGroupName: subnetGroup,
        Engine: 'postgres',
        EngineVersion: '9.3.3',
        MasterUsername: username,
        MasterUserPassword: password,
        Tags: {
            Application: novaform.refs.StackId,
            Name: novaform.join('-', [novaform.refs.StackName, mkname('Instance')])
        }
{'fraction_non_alphanumeric': 0.12664431261284498, 'fraction_numerical': 0.0041269022440030955, 'mean_word_length': 2.8169291338582676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4581569', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1149, 'n_words': 246}