Esempio n. 1
0
 def get_all(self):
     """Lists all l7rules of a l7policy."""
     context = pecan.request.context.get('octavia_context')
     db_l7rules = self.repositories.l7rule.get_all(
         context.session, l7policy_id=self.l7policy_id)
     result = self._convert_db_to_type(db_l7rules,
                                       [l7rule_types.L7RuleResponse])
     return l7rule_types.L7RulesRootResponse(rules=result)
Esempio n. 2
0
    def get_all(self, fields=None):
        """Lists all l7rules of a l7policy."""
        pcontext = pecan.request.context
        context = pcontext.get('octavia_context')

        l7policy = self._get_db_l7policy(context.session, self.l7policy_id)

        self._auth_validate_action(context, l7policy.project_id,
                                   constants.RBAC_GET_ALL)

        db_l7rules, links = self.repositories.l7rule.get_all(
            context.session, show_deleted=False, l7policy_id=self.l7policy_id,
            pagination_helper=pcontext.get(constants.PAGINATION_HELPER))
        result = self._convert_db_to_type(
            db_l7rules, [l7rule_types.L7RuleResponse])
        if fields is not None:
            result = self._filter_fields(result, fields)
        return l7rule_types.L7RulesRootResponse(
            rules=result, rules_links=links)