def test_stack_basic_details(self, mock_format_stack):
        stacks = [self.stack1]
        expected_keys = stacks_view.basic_keys

        stacks_view.collection(self.request, stacks)
        mock_format_stack.assert_called_once_with(self.request, self.stack1,
                                                  expected_keys)
    def test_stack_basic_details(self, mock_format_stack):
        stacks = [self.stack1]
        expected_keys = stacks_view.basic_keys

        stacks_view.collection(self.request, stacks)
        mock_format_stack.assert_called_once_with(self.request,
                                                  self.stack1,
                                                  expected_keys)
Ejemplo n.º 3
0
    def index(self, req):
        """
        Lists summary information for all stacks
        """
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        stacks = self.engine.list_stacks(req.context,
                                         filters=filter_params,
                                         **params)

        count = None
        if req.params.get('with_count'):
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.engine.count_stacks(req.context,
                                                 filters=filter_params)
            except AttributeError as exc:
                logger.warning("Old Engine Version: %s" % str(exc))

        return stacks_view.collection(req, stacks=stacks, count=count)
Ejemplo n.º 4
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
            'action': 'mixed',
            'tenant': 'mixed',
            'username': '******',
            'owner_id': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
            'show_nested': 'single',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        show_deleted = False
        if rpc_api.PARAM_SHOW_DELETED in params:
            params[rpc_api.PARAM_SHOW_DELETED] = param_utils.extract_bool(
                params[rpc_api.PARAM_SHOW_DELETED])
            show_deleted = params[rpc_api.PARAM_SHOW_DELETED]
        show_nested = False
        if rpc_api.PARAM_SHOW_NESTED in params:
            params[rpc_api.PARAM_SHOW_NESTED] = param_utils.extract_bool(
                params[rpc_api.PARAM_SHOW_NESTED])
            show_nested = params[rpc_api.PARAM_SHOW_NESTED]
        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get('with_count'):
            with_count = param_utils.extract_bool(req.params.get('with_count'))

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe,
                                                     show_deleted=show_deleted,
                                                     show_nested=show_nested)
            except AttributeError as exc:
                LOG.warn(_LW("Old Engine Version: %s") % exc)

        return stacks_view.collection(req,
                                      stacks=stacks,
                                      count=count,
                                      tenant_safe=tenant_safe)
Ejemplo n.º 5
0
    def index(self, req):
        """
        Lists summary information for all stacks
        """
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        stacks = self.engine.list_stacks(req.context,
                                         filters=filter_params,
                                         **params)

        count = None
        if req.params.get('with_count'):
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.engine.count_stacks(req.context,
                                                 filters=filter_params)
            except AttributeError as exc:
                logger.warning("Old Engine Version: %s" % str(exc))

        return stacks_view.collection(req, stacks=stacks, count=count)
Ejemplo n.º 6
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if req.params.get('with_count'):
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe)
            except AttributeError as exc:
                logger.warning("Old Engine Version: %s" % str(exc))

        return stacks_view.collection(req, stacks=stacks, count=count,
                                      tenant_safe=tenant_safe)
Ejemplo n.º 7
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if req.params.get('with_count'):
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe)
            except AttributeError as exc:
                logger.warning("Old Engine Version: %s" % str(exc))

        return stacks_view.collection(req, stacks=stacks, count=count,
                                      tenant_safe=tenant_safe)
Ejemplo n.º 8
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            'status': 'mixed',
            'name': 'mixed',
            'action': 'mixed',
            'tenant': 'mixed',
            'username': '******',
            'owner_id': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
            'show_nested': 'single',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        show_deleted = False
        if engine_api.PARAM_SHOW_DELETED in params:
            params[engine_api.PARAM_SHOW_DELETED] = param_utils.extract_bool(
                params[engine_api.PARAM_SHOW_DELETED])
            show_deleted = params[engine_api.PARAM_SHOW_DELETED]
        show_nested = False
        if engine_api.PARAM_SHOW_NESTED in params:
            params[engine_api.PARAM_SHOW_NESTED] = param_utils.extract_bool(
                params[engine_api.PARAM_SHOW_NESTED])
            show_nested = params[engine_api.PARAM_SHOW_NESTED]
        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get('with_count'):
            with_count = param_utils.extract_bool(
                req.params.get('with_count'))

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe,
                                                     show_deleted=show_deleted,
                                                     show_nested=show_nested)
            except AttributeError as exc:
                LOG.warn(_LW("Old Engine Version: %s") % exc)

        return stacks_view.collection(req, stacks=stacks, count=count,
                                      tenant_safe=tenant_safe)
Ejemplo n.º 9
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {"status": "mixed", "name": "mixed"}
        whitelist = {"limit": "single", "marker": "single", "sort_dir": "single", "sort_keys": "multi"}
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context, filters=filter_params, tenant_safe=tenant_safe, **params)

        count = None
        if req.params.get("with_count"):
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context, filters=filter_params, tenant_safe=tenant_safe)
            except AttributeError as exc:
                logger.warning(_("Old Engine Version: %s") % exc)

        return stacks_view.collection(req, stacks=stacks, count=count, tenant_safe=tenant_safe)
Ejemplo n.º 10
0
Archivo: stacks.py Proyecto: rmery/heat
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {"status": "mixed", "name": "mixed", "action": "mixed"}
        whitelist = {
            "limit": "single",
            "marker": "single",
            "sort_dir": "single",
            "sort_keys": "multi",
            "show_deleted": "single",
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        show_deleted = False
        if engine_api.PARAM_SHOW_DELETED in params:
            params[engine_api.PARAM_SHOW_DELETED] = param_utils.extract_bool(params[engine_api.PARAM_SHOW_DELETED])
            show_deleted = params[engine_api.PARAM_SHOW_DELETED]
        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get("with_count"):
            with_count = param_utils.extract_bool(req.params.get("with_count"))

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context, filters=filter_params, tenant_safe=tenant_safe, **params)

        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(
                    req.context, filters=filter_params, tenant_safe=tenant_safe, show_deleted=show_deleted
                )
            except AttributeError as exc:
                LOG.warning(_("Old Engine Version: %s") % exc)

        return stacks_view.collection(req, stacks=stacks, count=count, tenant_safe=tenant_safe)
 def test_doesnt_append_collection_links(self, mock_get_collection_links):
     stacks = [self.stack1]
     mock_get_collection_links.return_value = None
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertNotIn('links', stack_view)
Ejemplo n.º 12
0
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            # usage of keys in this list are not encouraged, please use
            # rpc_api.STACK_KEYS instead
            'id': 'mixed',
            'status': 'mixed',
            'name': 'mixed',
            'action': 'mixed',
            'tenant': 'mixed',
            'username': '******',
            'owner_id': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
            'show_nested': 'single',
            'show_hidden': 'single',
            'tags': 'single',
            'tags_any': 'single',
            'not_tags': 'single',
            'not_tags_any': 'single',
        }
        params = util.get_allowed_params(req.params, whitelist)
        stack_keys = dict.fromkeys(rpc_api.STACK_KEYS, 'mixed')
        unsupported = (
            rpc_api.STACK_ID,  # not user visible
            rpc_api.STACK_CAPABILITIES,  # not supported
            rpc_api.STACK_CREATION_TIME,  # don't support timestamp
            rpc_api.STACK_DELETION_TIME,  # don't support timestamp
            rpc_api.STACK_DESCRIPTION,  # not supported
            rpc_api.STACK_NOTIFICATION_TOPICS,  # not supported
            rpc_api.STACK_OUTPUTS,  # not in database
            rpc_api.STACK_PARAMETERS,  # not in this table
            rpc_api.STACK_TAGS,  # tags query following a specific guideline
            rpc_api.STACK_TMPL_DESCRIPTION,  # not supported
            rpc_api.STACK_UPDATED_TIME,  # don't support timestamp
        )
        for key in unsupported:
            stack_keys.pop(key)
        # downward compatibility
        stack_keys.update(filter_whitelist)
        filter_params = util.get_allowed_params(req.params, stack_keys)

        show_deleted = False
        p_name = rpc_api.PARAM_SHOW_DELETED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_deleted = params[p_name]

        show_nested = False
        p_name = rpc_api.PARAM_SHOW_NESTED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_nested = params[p_name]

        key = rpc_api.PARAM_LIMIT
        if key in params:
            params[key] = self._extract_int_param(key, params[key])

        show_hidden = False
        p_name = rpc_api.PARAM_SHOW_HIDDEN
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_hidden = params[p_name]

        tags = None
        if rpc_api.PARAM_TAGS in params:
            params[rpc_api.PARAM_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS])
            tags = params[rpc_api.PARAM_TAGS]

        tags_any = None
        if rpc_api.PARAM_TAGS_ANY in params:
            params[rpc_api.PARAM_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS_ANY])
            tags_any = params[rpc_api.PARAM_TAGS_ANY]

        not_tags = None
        if rpc_api.PARAM_NOT_TAGS in params:
            params[rpc_api.PARAM_NOT_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS])
            not_tags = params[rpc_api.PARAM_NOT_TAGS]

        not_tags_any = None
        if rpc_api.PARAM_NOT_TAGS_ANY in params:
            params[rpc_api.PARAM_NOT_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS_ANY])
            not_tags_any = params[rpc_api.PARAM_NOT_TAGS_ANY]

        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get('with_count'):
            with_count = self._extract_bool_param(
                'with_count',
                req.params.get('with_count'))

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe,
                                                     show_deleted=show_deleted,
                                                     show_nested=show_nested,
                                                     show_hidden=show_hidden,
                                                     tags=tags,
                                                     tags_any=tags_any,
                                                     not_tags=not_tags,
                                                     not_tags_any=not_tags_any)
            except AttributeError as ex:
                LOG.warn(_LW("Old Engine Version: %s"), ex)

        return stacks_view.collection(req, stacks=stacks, count=count,
                                      tenant_safe=tenant_safe)
 def test_appends_collection_count_of_zero(self, mock_get_collection_links):
     stacks = [self.stack1]
     count = 0
     stack_view = stacks_view.collection(self.request, stacks, count)
     self.assertIn('count', stack_view)
     self.assertEqual(0, stack_view['count'])
 def test_doesnt_append_collection_count(self, mock_get_collection_links):
     stacks = [self.stack1]
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertNotIn('count', stack_view)
 def test_doesnt_append_collection_links(self, mock_get_collection_links):
     stacks = [self.stack1]
     mock_get_collection_links.return_value = None
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertNotIn('links', stack_view)
 def test_append_collection_links(self, mock_get_collection_links):
     # If the page is full, assume a next page exists
     stacks = [self.stack1]
     mock_get_collection_links.return_value = 'fake links'
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertIn('links', stack_view)
 def test_stack_index(self):
     stacks = [self.stack1]
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertIn('stacks', stack_view)
     self.assertEqual(1, len(stack_view['stacks']))
Ejemplo n.º 18
0
    def _index(self, req, use_admin_cnxt=False):
        filter_whitelist = {
            # usage of keys in this list are not encouraged, please use
            # rpc_api.STACK_KEYS instead
            'id': util.PARAM_TYPE_MIXED,
            'status': util.PARAM_TYPE_MIXED,
            'name': util.PARAM_TYPE_MIXED,
            'action': util.PARAM_TYPE_MIXED,
            'tenant': util.PARAM_TYPE_MIXED,
            'username': util.PARAM_TYPE_MIXED,
            'owner_id': util.PARAM_TYPE_MIXED,
        }
        whitelist = {
            'limit': util.PARAM_TYPE_SINGLE,
            'marker': util.PARAM_TYPE_SINGLE,
            'sort_dir': util.PARAM_TYPE_SINGLE,
            'sort_keys': util.PARAM_TYPE_MULTI,
            'show_deleted': util.PARAM_TYPE_SINGLE,
            'show_nested': util.PARAM_TYPE_SINGLE,
            'show_hidden': util.PARAM_TYPE_SINGLE,
            'tags': util.PARAM_TYPE_SINGLE,
            'tags_any': util.PARAM_TYPE_SINGLE,
            'not_tags': util.PARAM_TYPE_SINGLE,
            'not_tags_any': util.PARAM_TYPE_SINGLE,
        }
        params = util.get_allowed_params(req.params, whitelist)
        stack_keys = dict.fromkeys(rpc_api.STACK_KEYS, util.PARAM_TYPE_MIXED)
        unsupported = (
            rpc_api.STACK_ID,  # not user visible
            rpc_api.STACK_CAPABILITIES,  # not supported
            rpc_api.STACK_CREATION_TIME,  # don't support timestamp
            rpc_api.STACK_DELETION_TIME,  # don't support timestamp
            rpc_api.STACK_DESCRIPTION,  # not supported
            rpc_api.STACK_NOTIFICATION_TOPICS,  # not supported
            rpc_api.STACK_OUTPUTS,  # not in database
            rpc_api.STACK_PARAMETERS,  # not in this table
            rpc_api.STACK_TAGS,  # tags query following a specific guideline
            rpc_api.STACK_TMPL_DESCRIPTION,  # not supported
            rpc_api.STACK_UPDATED_TIME,  # don't support timestamp
        )
        for key in unsupported:
            stack_keys.pop(key)
        # downward compatibility
        stack_keys.update(filter_whitelist)
        filter_params = util.get_allowed_params(req.params, stack_keys)

        show_deleted = False
        p_name = rpc_api.PARAM_SHOW_DELETED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_deleted = params[p_name]

        show_nested = False
        p_name = rpc_api.PARAM_SHOW_NESTED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_nested = params[p_name]

        key = rpc_api.PARAM_LIMIT
        if key in params:
            params[key] = self._extract_int_param(key, params[key])

        show_hidden = False
        p_name = rpc_api.PARAM_SHOW_HIDDEN
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_hidden = params[p_name]

        tags = None
        if rpc_api.PARAM_TAGS in params:
            params[rpc_api.PARAM_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS])
            tags = params[rpc_api.PARAM_TAGS]

        tags_any = None
        if rpc_api.PARAM_TAGS_ANY in params:
            params[rpc_api.PARAM_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS_ANY])
            tags_any = params[rpc_api.PARAM_TAGS_ANY]

        not_tags = None
        if rpc_api.PARAM_NOT_TAGS in params:
            params[rpc_api.PARAM_NOT_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS])
            not_tags = params[rpc_api.PARAM_NOT_TAGS]

        not_tags_any = None
        if rpc_api.PARAM_NOT_TAGS_ANY in params:
            params[rpc_api.PARAM_NOT_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS_ANY])
            not_tags_any = params[rpc_api.PARAM_NOT_TAGS_ANY]

        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get('with_count'):
            with_count = self._extract_bool_param('with_count',
                                                  req.params.get('with_count'))

        if not filter_params:
            filter_params = None

        if use_admin_cnxt:
            cnxt = context.get_admin_context()
        else:
            cnxt = req.context

        stacks = self.rpc_client.list_stacks(cnxt,
                                             filters=filter_params,
                                             **params)
        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(cnxt,
                                                     filters=filter_params,
                                                     show_deleted=show_deleted,
                                                     show_nested=show_nested,
                                                     show_hidden=show_hidden,
                                                     tags=tags,
                                                     tags_any=tags_any,
                                                     not_tags=not_tags,
                                                     not_tags_any=not_tags_any)
            except AttributeError as ex:
                LOG.warning("Old Engine Version: %s", ex)

        return stacks_view.collection(req,
                                      stacks=stacks,
                                      count=count,
                                      include_project=cnxt.is_admin)
 def test_append_collection_count(self, mock_get_collection_links):
     stacks = [self.stack1]
     count = 1
     stack_view = stacks_view.collection(self.request, stacks, count)
     self.assertIn("count", stack_view)
     self.assertEqual(1, stack_view["count"])
 def test_appends_collection_count_of_zero(self, mock_get_collection_links):
     stacks = [self.stack1]
     count = 0
     stack_view = stacks_view.collection(self.request, stacks, count)
     self.assertIn('count', stack_view)
     self.assertEqual(0, stack_view['count'])
 def test_doesnt_append_collection_count(self, mock_get_collection_links):
     stacks = [self.stack1]
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertNotIn('count', stack_view)
 def test_append_collection_links(self, mock_get_collection_links):
     # If the page is full, assume a next page exists
     stacks = [self.stack1]
     mock_get_collection_links.return_value = 'fake links'
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertIn('links', stack_view)
 def test_stack_index(self):
     stacks = [self.stack1]
     stack_view = stacks_view.collection(self.request, stacks)
     self.assertIn('stacks', stack_view)
     self.assertEqual(1, len(stack_view['stacks']))
Ejemplo n.º 24
0
Archivo: stacks.py Proyecto: srz01/heat
    def _index(self, req, tenant_safe=True):
        filter_whitelist = {
            'id': 'mixed',
            'status': 'mixed',
            'name': 'mixed',
            'action': 'mixed',
            'tenant': 'mixed',
            'username': '******',
            'owner_id': 'mixed',
        }
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
            'show_nested': 'single',
            'show_hidden': 'single',
            'tags': 'single',
            'tags_any': 'single',
            'not_tags': 'single',
            'not_tags_any': 'single',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)

        show_deleted = False
        p_name = rpc_api.PARAM_SHOW_DELETED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_deleted = params[p_name]

        show_nested = False
        p_name = rpc_api.PARAM_SHOW_NESTED
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_nested = params[p_name]

        key = rpc_api.PARAM_LIMIT
        if key in params:
            params[key] = self._extract_int_param(key, params[key])

        show_hidden = False
        p_name = rpc_api.PARAM_SHOW_HIDDEN
        if p_name in params:
            params[p_name] = self._extract_bool_param(p_name, params[p_name])
            show_hidden = params[p_name]

        tags = None
        if rpc_api.PARAM_TAGS in params:
            params[rpc_api.PARAM_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS])
            tags = params[rpc_api.PARAM_TAGS]

        tags_any = None
        if rpc_api.PARAM_TAGS_ANY in params:
            params[rpc_api.PARAM_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_TAGS_ANY])
            tags_any = params[rpc_api.PARAM_TAGS_ANY]

        not_tags = None
        if rpc_api.PARAM_NOT_TAGS in params:
            params[rpc_api.PARAM_NOT_TAGS] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS])
            not_tags = params[rpc_api.PARAM_NOT_TAGS]

        not_tags_any = None
        if rpc_api.PARAM_NOT_TAGS_ANY in params:
            params[rpc_api.PARAM_NOT_TAGS_ANY] = self._extract_tags_param(
                params[rpc_api.PARAM_NOT_TAGS_ANY])
            not_tags_any = params[rpc_api.PARAM_NOT_TAGS_ANY]

        # get the with_count value, if invalid, raise ValueError
        with_count = False
        if req.params.get('with_count'):
            with_count = self._extract_bool_param(
                'with_count',
                req.params.get('with_count'))

        if not filter_params:
            filter_params = None

        stacks = self.rpc_client.list_stacks(req.context,
                                             filters=filter_params,
                                             tenant_safe=tenant_safe,
                                             **params)

        count = None
        if with_count:
            try:
                # Check if engine has been updated to a version with
                # support to count_stacks before trying to use it.
                count = self.rpc_client.count_stacks(req.context,
                                                     filters=filter_params,
                                                     tenant_safe=tenant_safe,
                                                     show_deleted=show_deleted,
                                                     show_nested=show_nested,
                                                     show_hidden=show_hidden,
                                                     tags=tags,
                                                     tags_any=tags_any,
                                                     not_tags=not_tags,
                                                     not_tags_any=not_tags_any)
            except AttributeError as ex:
                LOG.warn(_LW("Old Engine Version: %s"), ex)

        return stacks_view.collection(req, stacks=stacks, count=count,
                                      tenant_safe=tenant_safe)