This commit is contained in:
+378
-17
@@ -954,12 +954,7 @@
|
||||
},
|
||||
"/jobs": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"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",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -969,7 +964,7 @@
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Create and run a job on an agent",
|
||||
"summary": "Submit a job to an agent",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Job request",
|
||||
@@ -991,6 +986,148 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/jobs/check_cmd": {
|
||||
"post": {
|
||||
"description": "Validates that a command binary exists on the system",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Check command path",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Command to check",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.CheckCmdIn"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.CheckCmdOut"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/jobs/metrics": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Returns total, successful, failed, and pending job counts over the given period",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Get job metrics",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "24h",
|
||||
"description": "Time period (e.g. 1h, 24h, 7d)",
|
||||
"name": "period",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.JobMetricsOut"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/jobs/{id}/wait": {
|
||||
"post": {
|
||||
"description": "Long-polls for a job result. Returns immediately if the job is already finished.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Wait for job result",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Job ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Agent reference",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.WaitJobIn"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.JobResult"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/logs": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1569,6 +1706,138 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/scripts/by-path": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Returns a script by its full path (e.g. 'deploy/nginx/restart.sh')",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"scripts"
|
||||
],
|
||||
"summary": "Get script by path",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Script path",
|
||||
"name": "path",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Script"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/scripts/folder": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Creates a virtual folder by creating a placeholder script with the folder path",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"scripts"
|
||||
],
|
||||
"summary": "Create folder",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Folder path",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.CreateFolderRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Folder created",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Deletes all scripts that start with the given folder path",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"scripts"
|
||||
],
|
||||
"summary": "Delete folder",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Folder path",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handlers.DeleteFolderRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Folder deleted with count of deleted scripts",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/scripts/interpreters": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -2326,16 +2595,7 @@
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"status": {
|
||||
"type": "integer"
|
||||
},
|
||||
"stderr": {
|
||||
"type": "string"
|
||||
},
|
||||
"stdin": {
|
||||
"type": "string"
|
||||
},
|
||||
"stdout": {
|
||||
"wait_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -2371,6 +2631,50 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.CheckCmdIn": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"command"
|
||||
],
|
||||
"properties": {
|
||||
"command": {
|
||||
"type": "string",
|
||||
"example": "bash"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.CheckCmdOut": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"exists": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.CreateFolderRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"example": "deploy/nginx"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.DeleteFolderRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"example": "deploy/nginx"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.InsertLogRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -2411,6 +2715,52 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.JobMetricsOut": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"failed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pending": {
|
||||
"type": "integer"
|
||||
},
|
||||
"period": {
|
||||
"type": "string"
|
||||
},
|
||||
"success": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.JobResult": {
|
||||
"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.RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -2498,6 +2848,17 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handlers.WaitJobIn": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"agent_id"
|
||||
],
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
Reference in New Issue
Block a user