Class: CfFactory::CfRdsSecurityGroup

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

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, description, vpc = nil) ⇒ CfRdsSecurityGroup

Returns a new instance of CfRdsSecurityGroup.



8
9
10
11
12
13
# File 'lib/cf_factory/rds/cf_rds_security_group.rb', line 8

def initialize(name, description, vpc = nil)
  @name = name
  @description = description
  @vpc = vpc
  @rules = []
end

Instance Method Details

#add_rule(ingress_rule) ⇒ Object



30
31
32
# File 'lib/cf_factory/rds/cf_rds_security_group.rb', line 30

def add_rule(ingress_rule)
  @rules << ingress_rule
end

#get_cf_attributesObject



19
20
21
# File 'lib/cf_factory/rds/cf_rds_security_group.rb', line 19

def get_cf_attributes
  {}
end

#get_cf_propertiesObject



23
24
25
26
27
28
# File 'lib/cf_factory/rds/cf_rds_security_group.rb', line 23

def get_cf_properties
  rules_array = CfHelper.generate_inner_array(@rules)
  result = {"GroupDescription" => @description, "DBSecurityGroupIngress" => rules_array}
  result["EC2VpcId"] = @vpc.generate_ref unless @vpc.nil?
  result
end

#get_cf_typeObject



15
16
17
# File 'lib/cf_factory/rds/cf_rds_security_group.rb', line 15

def get_cf_type
  "AWS::RDS::DBSecurityGroup"
end