Class: CfFactory::CfAsGroup
- Inherits:
-
Object
- Object
- CfFactory::CfAsGroup
show all
- Includes:
- CfBase
- Defined in:
- lib/cf_factory/as/cf_as_group.rb
Instance Method Summary
collapse
Methods included from CfBase
#generate, #generate_ref, #get_deletion_policy, #get_name, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes
Constructor Details
#initialize(name, availability_zones, launch_config, load_balancers, max_size, min_size, options) ⇒ CfAsGroup
Returns a new instance of CfAsGroup.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 8
def initialize(name, availability_zones, launch_config, load_balancers, max_size, min_size, options)
@name = name
@availability_zones = availability_zones
@launch_config = launch_config
@load_balancers = load_balancers
@max_size = max_size
@min_size = min_size
@cooldown = options[:cooldown]
@desired_capacity = options[:desired_capacity]
@health_check_grace_period = options[:health_check_grace_period]
@health_check_type = options[:health_check_type]
@subnets = options[:subnets]
validate()
end
|
Instance Method Details
#add_egress_rule(egress_rule) ⇒ Object
72
73
74
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 72
def add_egress_rule(egress_rule)
@egress_rules << egress_rule
end
|
#add_ingress_rule(ingress_rule) ⇒ Object
68
69
70
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 68
def add_ingress_rule(ingress_rule)
@ingress_rules << ingress_rule
end
|
#get_cf_attributes ⇒ Object
49
50
51
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 49
def get_cf_attributes
{}
end
|
#get_cf_properties ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 53
def get_cf_properties
result = {"AvailabilityZones" => @availability_zones,
"LaunchConfigurationName" => @launch_config.generate_ref,
"LoadBalancerNames" => CfHelper.generate_ref_array(@load_balancers),
"MaxSize" => @max_size,
"MinSize" => @min_size
}
result["Cooldown"] = @cooldown unless @cooldown.nil?
result["DesiredCapacity"] = @desired_capacity unless @desired_capacity.nil?
result["HealthCheckGracePeriod"] = @health_check_grace_period.to_i unless @health_check_grace_period.nil?
result["HealthCheckType"] = @health_check_type unless @health_check_type.nil?
result["VPCZoneIdentifier"] = CfHelper.generate_ref_array(@subnets) unless @subnets.nil?
result
end
|
#get_cf_type ⇒ Object
45
46
47
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 45
def get_cf_type
"AWS::AutoScaling::AutoScalingGroup"
end
|
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 25
def set_tags(tag_list)
@tag_list = []
tag_list.each() {|tg|
tg2 = tg.clone
tg2.set_propagate_at_launch(true)
puts ">>>>>>>>>>>>>>>>>>>>> "+tg2.inspect
@tag_list << tg2
}
@tag_list
end
|
#validate ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 36
def validate
if @max_size < @min_size
raise Exception.new("max size (#{@max_size}) must be equal or larger min size (#{@min_size})")
end
if @health_check_type == "ELB" && @health_check_grace_period.nil?
raise Exception.new("HealthCheckGracePeriod must be specified for ElasticLoadBalancer based health checks.")
end
end
|