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/access_key.rb
2012-06-05 17:57:02 +02:00

38 lines
No EOL
839 B
Ruby

require 'fog/core/model'
module Fog
module AWS
class IAM
class AccessKey < Fog::Model
identity :id, :aliases => 'AccessKeyId'
attribute :username, :aliases => 'UserName'
attribute :secret_access_key, :aliases => 'SecretAccessKey'
attribute :status, :aliases => 'Status'
def save
requires :username
data = connection.create_access_key('UserName'=> username).body["AccessKey"]
merge_attributes(data)
true
end
def destroy
requires :id
requires :username
connection.delete_access_key(id,'UserName'=> username)
true
end
def user
requires :username
connection.users.get(username)
end
end
end
end
end