summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-08-16 05:25:45 +0000
committerGerrit Code Review <review@openstack.org>2016-08-16 05:25:45 +0000
commit63d039032cd425ef379ffa83af034b23cc80a674 (patch)
treee3c329a7eab33c0adb920427918f1a1cfa55679b
parent4bca14873802233335447ebf4e17e1129b0e98e3 (diff)
parentfcda77de61790be69b384207e7f648c53fa0e09a (diff)
downloadpython-keystoneclient-63d039032cd425ef379ffa83af034b23cc80a674.tar.gz
Merge "Improve docs for v3 ec2"
-rw-r--r--keystoneclient/v3/ec2.py65
1 files changed, 53 insertions, 12 deletions
diff --git a/keystoneclient/v3/ec2.py b/keystoneclient/v3/ec2.py
index 038406b..06fac20 100644
--- a/keystoneclient/v3/ec2.py
+++ b/keystoneclient/v3/ec2.py
@@ -14,6 +14,14 @@ from keystoneclient import base
class EC2(base.Resource):
+ """Represents an EC2 resource.
+
+ Attributes:
+ * id: a string that identifies the EC2 resource.
+ * user_id: the ID field of a pre-existing user in the backend.
+ * project_id: the ID field of a pre-existing project in the backend.
+
+ """
def __repr__(self):
"""Return string representation of EC2 resource information."""
@@ -25,9 +33,16 @@ class EC2Manager(base.ManagerWithFind):
resource_class = EC2
def create(self, user_id, project_id):
- """Create a new access/secret pair for the user/project pair.
+ """Create a new access/secret pair.
+
+ :param user_id: the ID of the user having access/secret pair.
+ :type user_id: str or :class:`keystoneclient.v3.users.User`
+ :param project_id: the ID of the project having access/secret pair.
+ :type project_id: str or :class:`keystoneclient.v3.projects.Project`
+
+ :returns: the created access/secret pair returned from server.
+ :rtype: :class:`keystoneclient.v3.ec2.EC2`
- :rtype: object of type :class:`EC2`
"""
# NOTE(jamielennox): Yes, this uses tenant_id as a key even though we
# are in the v3 API.
@@ -35,23 +50,49 @@ class EC2Manager(base.ManagerWithFind):
body={'tenant_id': project_id},
response_key="credential")
- def list(self, user_id):
- """Get a list of access/secret pairs for a user_id.
+ def get(self, user_id, access):
+ """Retrieve an access/secret pair for a given access key.
- :rtype: list of :class:`EC2`
- """
- return self._list("/users/%s/credentials/OS-EC2" % user_id,
- response_key="credentials")
+ :param user_id: the ID of the user whose access/secret pair will be
+ retrieved from the server.
+ :type user_id: str or :class:`keystoneclient.v3.users.User`
+ :param access: the access key whose access/secret pair will be
+ retrieved from the server.
+ :type access: str or :class:`keystoneclient.v3.ec2.EC2`
- def get(self, user_id, access):
- """Get the access/secret pair for a given access key.
+ :returns: the specified access/secret pair returned from server.
+ :rtype: :class:`keystoneclient.v3.ec2.EC2`
- :rtype: object of type :class:`EC2`
"""
url = "/users/%s/credentials/OS-EC2/%s" % (user_id, base.getid(access))
return self._get(url, response_key="credential")
+ def list(self, user_id):
+ """List access/secret pairs for a given user.
+
+ :param str user_id: the ID of the user having access/secret pairs will
+ be listed.
+
+ :returns: a list of access/secret pairs.
+ :rtype: list of :class:`keystoneclient.v3.ec2.EC2`
+
+ """
+ return self._list("/users/%s/credentials/OS-EC2" % user_id,
+ response_key="credentials")
+
def delete(self, user_id, access):
- """Delete an access/secret pair for a user."""
+ """Delete an access/secret pair.
+
+ :param user_id: the ID of the user whose access/secret pair will be
+ deleted on the server.
+ :type user_id: str or :class:`keystoneclient.v3.users.User`
+ :param access: the access key whose access/secret pair will be deleted
+ on the server.
+ :type access: str or :class:`keystoneclient.v3.ec2.EC2`
+
+ :returns: Response object with 204 status.
+ :rtype: :class:`requests.models.Response`
+
+ """
return self._delete("/users/%s/credentials/OS-EC2/%s" %
(user_id, base.getid(access)))