Merge "Add detailed list for instances"
This commit is contained in:
commit
ba873aef34
|
@ -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.
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue