diff --git a/otcextensions/sdk/css/v1/_proxy.py b/otcextensions/sdk/css/v1/_proxy.py index b65c21943..e06c2ef0e 100644 --- a/otcextensions/sdk/css/v1/_proxy.py +++ b/otcextensions/sdk/css/v1/_proxy.py @@ -30,13 +30,13 @@ def __init__(self, session, *args, **kwargs): "Content-type": "application/json"} # ======== Cluster ======== - def clusters(self): + def clusters(self, **query): """List all Clusters. :returns: a generator of (:class:`~otcextensions.sdk.css.v1.cluster.Cluster`) instances """ - return self._list(_cluster.Cluster) + return self._list(_cluster.Cluster, **query) def get_cluster(self, cluster): """Get the cluster by UUID diff --git a/otcextensions/sdk/css/v1/cluster.py b/otcextensions/sdk/css/v1/cluster.py index 1e03fdaa6..af2b3e528 100644 --- a/otcextensions/sdk/css/v1/cluster.py +++ b/otcextensions/sdk/css/v1/cluster.py @@ -64,6 +64,9 @@ class Cluster(resource.Resource): allow_fetch = True allow_patch = True + _query_mapping = resource.QueryParameters( + 'id', 'start', 'limit') + # Properties #: Current actions actions = resource.Body('actions', type=list) diff --git a/otcextensions/tests/unit/sdk/css/v1/test_cluster.py b/otcextensions/tests/unit/sdk/css/v1/test_cluster.py index a33485b26..c2b08765f 100644 --- a/otcextensions/tests/unit/sdk/css/v1/test_cluster.py +++ b/otcextensions/tests/unit/sdk/css/v1/test_cluster.py @@ -75,6 +75,11 @@ def test_basic(self): self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_commit) + self.assertDictEqual({'id': 'id', + 'start': 'start', + 'limit': 'limit', + 'marker': 'marker'}, + sot._query_mapping._mapping) def test_make_it(self): sot = cluster.Cluster(**EXAMPLE) diff --git a/otcextensions/tests/unit/sdk/css/v1/test_proxy.py b/otcextensions/tests/unit/sdk/css/v1/test_proxy.py index 3cfe51d7d..69cb56058 100644 --- a/otcextensions/tests/unit/sdk/css/v1/test_proxy.py +++ b/otcextensions/tests/unit/sdk/css/v1/test_proxy.py @@ -34,7 +34,20 @@ def setUp(self): ) def test_clusters(self): - self.verify_list(self.proxy.clusters, _cluster.Cluster) + self.verify_list( + self.proxy.clusters, + _cluster.Cluster, + method_kwargs={ + 'id': 'foo', + 'start': 999, + 'limit': 666 + }, + expected_kwargs={ + 'id': 'foo', + 'start': 999, + 'limit': 666 + } + ) def test_get_cluster(self): self.verify_get(self.proxy.get_cluster, _cluster.Cluster)