Sha256: bb24103db59201cbbf037c03cae3c1e59609a6068cf145e14254b9e654f73b1b

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

require 'fog'

module Stackster
  class AWS
    class AutoScalingGroups

      def initialize(args)
        c = args[:config]
        @asg_id = args[:asg_id]
        @connect = Fog::AWS::AutoScaling.new :aws_access_key_id => c.access_key,
                                             :aws_secret_access_key => c.secret_key,
                                             :region => c.region
      end

      def list_instances
        body = @connect.describe_auto_scaling_groups('AutoScalingGroupNames' => [@asg_id]).body
        result = body['DescribeAutoScalingGroupsResult']['AutoScalingGroups'].last
        result['Instances'].map { |info| info['InstanceId'] }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stackster-0.4.4 lib/stackster/aws/auto_scaling_groups.rb
stackster-0.4.3 lib/stackster/aws/auto_scaling_groups.rb