feat!(backend): unify script run and ad-hoc job run

This commit is contained in:
2026-04-05 04:10:59 +03:00
parent add1242b97
commit 8226429b5b
7 changed files with 95 additions and 174 deletions
+4 -30
View File
@@ -1651,7 +1651,7 @@ const docTemplate = `{
"Bearer": []
}
],
"description": "Loads a script from storage, resolves interpreter command, and executes on the specified agent",
"description": "Loads a script from storage, resolves interpreter command, and submits it to the agent",
"consumes": [
"application/json"
],
@@ -1671,7 +1671,7 @@ const docTemplate = `{
"required": true
},
{
"description": "Agent token and optional stdin",
"description": "Agent ID and optional stdin",
"name": "body",
"in": "body",
"required": true,
@@ -1684,7 +1684,7 @@ const docTemplate = `{
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/internal_handlers.RunScriptOut"
"$ref": "#/definitions/internal_handlers.AddJobOut"
}
},
"400": {
@@ -2118,7 +2118,7 @@ const docTemplate = `{
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/internal_handlers.RunScriptOut"
"$ref": "#/definitions/internal_handlers.AddJobOut"
}
}
}
@@ -2904,32 +2904,6 @@ const docTemplate = `{
}
}
},
"internal_handlers.RunScriptOut": {
"type": "object",
"properties": {
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"id": {
"type": "integer"
},
"status": {
"type": "integer"
},
"stderr": {
"type": "string"
},
"stdin": {
"type": "string"
},
"stdout": {
"type": "string"
}
}
},
"internal_handlers.RunStoredScriptIn": {
"type": "object",
"required": [
+4 -30
View File
@@ -1640,7 +1640,7 @@
"Bearer": []
}
],
"description": "Loads a script from storage, resolves interpreter command, and executes on the specified agent",
"description": "Loads a script from storage, resolves interpreter command, and submits it to the agent",
"consumes": [
"application/json"
],
@@ -1660,7 +1660,7 @@
"required": true
},
{
"description": "Agent token and optional stdin",
"description": "Agent ID and optional stdin",
"name": "body",
"in": "body",
"required": true,
@@ -1673,7 +1673,7 @@
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/internal_handlers.RunScriptOut"
"$ref": "#/definitions/internal_handlers.AddJobOut"
}
},
"400": {
@@ -2107,7 +2107,7 @@
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/internal_handlers.RunScriptOut"
"$ref": "#/definitions/internal_handlers.AddJobOut"
}
}
}
@@ -2893,32 +2893,6 @@
}
}
},
"internal_handlers.RunScriptOut": {
"type": "object",
"properties": {
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"id": {
"type": "integer"
},
"status": {
"type": "integer"
},
"stderr": {
"type": "string"
},
"stdin": {
"type": "string"
},
"stdout": {
"type": "string"
}
}
},
"internal_handlers.RunStoredScriptIn": {
"type": "object",
"required": [
+4 -21
View File
@@ -504,23 +504,6 @@ definitions:
- interpreter_id
- script_text
type: object
internal_handlers.RunScriptOut:
properties:
command:
items:
type: string
type: array
id:
type: integer
status:
type: integer
stderr:
type: string
stdin:
type: string
stdout:
type: string
type: object
internal_handlers.RunStoredScriptIn:
properties:
stdin:
@@ -1589,14 +1572,14 @@ paths:
consumes:
- application/json
description: Loads a script from storage, resolves interpreter command, and
executes on the specified agent
submits it to the agent
parameters:
- description: Script ID
in: path
name: id
required: true
type: integer
- description: Agent token and optional stdin
- description: Agent ID and optional stdin
in: body
name: body
required: true
@@ -1608,7 +1591,7 @@ paths:
"201":
description: Created
schema:
$ref: '#/definitions/internal_handlers.RunScriptOut'
$ref: '#/definitions/internal_handlers.AddJobOut'
"400":
description: Bad Request
schema:
@@ -1882,7 +1865,7 @@ paths:
"201":
description: Created
schema:
$ref: '#/definitions/internal_handlers.RunScriptOut'
$ref: '#/definitions/internal_handlers.AddJobOut'
security:
- Bearer: []
summary: Run a script on an agent