Class: AwsHelpers::AutoScalingGroup::RetrieveDesiredCapacity

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_helpers/auto_scaling_group/retrieve_desired_capacity.rb

Instance Method Summary collapse

Constructor Details

#initialize(auto_scaling_client, auto_scaling_group_name) ⇒ RetrieveDesiredCapacity

Returns a new instance of RetrieveDesiredCapacity


6
7
8
9
# File 'lib/aws_helpers/auto_scaling_group/retrieve_desired_capacity.rb', line 6

def initialize(auto_scaling_client, auto_scaling_group_name)
  @auto_scaling_client = auto_scaling_client
  @auto_scaling_group_name = auto_scaling_group_name
end

Instance Method Details

#executeObject


11
12
13
14
# File 'lib/aws_helpers/auto_scaling_group/retrieve_desired_capacity.rb', line 11

def execute
  auto_scaling_groups = @auto_scaling_client.describe_auto_scaling_groups(:auto_scaling_group_names => [@auto_scaling_group_name])[:auto_scaling_groups]
  auto_scaling_groups.detect { |auto_scaling_group| auto_scaling_group[:auto_scaling_group_name] == @auto_scaling_group_name }[:desired_capacity]
end