summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceilometerclient/tests/v2/test_resources.py8
-rw-r--r--ceilometerclient/v2/resources.py5
2 files changed, 7 insertions, 6 deletions
diff --git a/ceilometerclient/tests/v2/test_resources.py b/ceilometerclient/tests/v2/test_resources.py
index 090ce8c..7d4066a 100644
--- a/ceilometerclient/tests/v2/test_resources.py
+++ b/ceilometerclient/tests/v2/test_resources.py
@@ -19,7 +19,7 @@ import ceilometerclient.v2.resources
fixtures = {
- '/v2/resources': {
+ '/v2/resources?meter_links=1': {
'GET': (
{},
[
@@ -38,7 +38,7 @@ fixtures = {
]
),
},
- '/v2/resources?q.field=resource_id&q.op=&q.type=&q.value=a':
+ '/v2/resources?q.field=resource_id&q.op=&q.type=&q.value=a&meter_links=1':
{
'GET': (
{},
@@ -78,7 +78,7 @@ class ResourceManagerTest(utils.BaseTestCase):
def test_list_all(self):
resources = list(self.mgr.list())
expect = [
- 'GET', '/v2/resources'
+ 'GET', '/v2/resources?meter_links=1'
]
self.http_client.assert_called(*expect)
self.assertEqual(len(resources), 2)
@@ -100,7 +100,7 @@ class ResourceManagerTest(utils.BaseTestCase):
]))
expect = [
'GET', '/v2/resources?q.field=resource_id&q.op='
- '&q.type=&q.value=a'
+ '&q.type=&q.value=a&meter_links=1'
]
self.http_client.assert_called(*expect)
self.assertEqual(len(resources), 1)
diff --git a/ceilometerclient/v2/resources.py b/ceilometerclient/v2/resources.py
index 99e6fd5..9bfd25b 100644
--- a/ceilometerclient/v2/resources.py
+++ b/ceilometerclient/v2/resources.py
@@ -30,9 +30,10 @@ class Resource(base.Resource):
class ResourceManager(base.Manager):
resource_class = Resource
- def list(self, q=None):
+ def list(self, q=None, links=True):
path = '/v2/resources'
- return self._list(options.build_url(path, q))
+ params = ['meter_links=%d' % (1 if links else 0)]
+ return self._list(options.build_url(path, q, params))
def get(self, resource_id):
path = '/v2/resources/%s' % resource_id