lib/rezept/client.rb in rezept-0.2.0 vs lib/rezept/client.rb in rezept-0.3.0

- old
+ new

@@ -60,11 +60,11 @@ account_ids_to_add: add_ids, account_ids_to_remove: rm_ids ) end - def get_target_instances(instance_ids=nil, filters=nil, next_token=nil) + def get_instances(instance_ids=nil, filters=nil, next_token=nil) instances = [] ret = @ec2.describe_instances( instance_ids: instance_ids, filters: filters, @@ -72,10 +72,25 @@ ) ret.reservations.each do |reservation| instances.concat(reservation.instances) end - instances.concat(get_target_instances(instance_ids, filters, ret.next_token)) unless ret.next_token.nil? + instances.concat(get_instances(instance_ids, filters, ret.next_token)) unless ret.next_token.nil? + instances + end + + def get_managed_instances(instance_ids, next_token=nil) + instances = [] + + ret = @ssm.describe_instance_information( + filters: [{ + key: "InstanceIds", + values: instance_ids + }], + next_token: next_token + ) + instances = ret.instance_information_list + instances.concat(get_target_instances(instance_ids, ret.next_token)) unless ret.next_token.nil? instances end def run_command(name, instance_ids, targets, parameters) @ssm.send_command(