class Stax::Aws::Asg

Public Class Methods

client() click to toggle source
# File lib/stax/aws/asg.rb, line 9
def client
  @_client ||= ::Aws::AutoScaling::Client.new
end
describe(names) click to toggle source
# File lib/stax/aws/asg.rb, line 13
def describe(names)
  paginate(:auto_scaling_groups) do |token|
    client.describe_auto_scaling_groups(auto_scaling_group_names: Array(names), next_token: token)
  end
end
instances(names) click to toggle source
# File lib/stax/aws/asg.rb, line 19
def instances(names)
  ids = describe(names).map(&:instances).flatten.map(&:instance_id)
  return [] if ids.empty? # below call will return all instances in a/c if this empty
  paginate(:auto_scaling_instances) do |token|
    client.describe_auto_scaling_instances(instance_ids: ids, next_token: token)
  end
end
terminate(id, decrement = false) click to toggle source
# File lib/stax/aws/asg.rb, line 31
def terminate(id, decrement = false)
  client.terminate_instance_in_auto_scaling_group(instance_id: id, should_decrement_desired_capacity: decrement)
end
update(name, opt = {}) click to toggle source
# File lib/stax/aws/asg.rb, line 27
def update(name, opt = {})
  client.update_auto_scaling_group(opt.merge(auto_scaling_group_name: name))
end