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}
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}
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}
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}
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}
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}