mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from jms_es_sdk import ESStore
|
|
from .base import CommandBase
|
|
|
|
|
|
class CommandStore(CommandBase, ESStore):
|
|
def __init__(self, params):
|
|
hosts = params.get('HOSTS', ['http://localhost'])
|
|
ESStore.__init__(self, hosts=hosts)
|
|
|
|
def save(self, command):
|
|
return ESStore.save(self, command)
|
|
|
|
def bulk_save(self, commands):
|
|
return ESStore.bulk_save(self, commands)
|
|
|
|
def filter(self, date_from=None, date_to=None,
|
|
user=None, asset=None, system_user=None,
|
|
input=None, session=None):
|
|
|
|
data = ESStore.filter(
|
|
self, date_from=date_from, date_to=date_to,
|
|
user=user, asset=asset, system_user=system_user,
|
|
input=input, session=session
|
|
)
|
|
return [item["_source"] for item in data["hits"] if item]
|
|
|
|
def count(self, date_from=None, date_to=None,
|
|
user=None, asset=None, system_user=None,
|
|
input=None, session=None):
|
|
amount = ESStore.count(
|
|
self, date_from=date_from, date_to=date_to,
|
|
user=user, asset=asset, system_user=system_user,
|
|
input=input, session=session
|
|
)
|
|
return amount
|