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)
Merge "Add detailed list for instances"HEADmaster
-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 @@
1---
2features:
3 - |
4 Added ``detailed`` option to instances client in ``instances.list``
5 command. Now, detailed instance list can be obtained by setting
6 ``detailed`` parameter to ``True``. Trove will then include more details
7 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):
124 page_mock.assert_called_with("/instances", "instances", limit, marker, 124 page_mock.assert_called_with("/instances", "instances", limit, marker,
125 include_clustered) 125 include_clustered)
126 126
127 def test_detailed_list(self):
128 page_mock = mock.Mock()
129 self.instances._paginated = page_mock
130 limit = "test-limit"
131 marker = "test-marker"
132 include_clustered = {'include_clustered': False}
133 self.instances.list(limit, marker, detailed=True)
134 page_mock.assert_called_with("/instances/detail", "instances", limit,
135 marker, include_clustered)
136
127 def test_get(self): 137 def test_get(self):
128 def side_effect_func(path, inst): 138 def side_effect_func(path, inst):
129 return path, inst 139 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):
179 resp, body = self.api.client.patch(url, body=body) 179 resp, body = self.api.client.patch(url, body=body)
180 common.check_for_exceptions(resp, body, url) 180 common.check_for_exceptions(resp, body, url)
181 181
182 def list(self, limit=None, marker=None, include_clustered=False): 182 def list(self, limit=None, marker=None, include_clustered=False,
183 detailed=False):
183 """Get a list of all instances. 184 """Get a list of all instances.
184 185
185 :rtype: list of :class:`Instance`. 186 :rtype: list of :class:`Instance`.
186 """ 187 """
187 return self._paginated("/instances", "instances", limit, marker, 188 detail = "/detail" if detailed else ""
189 url = "/instances%s" % detail
190 return self._paginated(url, "instances", limit, marker,
188 {"include_clustered": include_clustered}) 191 {"include_clustered": include_clustered})
189 192
190 def get(self, instance): 193 def get(self, instance):