Add support for querying quotas with usage

The neutron HTTP API supports issuing a GET call
on /v2.0/quotas/{project_id}/details.json in order
to obtain quotas with usage information for a
given tenant. However, this capability is not
currently exposed in the python-neutronclient code.

Add path: quota_details_path
Add function show_quota_details

Closes-Bug: #1808451
Related-Bug: #1599488
Change-Id: Ia02172f62b9d9915273021627b0feb52a4f376da
This commit is contained in:
mid_one 2018-12-04 01:43:11 +08:00
parent a8720c3c4d
commit 9cbdfb2181
1 changed files with 8 additions and 0 deletions

View File

@ -501,6 +501,7 @@ class Client(ClientBase):
quotas_path = "/quotas"
quota_path = "/quotas/%s"
quota_default_path = "/quotas/%s/default"
quota_details_path = "/quotas/%s/details.json"
extensions_path = "/extensions"
extension_path = "/extensions/%s"
routers_path = "/routers"
@ -753,6 +754,13 @@ class Client(ClientBase):
"""Fetch information of a certain project's quotas."""
return self.get(self.quota_path % (project_id), params=_params)
@debtcollector.renames.renamed_kwarg(
'tenant_id', 'project_id', replace=True)
def show_quota_details(self, project_id, **_params):
"""Fetch information of a certain project's quota details."""
return self.get(self.quota_details_path % (project_id),
params=_params)
@debtcollector.renames.renamed_kwarg(
'tenant_id', 'project_id', replace=True)
def show_quota_default(self, project_id, **_params):