2012-06-02 11:04:17 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class IAM
|
|
|
|
|
|
|
|
class User < Fog::Model
|
|
|
|
|
|
|
|
identity :id, :aliases => 'UserName'
|
|
|
|
attribute :path, :aliases => 'Path'
|
|
|
|
attribute :arn, :aliases => 'Arn'
|
|
|
|
attribute :user_id, :aliases => 'UserId'
|
|
|
|
|
|
|
|
def save
|
|
|
|
requires :id
|
|
|
|
data = connection.create_user(id).body['User']
|
|
|
|
merge_attributes(data)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
requires :id
|
|
|
|
connection.delete_user(id)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def policies
|
|
|
|
requires :id
|
2012-06-05 09:02:03 -04:00
|
|
|
connection.policies(:username => id)
|
2012-06-02 11:04:17 -04:00
|
|
|
end
|
|
|
|
|
2012-06-04 09:24:02 -04:00
|
|
|
def access_keys
|
|
|
|
requires :id
|
2012-06-05 09:02:03 -04:00
|
|
|
connection.access_keys(:username => id)
|
2012-06-04 09:24:02 -04:00
|
|
|
end
|
2012-06-02 11:04:17 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|