mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|iam] get_user implementation
This commit is contained in:
parent
9d6d16b425
commit
6a9b4b0bc6
3 changed files with 72 additions and 0 deletions
|
@ -15,6 +15,7 @@ module Fog
|
|||
request :delete_group_policy
|
||||
request :delete_user
|
||||
request :delete_user_policy
|
||||
request :get_user
|
||||
request :list_access_keys
|
||||
request :list_groups
|
||||
request :list_group_policies
|
||||
|
|
27
lib/fog/aws/parsers/iam/get_user.rb
Normal file
27
lib/fog/aws/parsers/iam/get_user.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class GetUser < Fog::Parsers::Base
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_GetUser.html
|
||||
|
||||
def reset
|
||||
@response = { 'User' => {} }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Arn', 'UserId', 'UserName', 'Path'
|
||||
@response['User'][name] = @value
|
||||
when 'RequestId'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
44
lib/fog/aws/requests/iam/get_user.rb
Normal file
44
lib/fog/aws/requests/iam/get_user.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/get_user'
|
||||
|
||||
# Get User
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * 'UserName'<~String>: Name of the User. Defaults to current user
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'User'<~Hash> - User
|
||||
# * Arn<~String> -
|
||||
# * UserId<~String> -
|
||||
# * UserName<~String> -
|
||||
# * Path<~String> -
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_Getuser.html
|
||||
#
|
||||
def get_user(options = {})
|
||||
request({
|
||||
'Action' => 'GetUser',
|
||||
:parser => Fog::Parsers::AWS::IAM::GetUser.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_user(options = {})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue