mirror of
https://github.com/FunnyWolf/agentic-soc-platform.git
synced 2026-08-22 13:12:56 +02:00
22 lines
823 B
Python
22 lines
823 B
Python
# Create your views here.
|
|
from rest_framework.response import Response
|
|
|
|
from Automation.Handle.playbook import Playbook
|
|
from Lib.api import data_return
|
|
from Lib.baseview import BaseView
|
|
from Lib.configs import CODE_MSG_ZH, CODE_MSG_EN
|
|
from Lib.log import logger
|
|
|
|
|
|
class PlaybookView(BaseView):
|
|
def create(self, request, **kwargs):
|
|
try:
|
|
playbook = request.data.get('playbook')
|
|
name = request.data.get('playbook_name')
|
|
type = request.data.get('playbook_type')
|
|
context = Playbook.create(playbook=playbook, params=request.data, name=name, type=type)
|
|
except Exception as E:
|
|
logger.exception(E)
|
|
context = data_return(500, {"status": "Failed", "job_id": None}, CODE_MSG_ZH.get(500), CODE_MSG_EN.get(500))
|
|
return Response(context)
|