lib/awspec/helper/finder/iam.rb in awspec-0.86.0 vs lib/awspec/helper/finder/iam.rb in awspec-0.87.0

- old
+ new

@@ -5,11 +5,11 @@ role_types = %w(user group role policy) role_types.each do |type| define_method 'find_iam_' + type do |*args| id = args.first selected = [] - res = iam_client.method('list_' + type.pluralize).call + res = iam_client.send('list_' + type.pluralize) loop do selected += res[type.pluralize].select do |u| u[type + '_name'] == id || u[type + '_id'] == id || u.arn == id end (res.next_page? && res = res.next_page) || break @@ -38,19 +38,21 @@ res.groups end %w(user group role).each do |type| define_method 'select_iam_policy_by_' + type + '_name' do |name| - res = iam_client.method('list_attached_' + type + '_policies').call({ - (type + '_name').to_sym => name - }) + res = iam_client.send( + 'list_attached_' + type + '_policies', + { (type + '_name').to_sym => name } + ) res.attached_policies end define_method 'select_inline_policy_by_' + type + '_name' do |name| - res = iam_client.method('list_' + type + '_policies').call({ - (type + '_name').to_sym => name - }) + res = iam_client.send( + 'list_' + type + '_policies', + { (type + '_name').to_sym => name } + ) res.policy_names end end def select_all_attached_policies