summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormid_one <chenjie.xu@intel.com>2018-12-04 01:43:11 +0800
committermid_one <chenjie.xu@intel.com>2018-12-14 19:18:40 +0800
commit9cbdfb2181f1d0acb303214deeee781f57ba48d9 (patch)
tree447e67efe458b6586520cf02df389e4fef514cc6
parenta8720c3c4dfa8b5075685edbdfa1553fb0f7cbdf (diff)
downloadpython-neutronclient-9cbdfb2181f1d0acb303214deeee781f57ba48d9.tar.gz
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
-rw-r--r--neutronclient/v2_0/client.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py
index 2c0d88e..560b531 100644
--- a/neutronclient/v2_0/client.py
+++ b/neutronclient/v2_0/client.py
@@ -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"
@@ -755,6 +756,13 @@ class Client(ClientBase):
@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):
"""Fetch information of a certain project's default quotas."""
return self.get(self.quota_default_path % (project_id), params=_params)