def list(self, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, all_tenants=False): """Retrieve a list of containers. :param all_tenants: Optional, list containers in all tenants :param marker: Optional, the UUID of a containers, eg the last containers from a previous result set. Return the next result set. :param limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of containers to return. 2) limit == 0, return the entire list of containers. 3) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the ZUN API (see Zun's api.max_limit option). :param sort_key: Optional, field used for sorting. :param sort_dir: Optional, direction of sorting, either 'asc' (the default) or 'desc'. :param detail: Optional, boolean whether to return detailed information about containers. :returns: A list of containers. """ if limit is not None: limit = int(limit) filters = utils.common_filters(marker, limit, sort_key, sort_dir, all_tenants) path = '' if detail: path += 'detail' if filters: path += '?' + '&'.join(filters) LOG.debug( 'zunclient paymentmethod paymentmethod path=%s, xxx list args xxx yyyy zzzzzzzzzzz', self._path(path)) if limit is None: return self._list(self._path(path), "paymentmethods") else: return self._list_pagination(self._path(path), "paymentmethods", limit=limit)
def list(self, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False): """Retrieve list of zun services. :param marker: Optional, the ID of a zun service, eg the last services from a previous result set. Return the next result set. :param limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of services to return. 2) limit == 0, return the entire list of services. 3) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Zun API (see Zun's api.max_limit option). :param sort_key: Optional, field used for sorting. :param sort_dir: Optional, direction of sorting, either 'asc' (the default) or 'desc'. :param detail: Optional, boolean whether to return detailed information about services. :returns: A list of services. """ if limit is not None: limit = int(limit) filters = utils.common_filters(marker, limit, sort_key, sort_dir) path = '' if detail: path += 'detail' if filters: path += '?' + '&'.join(filters) if limit is None: return self._list(self._path(path), "services") else: return self._list_pagination(self._path(path), "services", limit=limit)
def list(self, marker=None, limit=None, sort_key=None, sort_dir=None, all_projects=False, **kwargs): """Retrieve a list of containers. :param all_projects: Optional, list containers in all projects :param marker: Optional, the UUID of a containers, eg the last containers from a previous result set. Return the next result set. :param limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of containers to return. 2) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the ZUN API (see Zun's api.max_limit option). :param sort_key: Optional, field used for sorting. :param sort_dir: Optional, direction of sorting, either 'asc' (the default) or 'desc'. :returns: A list of containers. """ if limit is not None: limit = int(limit) filters = utils.common_filters(marker, limit, sort_key, sort_dir, all_projects) path = '' if filters: path += '?' + '&'.join(filters) if limit is None: return self._list(self._path(path), "containers", qparams=kwargs) else: return self._list_pagination(self._path(path), "containers", limit=limit)
def list(self, marker=None, limit=None, sort_key=None, sort_dir=None, all_projects=False): """Retrieve a list of capsules. :param all_projects: Optional, list containers in all projects :param marker: Optional, the UUID of a containers, eg the last containers from a previous result set. Return the next result set. :param limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of containers to return. 2) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the ZUN API (see Zun's api.max_limit option). :param sort_key: Optional, field used for sorting. :param sort_dir: Optional, direction of sorting, either 'asc' (the default) or 'desc'. :returns: A list of containers. """ if limit is not None: limit = int(limit) filters = utils.common_filters(marker, limit, sort_key, sort_dir, all_projects) path = '' if filters: path += '?' + '&'.join(filters) if limit is None: return self._list(self._path(path), "capsules") else: return self._list_pagination(self._path(path), "capsules", limit=limit)
def list(self, marker=None, limit=None, sort_key=None, sort_dir=None): """Retrieve a list of hosts. :param marker: Optional, the UUID of an host, eg the last host from a previous result set. Return the next result set. :param limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of hosts to return. 2) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Zun api :param sort_key: Optional, field used for sorting. :param sort_dir: Optional, direction of sorting, either 'asc' (the default) or 'desc'. :returns: A list of hosts. """ if limit is not None: limit = int(limit) filters = utils.common_filters(marker, limit, sort_key, sort_dir) path = '' if filters: path += '?' + '&'.join(filters) if limit is None: return self._list(self._path(path), "hosts") else: return self._list_pagination(self._path(path), "hosts", limit=limit)
def test_other(self): for key in ('marker', 'sort_key', 'sort_dir'): result = utils.common_filters(**{key: 'test'}) self.assertEqual(['%s=test' % key], result)
def test_limit_negative_number(self): result = utils.common_filters(limit=-2) self.assertEqual(['limit=-2'], result)
def test_limit_0(self): result = utils.common_filters(limit=0) self.assertEqual(['limit=0'], result)