mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added ListGroupsForUser support to Fog::AWS::IAM
This commit is contained in:
parent
9f65b09e15
commit
a91afd354f
3 changed files with 84 additions and 0 deletions
|
@ -19,6 +19,7 @@ module Fog
|
|||
request :get_user
|
||||
request :list_access_keys
|
||||
request :list_groups
|
||||
request :list_groups_for_user
|
||||
request :list_group_policies
|
||||
request :list_signing_certificates
|
||||
request :list_user_policies
|
||||
|
|
32
lib/fog/aws/parsers/iam/list_groups_for_user.rb
Normal file
32
lib/fog/aws/parsers/iam/list_groups_for_user.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class ListGroupsForUser < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@group_for_user = {}
|
||||
@response = { 'GroupsForUser' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Path', 'GroupName', 'GroupId', 'Arn'
|
||||
@group_for_user[name] = @value
|
||||
when 'member'
|
||||
@response['GroupsForUser'] << @group_for_user
|
||||
@group_for_user = {}
|
||||
when 'IsTruncated'
|
||||
response[name] = (@value == 'true')
|
||||
when 'Marker', 'RequestId'
|
||||
response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
51
lib/fog/aws/requests/iam/list_groups_for_user.rb
Normal file
51
lib/fog/aws/requests/iam/list_groups_for_user.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/list_groups_for_user'
|
||||
|
||||
# List groups_for_user
|
||||
#
|
||||
# ==== Parameters
|
||||
# * user_name<~String> - the username you want to look up group membership for
|
||||
# * options<~Hash>:
|
||||
# * 'Marker'<~String> - used to paginate subsequent requests
|
||||
# * 'MaxItems'<~Integer> - limit results to this number per page
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'GroupsForUser'<~Array> - Groups for a user
|
||||
# * group_for_user<~Hash>:
|
||||
# * 'Arn' -
|
||||
# * 'GroupId' -
|
||||
# * 'GroupName' -
|
||||
# * 'Path' -
|
||||
# * 'IsTruncated'<~Boolean> - Whether or not results were truncated
|
||||
# * 'Marker'<~String> - appears when IsTruncated is true as the next marker to use
|
||||
# * 'RequestId'<~String> - Id of the request
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_ListGroupsForUser.html
|
||||
#
|
||||
def list_groups_for_user(user_name, options = {})
|
||||
request({
|
||||
'Action' => 'ListGroupsForUser',
|
||||
'UserName' => user_name,
|
||||
:parser => Fog::Parsers::AWS::IAM::ListGroupsForUser.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def list_groups_for_user(user_name = nil)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue