Class: CfFactory::CfRdsInstance

Inherits:
Object
  • Object
show all
Includes:
CfBase
Defined in:
lib/cf_factory/rds/cf_rds_instance.rb

Constant Summary collapse

VALID_TYPES =
["db.t1.micro", "db.m1.small","db.m1.medium","db.m1.large","db.m1.xlarge","db.m2.xlarge","db.m2.2xlarge","db.m2.4xlarge"]

Instance Method Summary collapse

Methods included from CfBase

#generate, #generate_ref, #get_deletion_policy, #get_name, #get_update_policy, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes, #set_tags

Constructor Details

#initialize(name, allocated_storage, engine, db_instance_class, master_username, master_userpassword, options = {}) ⇒ CfRdsInstance

Returns a new instance of CfRdsInstance.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cf_factory/rds/cf_rds_instance.rb', line 9

def initialize(name, allocated_storage, engine, db_instance_class, master_username, master_userpassword, options = {})
  @name = name
  @allocated_storage = allocated_storage
  @db_instance_class = db_instance_class
  @engine = engine
  @master_username = master_username
  @master_userpassword = master_userpassword
  @multi_az = options[:multi_az]
  @security_groups = options[:security_groups]
  @subnet_group = options[:subnet_group]
  validate()
end

Instance Method Details

#add_rule(ingress_rule) ⇒ Object



42
43
44
# File 'lib/cf_factory/rds/cf_rds_instance.rb', line 42

def add_rule(ingress_rule)
  @rules << ingress_rule
end

#get_cf_attributesObject



26
27
28
# File 'lib/cf_factory/rds/cf_rds_instance.rb', line 26

def get_cf_attributes
  {}
end

#get_cf_propertiesObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cf_factory/rds/cf_rds_instance.rb', line 30

def get_cf_properties
  result = {"AllocatedStorage" => @allocated_storage, 
    "DBInstanceClass" => @db_instance_class, 
    "Engine" => @engine, "MasterUsername" => @master_username,
    "MasterUserPassword" => @master_userpassword
  }
  result["MultiAZ"] = @multi_az unless @multi_az.nil?
  result["DBSecurityGroups"] = CfHelper.generate_ref_array(@security_groups) unless @security_groups.nil?
  result["DBSubnetGroupName"] = @subnet_group.generate_ref unless @subnet_group.nil?
  result
end

#get_cf_typeObject



22
23
24
# File 'lib/cf_factory/rds/cf_rds_instance.rb', line 22

def get_cf_type
  "AWS::RDS::DBInstance"
end