1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/models/iam/user.rb

42 lines
859 B
Ruby
Raw Normal View History

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'
attribute :created_at, :aliases => 'CreateDate', :type => :time
2012-12-22 18:30:34 -05:00
def save
requires :id
2012-12-22 18:30:34 -05:00
data = service.create_user(id, path || '/').body['User']
merge_attributes(data)
true
end
2012-12-22 18:30:34 -05:00
def destroy
requires :id
2012-12-22 18:30:34 -05:00
service.delete_user(id)
true
end
2012-12-22 18:30:34 -05:00
def policies
requires :id
2012-12-22 18:30:34 -05:00
service.policies(:username => id)
end
2012-12-22 18:30:34 -05:00
2012-06-04 09:24:02 -04:00
def access_keys
requires :id
2012-12-22 18:30:34 -05:00
service.access_keys(:username => id)
2012-06-04 09:24:02 -04:00
end
2012-12-22 18:30:34 -05:00
end
end
end
2012-12-22 18:30:34 -05:00
end