This commit is contained in:
+246
-10
@@ -348,13 +348,7 @@ definitions:
|
||||
type: array
|
||||
id:
|
||||
type: integer
|
||||
status:
|
||||
type: integer
|
||||
stderr:
|
||||
type: string
|
||||
stdin:
|
||||
type: string
|
||||
stdout:
|
||||
wait_url:
|
||||
type: string
|
||||
type: object
|
||||
internal_handlers.AgentInfo:
|
||||
@@ -380,6 +374,35 @@ definitions:
|
||||
example: agent-001
|
||||
type: string
|
||||
type: object
|
||||
internal_handlers.CheckCmdIn:
|
||||
properties:
|
||||
command:
|
||||
example: bash
|
||||
type: string
|
||||
required:
|
||||
- command
|
||||
type: object
|
||||
internal_handlers.CheckCmdOut:
|
||||
properties:
|
||||
exists:
|
||||
type: boolean
|
||||
type: object
|
||||
internal_handlers.CreateFolderRequest:
|
||||
properties:
|
||||
path:
|
||||
example: deploy/nginx
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
internal_handlers.DeleteFolderRequest:
|
||||
properties:
|
||||
path:
|
||||
example: deploy/nginx
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
internal_handlers.InsertLogRequest:
|
||||
properties:
|
||||
agent:
|
||||
@@ -407,6 +430,36 @@ definitions:
|
||||
required:
|
||||
- logs
|
||||
type: object
|
||||
internal_handlers.JobMetricsOut:
|
||||
properties:
|
||||
failed:
|
||||
type: integer
|
||||
pending:
|
||||
type: integer
|
||||
period:
|
||||
type: string
|
||||
success:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
internal_handlers.JobResult:
|
||||
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.RegisterRequest:
|
||||
properties:
|
||||
csr:
|
||||
@@ -465,6 +518,13 @@ definitions:
|
||||
required:
|
||||
- token
|
||||
type: object
|
||||
internal_handlers.WaitJobIn:
|
||||
properties:
|
||||
agent_id:
|
||||
type: string
|
||||
required:
|
||||
- agent_id
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
@@ -1079,8 +1139,8 @@ paths:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Sends a command to the specified agent, waits for execution, and
|
||||
returns the result
|
||||
description: Sends a command to the specified agent and returns a URL to wait
|
||||
for the result
|
||||
parameters:
|
||||
- description: Job request
|
||||
in: body
|
||||
@@ -1095,9 +1155,101 @@ paths:
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.AddJobOut'
|
||||
summary: Submit a job to an agent
|
||||
tags:
|
||||
- jobs
|
||||
/jobs/{id}/wait:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Long-polls for a job result. Returns immediately if the job is
|
||||
already finished.
|
||||
parameters:
|
||||
- description: Job ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Agent reference
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.WaitJobIn'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.JobResult'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Wait for job result
|
||||
tags:
|
||||
- jobs
|
||||
/jobs/check_cmd:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Validates that a command binary exists on the system
|
||||
parameters:
|
||||
- description: Command to check
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.CheckCmdIn'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.CheckCmdOut'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Check command path
|
||||
tags:
|
||||
- jobs
|
||||
/jobs/metrics:
|
||||
get:
|
||||
description: Returns total, successful, failed, and pending job counts over
|
||||
the given period
|
||||
parameters:
|
||||
- default: 24h
|
||||
description: Time period (e.g. 1h, 24h, 7d)
|
||||
in: query
|
||||
name: period
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.JobMetricsOut'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Create and run a job on an agent
|
||||
summary: Get job metrics
|
||||
tags:
|
||||
- jobs
|
||||
/logs:
|
||||
@@ -1468,6 +1620,90 @@ paths:
|
||||
summary: Run script by ID
|
||||
tags:
|
||||
- scripts
|
||||
/scripts/by-path:
|
||||
get:
|
||||
description: Returns a script by its full path (e.g. 'deploy/nginx/restart.sh')
|
||||
parameters:
|
||||
- description: Script path
|
||||
in: query
|
||||
name: path
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Script'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Get script by path
|
||||
tags:
|
||||
- scripts
|
||||
/scripts/folder:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Deletes all scripts that start with the given folder path
|
||||
parameters:
|
||||
- description: Folder path
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.DeleteFolderRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Folder deleted with count of deleted scripts
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Delete folder
|
||||
tags:
|
||||
- scripts
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a virtual folder by creating a placeholder script with
|
||||
the folder path
|
||||
parameters:
|
||||
- description: Folder path
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.CreateFolderRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Folder created
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Create folder
|
||||
tags:
|
||||
- scripts
|
||||
/scripts/interpreters:
|
||||
get:
|
||||
description: Returns all script interpreters available in the system
|
||||
|
||||
Reference in New Issue
Block a user