Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ListGroupsForUser support to Fog::AWS::IAM
- Loading branch information
crazed
authored and
Wesley Beary
committed
Jan 31, 2011
1 parent
9f65b09
commit a91afd3
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |