class Rivet::AutoscaleConfig

Public Class Methods

new(name, load_path='.', &block) click to toggle source
Calls superclass method
# File lib/rivet/as/autoscale_config.rb, line 6
def initialize(name, load_path='.', &block)
  @required_fields = {
    :min_size => nil,
    :max_size => nil,
    :availability_zones => nil,
    :default_cooldown => 300,
    :desired_capacity => 0,
    :health_check_grace_period => 0,
    :health_check_type => :ec2,
    :load_balancers => [],
    :tags => [],
    :termination_policies => ['Default']
  }
  super(name,load_path, &block)
end

Public Instance Methods

normalize_availability_zones() click to toggle source
# File lib/rivet/as/autoscale_config.rb, line 22
def normalize_availability_zones
  availability_zones.map { |zone| region + zone }.sort
end
normalize_load_balancers() click to toggle source
# File lib/rivet/as/autoscale_config.rb, line 26
def normalize_load_balancers
  load_balancers.sort
end
normalize_subnets() click to toggle source
# File lib/rivet/as/autoscale_config.rb, line 30
def normalize_subnets
  subnets.sort
end
normalize_tags() click to toggle source
# File lib/rivet/as/autoscale_config.rb, line 34
def normalize_tags
  normalized_tags = []
  tags.each do |t|
    normalized_hash = {}

    if t.has_key? :propagate_at_launch
      normalized_hash[:propagate_at_launch] = t[:propagate_at_launch]
    else
      normalized_hash[:propagate_at_launch] = true
    end

    [:value, :key].each do |k|
      if t.has_key? k
        normalized_hash[k] = t[k]
      else
        normalized_hash[k] = nil
      end
    end
    normalized_tags << normalized_hash
  end
  normalized_tags.sort_by { |h| h[:key] }
end