summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-19 19:04:40 +0000
committerGerrit Code Review <review@openstack.org>2018-10-19 19:04:40 +0000
commitba873aef344149abdf8b490de8d9f82c49bbf82a (patch)
tree142ad3dd5a85d6a93cdd387c53e5689cc3b87503
parent8afd48b6962f64259a9da3434514fe0c4eadef54 (diff)
parentd2220578ffeaf59532ab3e29cd7ad38cef6c7eb7 (diff)
downloadpython-troveclient-ba873aef344149abdf8b490de8d9f82c49bbf82a.tar.gz
Merge "Add detailed list for instances"2.17.0
-rw-r--r--releasenotes/notes/add-instance-detailed-list-23dc77ed898cc6db.yaml7
-rw-r--r--troveclient/tests/test_instances.py10
-rw-r--r--troveclient/v1/instances.py7
3 files changed, 22 insertions, 2 deletions
diff --git a/releasenotes/notes/add-instance-detailed-list-23dc77ed898cc6db.yaml b/releasenotes/notes/add-instance-detailed-list-23dc77ed898cc6db.yaml
new file mode 100644
index 0000000..96b5ad5
--- /dev/null
+++ b/releasenotes/notes/add-instance-detailed-list-23dc77ed898cc6db.yaml
@@ -0,0 +1,7 @@
+---
+features:
+ - |
+ Added ``detailed`` option to instances client in ``instances.list``
+ command. Now, detailed instance list can be obtained by setting
+ ``detailed`` parameter to ``True``. Trove will then include more details
+ in the API response.
diff --git a/troveclient/tests/test_instances.py b/troveclient/tests/test_instances.py
index b65583d..2f21cac 100644
--- a/troveclient/tests/test_instances.py
+++ b/troveclient/tests/test_instances.py
@@ -124,6 +124,16 @@ class InstancesTest(testtools.TestCase):
page_mock.assert_called_with("/instances", "instances", limit, marker,
include_clustered)
+ def test_detailed_list(self):
+ page_mock = mock.Mock()
+ self.instances._paginated = page_mock
+ limit = "test-limit"
+ marker = "test-marker"
+ include_clustered = {'include_clustered': False}
+ self.instances.list(limit, marker, detailed=True)
+ page_mock.assert_called_with("/instances/detail", "instances", limit,
+ marker, include_clustered)
+
def test_get(self):
def side_effect_func(path, inst):
return path, inst
diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py
index 04eb05a..eb5aec8 100644
--- a/troveclient/v1/instances.py
+++ b/troveclient/v1/instances.py
@@ -179,12 +179,15 @@ class Instances(base.ManagerWithFind):
resp, body = self.api.client.patch(url, body=body)
common.check_for_exceptions(resp, body, url)
- def list(self, limit=None, marker=None, include_clustered=False):
+ def list(self, limit=None, marker=None, include_clustered=False,
+ detailed=False):
"""Get a list of all instances.
:rtype: list of :class:`Instance`.
"""
- return self._paginated("/instances", "instances", limit, marker,
+ detail = "/detail" if detailed else ""
+ url = "/instances%s" % detail
+ return self._paginated(url, "instances", limit, marker,
{"include_clustered": include_clustered})
def get(self, instance):