Class: Cloudpatrol::Task::IAM

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudpatrol/task/iam.rb

Instance Method Summary collapse

Constructor Details

#initialize(cred) ⇒ IAM

Returns a new instance of IAM.



6
7
8
# File 'lib/cloudpatrol/task/iam.rb', line 6

def initialize cred
  @gate = ::AWS::IAM.new(cred)
end

Instance Method Details

#clean_usersObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/cloudpatrol/task/iam.rb', line 10

def clean_users
  deleted = []
  @gate.users.each do |user|
    unless user.name =~ /^_/ or user.mfa_devices.count > 0
      deleted << user.inspect
      user.delete!
    end
  end
  deleted
end