1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|iam] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:30:34 +00:00
parent 13733d01dc
commit a550c54407
6 changed files with 45 additions and 45 deletions

View file

@ -14,7 +14,7 @@ module Fog
def save
requires :username
data = connection.create_access_key('UserName'=> username).body["AccessKey"]
data = service.create_access_key('UserName'=> username).body["AccessKey"]
merge_attributes(data)
true
end
@ -23,13 +23,13 @@ module Fog
requires :id
requires :username
connection.delete_access_key(id,'UserName'=> username)
service.delete_access_key(id,'UserName'=> username)
true
end
def user
requires :username
connection.users.get(username)
service.users.get(username)
end
end

View file

@ -16,7 +16,7 @@ module Fog
end
def all
data = connection.list_access_keys('UserName'=> @username).body['AccessKeys']
data = service.list_access_keys('UserName'=> @username).body['AccessKeys']
# AWS response doesn't contain the UserName, this injects it
data.each {|access_key| access_key['UserName'] = @username }
load(data)

View file

@ -19,16 +19,16 @@ module Fog
def all
# AWS method get_user_policy only returns an array of policy names, this is kind of useless,
# that's why it has to loop through the list to get the details of each element. I don't like it because it makes this method slow
policy_names = connection.list_user_policies(@username).body['PolicyNames'] # it returns an array
policy_names = service.list_user_policies(@username).body['PolicyNames'] # it returns an array
policies = []
policy_names.each do |policy_name|
policies << connection.get_user_policy(policy_name,@username).body['Policy']
policies << service.get_user_policy(policy_name,@username).body['Policy']
end
load(policies) # data is an array of attribute hashes
end
def get(identity)
data = connection.get_user_policy(identity,@username).body['Policy']
data = service.get_user_policy(identity,@username).body['Policy']
new(data) # data is an attribute hash
rescue Fog::AWS::IAM::NotFound
nil

View file

@ -15,7 +15,7 @@ module Fog
requires :username
requires :document
data = connection.put_user_policy(username, id, document).body
data = service.put_user_policy(username, id, document).body
merge_attributes(data)
true
end
@ -24,13 +24,13 @@ module Fog
requires :id
requires :username
connection.delete_user_policy(username, id)
service.delete_user_policy(username, id)
true
end
def user
requires :username
connection.users.get(username)
service.users.get(username)
end
end

View file

@ -13,25 +13,25 @@ module Fog
def save
requires :id
data = connection.create_user(id, path || '/').body['User']
data = service.create_user(id, path || '/').body['User']
merge_attributes(data)
true
end
def destroy
requires :id
connection.delete_user(id)
service.delete_user(id)
true
end
def policies
requires :id
connection.policies(:username => id)
service.policies(:username => id)
end
def access_keys
requires :id
connection.access_keys(:username => id)
service.access_keys(:username => id)
end
end

View file

@ -14,13 +14,13 @@ module Fog
def all(options = {})
merge_attributes(options)
data = connection.list_users(options).body
data = service.list_users(options).body
merge_attributes('IsTruncated' => data['IsTruncated'], 'Marker' => data['Marker'])
load(data['Users']) # data is an array of attribute hashes
end
def get(identity)
data = connection.get_user(identity).body['User']
data = service.get_user(identity).body['User']
new(data) # data is an attribute hash
rescue Fog::AWS::IAM::NotFound
nil