main
py 82 lines 2.83 KB
Raw
1 # from loguru import logger
2
3 # from app.connectors.shuffle.schema.singul import SingulRequest
4 # from app.connectors.shuffle.utils.universal import get_shuffle_org_id
5 # from app.connectors.shuffle.utils.universal import get_singul_client
6
7 # async def execute_singul(
8 # request: SingulRequest,
9 # ) -> dict:
10 # """
11 # Execute a Singul integration.
12
13 # Args:
14 # request (SingulRequest): The request object containing the workflow ID.
15
16 # Returns:
17 # dict: The response containing the execution ID.
18 # """
19 # logger.info("Executing Singul integration")
20
21 # # Get Singul client from database credentials
22 # singul = await get_singul_client()
23
24 # try:
25 # response = singul.connect(
26 # app=request.app,
27 # action="send_message",
28 # org_id=await get_shuffle_org_id(),
29 # environment="REPLACE_ME",
30 # fields=[
31 # {"key": "to", "value": "walton.taylor23@gmail.com"},
32 # {"key": "subject", "value": "Test Email from Singul"},
33 # {"key": "body", "value": "This is a test email sent from Singul."},
34 # ],
35 # )
36 # logger.info(f"Singul response: {response}")
37 # logger.info(f"Singul response success: {response.get('success', 'unknown')}")
38
39 # return {
40 # "executionId": response.get("id", "unknown"),
41 # "message": "Singul integration executed successfully",
42 # }
43 # except Exception as e:
44 # logger.error(f"Failed to execute Singul integration: {e}")
45 # return {"executionId": "unknown", "message": f"Singul integration failed: {e}", "success": False}
46
47
48 # async def execute_singul(
49 # request: SingulRequest,
50 # ) -> dict:
51 # """
52 # Execute a Singul integration.
53
54 # Args:
55 # request (SingulRequest): The request object containing the workflow ID.
56
57 # Returns:
58 # dict: The response containing the execution ID.
59 # """
60 # logger.info("Executing Singul integration")
61
62 # # Get Singul client from database credentials
63 # singul = await get_singul_client()
64
65 # try:
66 # response = singul.connect(
67 # app="opencti",
68 # action="get_ioc",
69 # org_id=await get_shuffle_org_id(),
70 # environment="THREATINTEL",
71 # fields=[{"key": "ip", "value": "185.215.113.75"}],
72 # )
73 # logger.info(f"Singul response: {response}")
74 # logger.info(f"Singul response success: {response.get('success', 'unknown')}")
75
76 # return {
77 # "executionId": response.get("id", "unknown"),
78 # "message": "Singul integration executed successfully",
79 # }
80 # except Exception as e:
81 # logger.error(f"Failed to execute Singul integration: {e}")
82 # return {"executionId": "unknown", "message": f"Singul integration failed: {e}", "success": False}