Commit 124ce68d authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Ilias Tsitsimpis

astakosclient: Rename param project->project_id

This change affects the parameters of all methods in astakosclient.
Preserve backwards compatibility.

Refs #110
parent c651edc2
......@@ -527,32 +527,34 @@ class AstakosClient(object):
# ----------------------------------
# do a GET to ``API_SERVICE_QUOTAS``
def service_get_quotas(self, user=None, project=None):
def service_get_quotas(self, user=None, project_id=None, project=None):
"""Get all quotas for resources associated with the service
Keyword arguments:
user -- optionally, the uuid of a specific user, or a list thereof
project -- optionally, the uuid of a specific project, or a list
project_id -- optionally, the uuid of a specific project, or a list
thereof
project -- backwards compatibility (replaced by "project_id")
In case of success return a dict of dicts of dicts with current quotas
for all users, or of a specified user, if user argument is set.
Otherwise raise an AstakosClientException
"""
project_id = project if project_id is None else project_id
query = self.api_service_quotas
filters = {}
if user is not None:
filters['user'] = self._join_if_list(user)
if project is not None:
filters['project'] = self._join_if_list(project)
if project_id is not None:
filters['project'] = self._join_if_list(project_id)
if filters:
query += "?" + urllib.urlencode(filters)
return self._call_astakos(query)
# ----------------------------------
# do a GET to ``API_SERVICE_PROJECT_QUOTAS``
def service_get_project_quotas(self, project=None):
def service_get_project_quotas(self, project_id=None, project=None):
"""Get all project quotas for resources associated with the service
Keyword arguments:
......@@ -564,10 +566,11 @@ class AstakosClient(object):
set. Otherwise raise an AstakosClientException
"""
project_id = project if project_id is None else project_id
query = self.api_service_project_quotas
filters = {}
if project is not None:
filters['project'] = self._join_if_list(project)
if project_id is not None:
filters['project'] = self._join_if_list(project_id)
if filters:
query += "?" + urllib.urlencode(filters)
return self._call_astakos(query)
......@@ -916,18 +919,20 @@ class AstakosClient(object):
# -------------------------------
# do a GET to ``API_MEMBERSHIPS``
def get_memberships(self, project=None):
def get_memberships(self, project_id=None, project=None):
"""Retrieve all accessible memberships
Arguments:
project -- filter by project (optional)
project_id -- filter by project (optional)
project -- backwards compatibility
In case of success, return a list of membership descriptions.
"""
project_id = project if project_id is None else project_id
req_headers = {'content-type': 'application/json'}
filters = {}
if project is not None:
filters["project"] = project
if project_id is not None:
filters["project"] = project_id
path = self.api_memberships
if filters:
path += '?' + urllib.urlencode(filters)
......
......@@ -133,18 +133,18 @@ retry=0, use_pool=False, pool_size=8, logger=None\ **)**
It returns user's current quotas (as dict of dicts). In case of error
it raises an AstakosClientException exception.
**service_get_quotas(**\ user=None, project=None\ **)**
**service_get_quotas(**\ user=None, project_id=None\ **)**
It returns all users' current quotas for the resources associated with
the service (as dict of dicts of dicts). Optionally, one can query the
quotas of a specific user with argument user=UUID (or a list of UUID).
Likewise one can specify a project (or a list of projects). In case of
error it raises an AstakosClientException exception.
**service_get_project_quotas(**\ project=None\ **)**
**service_get_project_quotas(**\ project_id=None\ **)**
It returns all projects' current quotas for the resources
associated with the service (as dict of dicts).
Optionally, one can query the quotas of a specific project with
argument project=UUID (or a list of UUID). In case of error it raises an
argument project_id=UUID (or a list of UUID). In case of error it raises an
AstakosClientException exception.
**issue_commission_generic(**\ user_provisions, project_provisions, name="", force=False, auto_accept=False\ **)**
......@@ -208,7 +208,7 @@ retry=0, use_pool=False, pool_size=8, logger=None\ **)**
**application_action(**\ project_id, app_id, action, reason=""\ **)**
Perform action on a project application
**get_memberships(**\ project=None\ **)**
**get_memberships(**\ project_id=None\ **)**
Retrieve all accessible memberships
**get_membership(**\ memb_id\ **)**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment