Просмотр исходного кода

Implementing actors that will carry out actions upon detection of an event

steve 8 лет назад
Родитель
Сommit
93aedbfd6e
1 измененных файлов с 31 добавлено и 0 удалено
  1. 31 0
      src/utils/agents/actor.py

+ 31 - 0
src/utils/agents/actor.py

@@ -0,0 +1,31 @@
+"""
+	This class is designed to be an actor class i.e it will undertake certain actions given an event detected
+	The platform has 2 main sections (detection & analysis).
+	Action Types (Actors):
+		- Alert : Sends an email or Webhook
+		- Apps 	: Kill, Start
+		- Folder: Archive, Delete (all, age, size)
+		
+	@TODO: 
+		- upgrade to python 3.x
+"""
+import json
+from threading import Thread
+class Actor(Thread):
+	def __init__(self,config):
+		pass
+	def init(self,config):
+		pass
+class Kill(Actor):
+	def __init__(self,config):
+		Actor.__init__(self,config)
+	def init (self,app):
+		pass
+class Start(Actor):
+	def __init__(self,config):
+		Actor.__init__(self,config)
+	def init(self,args):
+		path = args['path']
+		args = args['args'] if 'args' in args else ''
+class Alert(Actor):
+	pass