1
1
from pydantic import BaseModel , Field
2
2
from utils .request import get_slce_api
3
3
from tools import Tool , ABCTool , tools
4
- from urllib . parse import urlparse
4
+
5
5
@tools .register
6
- class CreateHttpApplication (BaseModel , ABCTool ):
6
+ class GetAttackEvents (BaseModel , ABCTool ):
7
7
ip : str = Field (default = "" , description = "the attacker's client IP address" )
8
8
size : int = Field (default = 10 , min = 1 , max = 100 , description = "the number of results to return" )
9
9
start : str = Field (default = "" , description = "start time, millisecond timestamp" )
@@ -12,13 +12,9 @@ class CreateHttpApplication(BaseModel, ABCTool):
12
12
@classmethod
13
13
async def run (self , arguments :dict ) -> str :
14
14
try :
15
- req = CreateHttpApplication .model_validate (arguments )
16
- parsed_upstream = urlparse (req .upstream )
17
- if parsed_upstream .scheme not in ["https" , "http" ]:
18
- return "invalid upstream scheme"
19
-
20
- if parsed_upstream .hostname == "" :
21
- return "invalid upstream host"
15
+ req = GetAttackEvents .model_validate (arguments )
16
+ if req .size < 1 or req .size > 100 :
17
+ return "size must be between 1 and 100"
22
18
except Exception as e :
23
19
return str (e )
24
20
0 commit comments