module AWS::AutoScaling::GroupOptions

def az_opt options

def az_opt options
  zones = options[:availability_zones]
  zones.map {|zone| zone.is_a?(EC2::AvailabilityZone) ? zone.name : zone }
end

def group_options options

Returns:
  • (Hash) -

Options Hash: (**options)
  • :subnets (Array, Array) --
  • :tags (Array) -- A list of tags to apply launched
  • :placement_group (String) --
  • :health_check_type (Symbol) --
  • :health_check_grace_period (Integer) --
  • :desired_capacity (Integer) --
  • :default_cooldown (Integer) --
  • :availability_zones (required, Array) --
  • :launch_configuration (required, LaunchConfiguration, String) --
  • :max_size (required, Integer) --
  • :min_size (required, Integer) --

Parameters:
  • options (Hash) --
def group_options options
  group_opts = {}
  group_opts[:launch_configuration_name] = launch_config_opt(options) if
    options.key?(:launch_configuration)
  group_opts[:availability_zones] = az_opt(options) if
    options.key?(:availability_zones)
  group_opts[:vpc_zone_identifier] = subnets_opt(options) if
    options.key?(:subnets)
  group_opts[:health_check_type] = health_check_type_opt(options) if
    options.key?(:health_check_type)
  group_opts[:tags] = tags_opt(options) if
    options.key?(:tags)
  [ 
    :min_size,
    :max_size,
    :default_cooldown, 
    :desired_capacity, 
    :health_check_grace_period,
    :placement_group,
  ].each do |opt|
    group_opts[opt] = options[opt] if options.key?(opt)
  end
  group_opts
end

def health_check_type_opt options

def health_check_type_opt options
  options[:health_check_type].to_s.upcase
end

def launch_config_opt options

def launch_config_opt options
  lc = options[:launch_configuration]
  lc.is_a?(LaunchConfiguration) ? lc.name : lc
end

def load_balancers_opt options

def load_balancers_opt options
  options[:load_balancers].collect do |lb|
    lb.is_a?(ELB::LoadBalancer) ? lb.name : lb
  end
end

def subnets_opt options

def subnets_opt options
  options[:subnets].collect do |subnet|
    subnet.is_a?(EC2::Subnet) ? subnet.id : subnet
  end.join(',')
end

def tags_opt options

def tags_opt options
  options[:tags].map(&:to_hash).each do |tag|
    tag[:propagate_at_launch] = true unless tag.key?(:propagate_at_launch)
  end
end