Sha256: 7b8063c4a9f6dc8f866d6ba0f01c240f060af70d8f2e2681da4dafd2f3c08240

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

module Stackster
  class InstanceReader

    def initialize(environment)
      @environment = environment
      @ec2 = AWS::EC2.new @environment
    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

2 entries across 2 versions & 1 rubygems

Version Path
stackster-0.0.2 lib/stackster/instance/instance_reader.rb
stackster-0.0.1 lib/stackster/instance/instance_reader.rb