Class: Stackster::AWS::AutoScalingGroups

Inherits:
Object
  • Object
show all
Defined in:
lib/stackster/aws/auto_scaling_groups.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ AutoScalingGroups

Returns a new instance of AutoScalingGroups.



7
8
9
10
11
12
13
# File 'lib/stackster/aws/auto_scaling_groups.rb', line 7

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

Instance Method Details

#list_instancesObject



15
16
17
18
19
# File 'lib/stackster/aws/auto_scaling_groups.rb', line 15

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