mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
[Feature] 支持es存储
This commit is contained in:
27
apps/terminal/backends/command/multi.py
Normal file
27
apps/terminal/backends/command/multi.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from .base import CommandBase
|
||||
|
||||
|
||||
class CommandStore(CommandBase):
|
||||
def __init__(self, storage_list):
|
||||
self.storage_list = storage_list
|
||||
|
||||
def filter(self, **kwargs):
|
||||
queryset = []
|
||||
for storage in self.storage_list:
|
||||
queryset.extend(storage.filter(**kwargs))
|
||||
return sorted(queryset, key=lambda command: command["timestamp"])
|
||||
|
||||
def count(self, **kwargs):
|
||||
amount = 0
|
||||
for storage in self.storage_list:
|
||||
amount += storage.count(**kwargs)
|
||||
return amount
|
||||
|
||||
def save(self, command):
|
||||
pass
|
||||
|
||||
def bulk_save(self, commands):
|
||||
pass
|
||||
Reference in New Issue
Block a user