예제 #1
0
파일: users.py 프로젝트: openstack/bilean
    def index(self, req):
        filter_whitelist = {
            'status': 'mixed',
        }
        param_whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        key = consts.PARAM_SHOW_DELETED
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None

        users = self.rpc_client.user_list(req.context, filters=filters,
                                          **params)

        return {'users': users}
예제 #2
0
    def index(self, req):
        """Lists summary information for all resources"""
        filter_whitelist = {
            'resource_type': 'mixed',
            'rule_id': 'mixed',
        }
        param_whitelist = {
            'user_id': 'single',
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        key = consts.PARAM_SHOW_DELETED
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None
        resources = self.rpc_client.resource_list(req.context, filters=filters,
                                                  **params)

        return {'resources': resources}
예제 #3
0
    def index(self, req):
        """List summary information for all policies"""
        filter_whitelist = {
            'name': 'mixed',
            'metadata': 'mixed',
        }
        param_whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        key = consts.PARAM_SHOW_DELETED
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None

        policies = self.rpc_client.policy_list(req.context,
                                               filters=filters,
                                               **params)

        return {'policies': policies}
예제 #4
0
    def index(self, req):
        filter_whitelist = {
            'status': 'mixed',
        }
        param_whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        key = consts.PARAM_SHOW_DELETED
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None

        users = self.rpc_client.user_list(req.context,
                                          filters=filters,
                                          **params)

        return {'users': users}
예제 #5
0
    def statistics(self, req):
        '''Consumptions statistics.'''
        filter_whitelist = {
            'resource_type': 'mixed',
        }
        param_whitelist = {
            'user_id': 'single',
            'start_time': 'single',
            'end_time': 'single',
            'summary': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_SUMMARY
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None
        statistics = self.rpc_client.consumption_statistics(req.context,
                                                            filters=filters,
                                                            **params)

        return {'statistics': statistics}
예제 #6
0
    def index(self, req):
        """Lists all consumptions."""
        filter_whitelist = {
            'resource_type': 'mixed',
        }
        param_whitelist = {
            'user_id': 'single',
            'start_time': 'single',
            'end_time': 'single',
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        if not filters:
            filters = None
        consumptions = self.rpc_client.consumption_list(req.context,
                                                        filters=filters,
                                                        **params)

        return {'consumptions': consumptions}
예제 #7
0
    def index(self, req, tenant_id):
        """Lists summary information for all events"""
        filter_whitelist = {
            'resource_type': 'mixed',
            'action': 'single',
        }
        param_whitelist = {
            'user_id': 'single',
            'start_time': 'single',
            'end_time': 'single',
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
            'show_deleted': 'single',
        }
        params = util.get_allowed_params(req.params, param_whitelist)
        filters = util.get_allowed_params(req.params, filter_whitelist)

        key = consts.PARAM_LIMIT
        if key in params:
            params[key] = utils.parse_int_param(key, params[key])

        key = consts.PARAM_SHOW_DELETED
        if key in params:
            params[key] = utils.parse_bool_param(key, params[key])

        if not filters:
            filters = None

        events = self.rpc_client.event_list(req.context,
                                            filters=filters,
                                            **params)
        return {'events': events}