From 9cbdfb2181f1d0acb303214deeee781f57ba48d9 Mon Sep 17 00:00:00 2001 From: mid_one Date: Tue, 4 Dec 2018 01:43:11 +0800 Subject: [PATCH] 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 --- neutronclient/v2_0/client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index 2c0d88ee8..560b531d0 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" @@ -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):