Class: Rivet::AutoscaleConfig
- Inherits:
-
BaseConfig
- Object
- OpenState
- BaseConfig
- Rivet::AutoscaleConfig
- Defined in:
- lib/rivet/as/autoscale_config.rb
Instance Attribute Summary
Attributes inherited from BaseConfig
Attributes inherited from OpenState
#generated_attributes, #required_fields
Instance Method Summary collapse
-
#initialize(name, load_path = '.', &block) ⇒ AutoscaleConfig
constructor
A new instance of AutoscaleConfig.
- #normalize_availability_zones ⇒ Object
- #normalize_load_balancers ⇒ Object
- #normalize_subnets ⇒ Object
- #normalize_tags ⇒ Object
Methods inherited from BaseConfig
from_file, #normalize_security_groups, #path, #post
Methods inherited from OpenState
#install_get_or_set, #method_missing, #validate
Constructor Details
#initialize(name, load_path = '.', &block) ⇒ AutoscaleConfig
Returns a new instance of AutoscaleConfig.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rivet::OpenState
Instance Method Details
#normalize_availability_zones ⇒ Object
22 23 24 |
# File 'lib/rivet/as/autoscale_config.rb', line 22 def normalize_availability_zones availability_zones.map { |zone| region + zone }.sort end |
#normalize_load_balancers ⇒ Object
26 27 28 |
# File 'lib/rivet/as/autoscale_config.rb', line 26 def normalize_load_balancers load_balancers.sort end |
#normalize_subnets ⇒ Object
30 31 32 |
# File 'lib/rivet/as/autoscale_config.rb', line 30 def normalize_subnets subnets.sort end |
#normalize_tags ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rivet/as/autoscale_config.rb', line 34 def = [] .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_hash end .sort_by { |h| h[:key] } end |