def get(self): logger.debug('args: {0}'.format(self._args)) if len(self._args) == 1: if self._args[0] == 'overview': # System overview users = User.objects.count() services = Service.objects.count() user_services = UserService.objects.exclude( state__in=(State.REMOVED, State.ERROR)).count() restrained_services_pools = len( DeployedService.getRestraineds()) return { 'users': users, 'services': services, 'user_services': user_services, 'restrained_services_pools': restrained_services_pools, } if len(self._args) == 2: if self._args[0] == 'stats': if self._args[1] == 'assigned': return getServicesPoolsCounters(None, counters.CT_ASSIGNED) if self._args[1] == 'inuse': return getServicesPoolsCounters(None, counters.CT_INUSE) raise RequestError('invalid request')
def get(self): logger.debug('args: {0}'.format(self._args)) if len(self._args) == 1: if self._args[0] == 'overview': # System overview users = User.objects.count() services = Service.objects.count() user_services = UserService.objects.count() restrained_services_pools = len(DeployedService.getRestraineds()) return { 'users': users, 'services': services, 'user_services': user_services, 'restrained_services_pools': restrained_services_pools, } if len(self._args) == 2: if self._args[0] == 'stats': if self._args[1] == 'assigned': return getServicesPoolsCounters(None, counters.CT_ASSIGNED) if self._args[1] == 'inuse': return getServicesPoolsCounters(None, counters.CT_INUSE) raise RequestError('invalid request')