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, #get_update_policy, #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
75
76
77
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 75
def add_egress_rule(egress_rule)
@egress_rules << egress_rule
end
|
#add_ingress_rule(ingress_rule) ⇒ Object
71
72
73
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 71
def add_ingress_rule(ingress_rule)
@ingress_rules << ingress_rule
end
|
#get_cf_attributes ⇒ Object
52
53
54
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 52
def get_cf_attributes
{}
end
|
#get_cf_properties ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 56
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
48
49
50
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 48
def get_cf_type
"AWS::AutoScaling::AutoScalingGroup"
end
|
25
26
27
28
29
30
31
32
33
|
# 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)
@tag_list << tg2
}
@tag_list
end
|
#set_update_policy(update_policy) ⇒ Object
35
36
37
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 35
def set_update_policy(update_policy)
@update_policy = update_policy
end
|
#validate ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/cf_factory/as/cf_as_group.rb', line 39
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
|