summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-20 21:12:59 +0000
committerGerrit Code Review <review@openstack.org>2013-05-20 21:12:59 +0000
commit0676523c2c052b51d17c64c5e44d1c5ed3afc5e9 (patch)
treea34de181066fce90d87531fe040677c9f020f0f7
parentf7d3837eae3f4ec2177640e70b2375414ac2c306 (diff)
parent5d93e928d0ba47f57605b603c20c2da7b847e924 (diff)
downloadpython-keystoneclient-0676523c2c052b51d17c64c5e44d1c5ed3afc5e9.tar.gz
Merge "Refactor v3 API to support filtering"
-rw-r--r--keystoneclient/v3/endpoints.py12
-rw-r--r--keystoneclient/v3/groups.py13
-rw-r--r--keystoneclient/v3/projects.py13
-rw-r--r--keystoneclient/v3/roles.py12
-rw-r--r--keystoneclient/v3/users.py13
5 files changed, 50 insertions, 13 deletions
diff --git a/keystoneclient/v3/endpoints.py b/keystoneclient/v3/endpoints.py
index c13313d..010572b 100644
--- a/keystoneclient/v3/endpoints.py
+++ b/keystoneclient/v3/endpoints.py
@@ -61,14 +61,20 @@ class EndpointManager(base.CrudManager):
return super(EndpointManager, self).get(
endpoint_id=base.getid(endpoint))
- def list(self, service=None, name=None, interface=None, region=None,
- enabled=None):
+ def list(self, service=None, interface=None, region=None,
+ enabled=None, **kwargs):
+ """List endpoints.
+
+ If ``**kwargs`` are provided, then filter endpoints with
+ attributes matching ``**kwargs``.
+ """
self._validate_interface(interface)
return super(EndpointManager, self).list(
service_id=base.getid(service),
interface=interface,
region=region,
- enabled=enabled)
+ enabled=enabled,
+ **kwargs)
def update(self, endpoint, service=None, url=None, name=None,
interface=None, region=None, enabled=None):
diff --git a/keystoneclient/v3/groups.py b/keystoneclient/v3/groups.py
index e196daf..f6e04c6 100644
--- a/keystoneclient/v3/groups.py
+++ b/keystoneclient/v3/groups.py
@@ -55,13 +55,22 @@ class GroupManager(base.CrudManager):
domain_id=base.getid(domain),
description=description)
- def list(self, user=None):
+ def list(self, user=None, **kwargs):
+ """List groups.
+
+ If user is provided, then filter groups with
+ that attribute.
+
+ If ``**kwargs`` are provided, then filter groups with
+ attributes matching ``**kwargs``.
+ """
if user:
base_url = '/users/%s' % base.getid(user)
else:
base_url = None
return super(GroupManager, self).list(
- base_url=base_url)
+ base_url=base_url,
+ **kwargs)
def get(self, group):
return super(GroupManager, self).get(
diff --git a/keystoneclient/v3/projects.py b/keystoneclient/v3/projects.py
index bcbc4fd..cb08061 100644
--- a/keystoneclient/v3/projects.py
+++ b/keystoneclient/v3/projects.py
@@ -58,11 +58,20 @@ class ProjectManager(base.CrudManager):
description=description,
enabled=enabled)
- def list(self, domain=None, user=None):
+ def list(self, domain=None, user=None, **kwargs):
+ """List projects.
+
+ If domain or user are provided, then filter projects with
+ those attributes.
+
+ If ``**kwargs`` are provided, then filter projects with
+ attributes matching ``**kwargs``.
+ """
base_url = '/users/%s' % base.getid(user) if user else None
return super(ProjectManager, self).list(
base_url=base_url,
- domain_id=base.getid(domain))
+ domain_id=base.getid(domain),
+ **kwargs)
def get(self, project):
return super(ProjectManager, self).get(
diff --git a/keystoneclient/v3/roles.py b/keystoneclient/v3/roles.py
index a930426..8bd269d 100644
--- a/keystoneclient/v3/roles.py
+++ b/keystoneclient/v3/roles.py
@@ -74,13 +74,16 @@ class RoleManager(base.CrudManager):
return super(RoleManager, self).get(
role_id=base.getid(role))
- def list(self, user=None, group=None, domain=None, project=None):
+ def list(self, user=None, group=None, domain=None, project=None, **kwargs):
"""Lists roles and role grants.
- If no arguments are provided, all roles in the system will be listed.
+ If no arguments are provided, all roles in the system will be
+ listed.
If a user or group is specified, you must also specify either a
- domain or project to list role grants on that pair.
+ domain or project to list role grants on that pair. And if
+ ``**kwargs`` are provided, then also filter roles with
+ attributes matching ``**kwargs``.
"""
if user or group:
@@ -89,7 +92,8 @@ class RoleManager(base.CrudManager):
return super(RoleManager, self).list(
base_url=self._role_grants_base_url(user, group,
- domain, project))
+ domain, project),
+ **kwargs)
return super(RoleManager, self).list()
diff --git a/keystoneclient/v3/users.py b/keystoneclient/v3/users.py
index 363cef3..6046513 100644
--- a/keystoneclient/v3/users.py
+++ b/keystoneclient/v3/users.py
@@ -49,7 +49,15 @@ class UserManager(base.CrudManager):
description=description,
enabled=enabled)
- def list(self, project=None, domain=None, group=None):
+ def list(self, project=None, domain=None, group=None, **kwargs):
+ """List users.
+
+ If project, domain or group are provided, then filter
+ users with those attributes.
+
+ If ``**kwargs`` are provided, then filter users with
+ attributes matching ``**kwargs``.
+ """
if group:
base_url = '/groups/%s' % base.getid(group)
else:
@@ -58,7 +66,8 @@ class UserManager(base.CrudManager):
return super(UserManager, self).list(
base_url=base_url,
domain_id=base.getid(domain),
- project_id=base.getid(project))
+ project_id=base.getid(project),
+ **kwargs)
def get(self, user):
return super(UserManager, self).get(