Class: Stackster::InstanceReader

Inherits:
Object
  • Object
show all
Defined in:
lib/stackster/instance/instance_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ InstanceReader

Returns a new instance of InstanceReader.



4
5
6
# File 'lib/stackster/instance/instance_reader.rb', line 4

def initialize(args)
  @config = args[:config]
end

Instance Method Details

#list_stack_instances(stack_name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/stackster/instance/instance_reader.rb', line 8

def list_stack_instances(stack_name)
  h = []
  describe_instances.each do |instance|
    tag_set = instance['instancesSet'].first['tagSet']
    instance_stack_name = tag_set['aws:cloudformation:stack-name']
    if instance_stack_name && instance_stack_name == stack_name
      if instance_running? instance
        h << instance
      end
    end
  end
  h
end