Class: Rivet::AwsAutoscaleWrapper
- Inherits:
-
Object
- Object
- Rivet::AwsAutoscaleWrapper
- Defined in:
- lib/rivet/aws_autoscale_wrapper.rb
Constant Summary collapse
- OPTIONS =
[ :availability_zones, :default_cooldown, :desired_capacity, :health_check_grace_period, :health_check_type, :launch_configuration, :load_balancers, :max_size, :min_size, :placement_group, :subnets, :tags, :termination_policies ].each { |a| attr_reader a }
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ AwsAutoscaleWrapper
constructor
A new instance of AwsAutoscaleWrapper.
- #normalize_availability_zones ⇒ Object
- #normalize_launch_configuration ⇒ Object
- #normalize_load_balancers ⇒ Object
- #normalize_subnets ⇒ Object
- #normalize_tags ⇒ Object
- #normalize_termination_policies ⇒ Object
Constructor Details
#initialize(name) ⇒ AwsAutoscaleWrapper
Returns a new instance of AwsAutoscaleWrapper.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 24 def initialize(name) Rivet::Log.debug "Initializing AWS Autoscale Wrapper for #{name}" @name = name @group = AWS::AutoScaling.new.groups[@name] if @group.exists? OPTIONS.each do |o| normalize_method = "normalize_#{o}".to_sym if respond_to?(normalize_method) Rivet::Log.debug "Calling #{normalize_method} in AWS autoscale wrapper" value = send(normalize_method) else value = @group.send(o) end instance_variable_set("@#{o}", value) end end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 22 def name @name end |
Instance Method Details
#normalize_availability_zones ⇒ Object
52 53 54 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 52 def normalize_availability_zones @group.availability_zone_names.to_a.sort end |
#normalize_launch_configuration ⇒ Object
44 45 46 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 44 def normalize_launch_configuration @group.launch_configuration_name end |
#normalize_load_balancers ⇒ Object
48 49 50 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 48 def normalize_load_balancers @group.load_balancer_names.to_a.sort end |
#normalize_subnets ⇒ Object
62 63 64 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 62 def normalize_subnets @group.subnets.empty? ? nil : @group.subnets.map(&:id).sort end |
#normalize_tags ⇒ Object
56 57 58 59 60 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 56 def @group..to_a.inject([]) do |, current| << normalize_tag(current) end end |
#normalize_termination_policies ⇒ Object
66 67 68 |
# File 'lib/rivet/aws_autoscale_wrapper.rb', line 66 def normalize_termination_policies @group.termination_policies.to_a.sort end |