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:
parent
13733d01dc
commit
a550c54407
6 changed files with 45 additions and 45 deletions
|
@ -14,7 +14,7 @@ module Fog
|
||||||
def save
|
def save
|
||||||
requires :username
|
requires :username
|
||||||
|
|
||||||
data = connection.create_access_key('UserName'=> username).body["AccessKey"]
|
data = service.create_access_key('UserName'=> username).body["AccessKey"]
|
||||||
merge_attributes(data)
|
merge_attributes(data)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -23,13 +23,13 @@ module Fog
|
||||||
requires :id
|
requires :id
|
||||||
requires :username
|
requires :username
|
||||||
|
|
||||||
connection.delete_access_key(id,'UserName'=> username)
|
service.delete_access_key(id,'UserName'=> username)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def user
|
def user
|
||||||
requires :username
|
requires :username
|
||||||
connection.users.get(username)
|
service.users.get(username)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def all
|
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
|
# AWS response doesn't contain the UserName, this injects it
|
||||||
data.each {|access_key| access_key['UserName'] = @username }
|
data.each {|access_key| access_key['UserName'] = @username }
|
||||||
load(data)
|
load(data)
|
||||||
|
|
|
@ -19,16 +19,16 @@ module Fog
|
||||||
def all
|
def all
|
||||||
# AWS method get_user_policy only returns an array of policy names, this is kind of useless,
|
# 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
|
# 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 = []
|
policies = []
|
||||||
policy_names.each do |policy_name|
|
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
|
end
|
||||||
load(policies) # data is an array of attribute hashes
|
load(policies) # data is an array of attribute hashes
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(identity)
|
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
|
new(data) # data is an attribute hash
|
||||||
rescue Fog::AWS::IAM::NotFound
|
rescue Fog::AWS::IAM::NotFound
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
requires :username
|
requires :username
|
||||||
requires :document
|
requires :document
|
||||||
|
|
||||||
data = connection.put_user_policy(username, id, document).body
|
data = service.put_user_policy(username, id, document).body
|
||||||
merge_attributes(data)
|
merge_attributes(data)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -24,13 +24,13 @@ module Fog
|
||||||
requires :id
|
requires :id
|
||||||
requires :username
|
requires :username
|
||||||
|
|
||||||
connection.delete_user_policy(username, id)
|
service.delete_user_policy(username, id)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def user
|
def user
|
||||||
requires :username
|
requires :username
|
||||||
connection.users.get(username)
|
service.users.get(username)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,25 +13,25 @@ module Fog
|
||||||
|
|
||||||
def save
|
def save
|
||||||
requires :id
|
requires :id
|
||||||
data = connection.create_user(id, path || '/').body['User']
|
data = service.create_user(id, path || '/').body['User']
|
||||||
merge_attributes(data)
|
merge_attributes(data)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :id
|
requires :id
|
||||||
connection.delete_user(id)
|
service.delete_user(id)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def policies
|
def policies
|
||||||
requires :id
|
requires :id
|
||||||
connection.policies(:username => id)
|
service.policies(:username => id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def access_keys
|
def access_keys
|
||||||
requires :id
|
requires :id
|
||||||
connection.access_keys(:username => id)
|
service.access_keys(:username => id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,13 +14,13 @@ module Fog
|
||||||
|
|
||||||
def all(options = {})
|
def all(options = {})
|
||||||
merge_attributes(options)
|
merge_attributes(options)
|
||||||
data = connection.list_users(options).body
|
data = service.list_users(options).body
|
||||||
merge_attributes('IsTruncated' => data['IsTruncated'], 'Marker' => data['Marker'])
|
merge_attributes('IsTruncated' => data['IsTruncated'], 'Marker' => data['Marker'])
|
||||||
load(data['Users']) # data is an array of attribute hashes
|
load(data['Users']) # data is an array of attribute hashes
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(identity)
|
def get(identity)
|
||||||
data = connection.get_user(identity).body['User']
|
data = service.get_user(identity).body['User']
|
||||||
new(data) # data is an attribute hash
|
new(data) # data is an attribute hash
|
||||||
rescue Fog::AWS::IAM::NotFound
|
rescue Fog::AWS::IAM::NotFound
|
||||||
nil
|
nil
|
||||||
|
|
Loading…
Reference in a new issue