Sha256: f64cb44683d6d970996fa9e16095899968f5240747ab3ffff258c4591c027c8c

Contents?: true

Size: 619 Bytes

Versions: 6

Compression:

Stored size: 619 Bytes

Contents

module Stackster
  class InstanceReader

    def initialize(args)
      @ec2 = AWS::EC2.new :config => args[:config]
    end

    # Data structure is return deffernelty for class
    # Currently only supports VPC
    def list_stack_instances(stack_name)
      h = []
      describe_instances.each do |instance|
        tag_set = instance['instancesSet'].first['tagSet']
        if tag_set['aws:cloudformation:stack-name']
          h << instance if tag_set['aws:cloudformation:stack-name'] == stack_name
        end
      end
      h
    end

    def describe_instances
      @ec2.describe_instances
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stackster-0.1.2 lib/stackster/instance/instance_reader.rb
stackster-0.1.1 lib/stackster/instance/instance_reader.rb
stackster-0.1.0 lib/stackster/instance/instance_reader.rb
stackster-0.0.5 lib/stackster/instance/instance_reader.rb
stackster-0.0.4 lib/stackster/instance/instance_reader.rb
stackster-0.0.3 lib/stackster/instance/instance_reader.rb