Class: Topo::Provision::AwsAutoScalingGroupGenerator
- Inherits:
-
ResourceGenerator
- Object
- ResourceGenerator
- Topo::Provision::AwsAutoScalingGroupGenerator
- Extended by:
- Topo::ParseGen
- Defined in:
- lib/topo/provision/aws/generators/aws_auto_scaling_group.rb
Instance Attribute Summary
Attributes inherited from ResourceGenerator
#name, #resource_attributes, #resource_type, #undeploy_action
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ AwsAutoScalingGroupGenerator
constructor
A new instance of AwsAutoScalingGroupGenerator.
Methods included from Topo::ParseGen
convert_keys_to_sym, convert_keys_to_sym_deep, expand_ref, lazy_attribute_to_s, topo_refs, value_from_path
Methods inherited from ResourceGenerator
#default_action, #default_resource_template, #deploy, #do_action, #template, #template_root_dir, #undeploy
Constructor Details
#initialize(data) ⇒ AwsAutoScalingGroupGenerator
Returns a new instance of AwsAutoScalingGroupGenerator.
26 27 28 29 30 31 32 |
# File 'lib/topo/provision/aws/generators/aws_auto_scaling_group.rb', line 26 def initialize(data) @resource_type ||= "aws_auto_scaling_group" super %w[launch_configuration max_size min_size desired_capacity availability_zones load_balancers options].each do |key| @resource_attributes[key] = data[key] if data.key? key end end |
Class Method Details
.from_node(node) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/topo/provision/aws/generators/aws_auto_scaling_group.rb', line 34 def self.from_node(node) auto_scaling = value_from_path(node, %w[provisioning node_group auto_scaling]) || {} group_data = { "name" => auto_scaling['group_name'] || node['name'] + "_group", "launch_configuration" => auto_scaling['launch_configuration'] || node['name'] + "_config" } %w[max_size min_size desired_capacity availability_zones load_balancers].each do |key| group_data[key] = auto_scaling[key] if auto_scaling.key? key end = auto_scaling['group_options'] if # we also need to convert some of the field values in options, and then all of the keys %w[health_check_type].each do |key| [key] = [key].to_sym if .key? key end group_data['options'] = convert_keys_to_sym_deep() end self.new(group_data) end |