Class: CfMain

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_factory/base/cf_main.rb

Instance Method Summary collapse

Constructor Details

#initialize(description, version = "2010-09-09") ⇒ CfMain

Returns a new instance of CfMain.



2
3
4
5
6
7
8
9
# File 'lib/cf_factory/base/cf_main.rb', line 2

def initialize(description, version = "2010-09-09")
  @description = description
  @version = version
  @mappings = []
  @parameters = []
  @outputs = []
  @resources = []
end

Instance Method Details

#add_elb(elb) ⇒ Object



22
23
24
# File 'lib/cf_factory/base/cf_main.rb', line 22

def add_elb(elb)
  @resources << elb
end

#add_mapping(mapping) ⇒ Object



26
27
28
# File 'lib/cf_factory/base/cf_main.rb', line 26

def add_mapping(mapping)
  @mappings << mapping
end

#add_output(parameter) ⇒ Object



34
35
36
# File 'lib/cf_factory/base/cf_main.rb', line 34

def add_output(parameter)
  @outputs << parameter
end

#add_parameter(parameter) ⇒ Object



30
31
32
# File 'lib/cf_factory/base/cf_main.rb', line 30

def add_parameter(parameter)
  @parameters << parameter
end

#add_resource(resource) ⇒ Object



38
39
40
# File 'lib/cf_factory/base/cf_main.rb', line 38

def add_resource(resource)
  @resources << resource
end

#add_vpc(vpc) ⇒ Object



18
19
20
# File 'lib/cf_factory/base/cf_main.rb', line 18

def add_vpc(vpc)
  @resources << vpc
end

#apply_tags_to_all_resources(tag_list) ⇒ Object

Go through all resources and tag them with the specified array of tags.



12
13
14
15
16
# File 'lib/cf_factory/base/cf_main.rb', line 12

def apply_tags_to_all_resources(tag_list)
  @resources.each() {|resource|
    resource.set_tags(tag_list)
  }
end

#generateObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cf_factory/base/cf_main.rb', line 42

def generate()
  @result = "{\n"
  generate_version
  generate_description
  generate_parameters
  generate_mappings unless @mappings.size == 0
  generate_resources
  generate_outputs
  @result += "}\n"
  @result
end