Index: boto/iam/connection.py |
diff --git a/boto/iam/connection.py b/boto/iam/connection.py |
index 39ab704c57a02f35e6bd0769924ef6df2d8ed7f4..ae68f33793106ee64d20daca0bbadb330e2cb0f7 100644 |
--- a/boto/iam/connection.py |
+++ b/boto/iam/connection.py |
@@ -22,6 +22,7 @@ |
import boto |
import boto.jsonresponse |
+from boto.iam.summarymap import SummaryMap |
from boto.connection import AWSQueryConnection |
#boto.set_stream_logger('iam') |
@@ -33,12 +34,14 @@ class IAMConnection(AWSQueryConnection): |
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, |
is_secure=True, port=None, proxy=None, proxy_port=None, |
proxy_user=None, proxy_pass=None, host='iam.amazonaws.com', |
- debug=0, https_connection_factory=None, path='/'): |
+ debug=0, https_connection_factory=None, |
+ path='/'): |
AWSQueryConnection.__init__(self, aws_access_key_id, |
aws_secret_access_key, |
is_secure, port, proxy, |
proxy_port, proxy_user, proxy_pass, |
- host, debug, https_connection_factory, path) |
+ host, debug, https_connection_factory, |
+ path) |
def _required_auth_capability(self): |
return ['iam'] |
@@ -54,7 +57,8 @@ class IAMConnection(AWSQueryConnection): |
body = response.read() |
boto.log.debug(body) |
if response.status == 200: |
- e = boto.jsonresponse.Element(list_marker=list_marker) |
+ e = boto.jsonresponse.Element(list_marker=list_marker, |
+ pythonize_name=True) |
h = boto.jsonresponse.XmlHandler(e, parent) |
h.parse(body) |
return e |
@@ -178,7 +182,7 @@ class IAMConnection(AWSQueryConnection): |
Add a user to a group |
:type group_name: string |
- :param group_name: The name of the new group |
+ :param group_name: The name of the group |
:type user_name: string |
:param user_name: The to be added to the group. |
@@ -193,7 +197,7 @@ class IAMConnection(AWSQueryConnection): |
Remove a user from a group. |
:type group_name: string |
- :param group_name: The name of the new group |
+ :param group_name: The name of the group |
:type user_name: string |
:param user_name: The user to remove from the group. |
@@ -493,7 +497,7 @@ class IAMConnection(AWSQueryConnection): |
Get all access keys associated with an account. |
:type user_name: string |
- :param user_name: The username of the new user |
+ :param user_name: The username of the user |
:type marker: string |
:param marker: Use this only when paginating results and only in |
@@ -524,7 +528,7 @@ class IAMConnection(AWSQueryConnection): |
implicitly based on the AWS Access Key ID used to sign the request. |
:type user_name: string |
- :param user_name: The username of the new user |
+ :param user_name: The username of the user |
""" |
params = {'UserName' : user_name} |
@@ -566,7 +570,7 @@ class IAMConnection(AWSQueryConnection): |
:param access_key_id: The ID of the access key to be deleted. |
:type user_name: string |
- :param user_name: The username of the new user |
+ :param user_name: The username of the user |
""" |
params = {'AccessKeyId' : access_key_id} |
@@ -647,7 +651,7 @@ class IAMConnection(AWSQueryConnection): |
:param cert_body: The body of the signing certificate. |
:type user_name: string |
- :param user_name: The username of the new user |
+ :param user_name: The username of the user |
""" |
params = {'CertificateBody' : cert_body} |
@@ -664,7 +668,7 @@ class IAMConnection(AWSQueryConnection): |
on the AWS Access Key ID used to sign the request. |
:type user_name: string |
- :param user_name: The username of the new user |
+ :param user_name: The username of the user |
:type cert_id: string |
:param cert_id: The ID of the certificate. |
@@ -906,6 +910,17 @@ class IAMConnection(AWSQueryConnection): |
# |
# Login Profiles |
# |
+ |
+ def get_login_profiles(self, user_name): |
+ """ |
+ Retrieves the login profile for the specified user. |
+ |
+ :type user_name: string |
+ :param user_name: The username of the user |
+ |
+ """ |
+ params = {'UserName' : user_name} |
+ return self.get_response('GetLoginProfile', params) |
def create_login_profile(self, user_name, password): |
""" |
@@ -913,7 +928,7 @@ class IAMConnection(AWSQueryConnection): |
ability to access AWS services and the AWS Management Console. |
:type user_name: string |
- :param user_name: The name of the new user |
+ :param user_name: The name of the user |
:type password: string |
:param password: The new password for the user |
@@ -985,11 +1000,8 @@ class IAMConnection(AWSQueryConnection): |
For more information on account id aliases, please see |
http://goo.gl/ToB7G |
""" |
- r = self.get_response('ListAccountAliases', {}) |
- response = r.get('ListAccountAliasesResponse') |
- result = response.get('ListAccountAliasesResult') |
- aliases = result.get('AccountAliases') |
- return aliases.get('member', None) |
+ return self.get_response('ListAccountAliases', {}, |
+ list_marker='AccountAliases') |
def get_signin_url(self, service='ec2'): |
""" |
@@ -1004,3 +1016,17 @@ class IAMConnection(AWSQueryConnection): |
raise Exception('No alias associated with this account. Please use iam.create_account_alias() first.') |
return "https://%s.signin.aws.amazon.com/console/%s" % (alias, service) |
+ |
+ def get_account_summary(self): |
+ """ |
+ Get the alias for the current account. |
+ |
+ This is referred to in the docs as list_account_aliases, |
+ but it seems you can only have one account alias currently. |
+ |
+ For more information on account id aliases, please see |
+ http://goo.gl/ToB7G |
+ """ |
+ return self.get_object('GetAccountSummary', {}, SummaryMap) |
+ |
+ |