feat(api): add OpenAPI for managing scheduled tasks for applications and services

This commit is contained in:
Ahmed 2026-02-17 00:56:40 +03:00
parent 8c6c2703cc
commit edc92d7edc
2 changed files with 548 additions and 0 deletions

View file

@ -3433,6 +3433,143 @@
]
}
},
"\/applications\/{uuid}\/scheduled-tasks": {
"get": {
"tags": [
"Scheduled Tasks"
],
"summary": "List Tasks",
"description": "List all scheduled tasks for an application.",
"operationId": "list-scheduled-tasks-by-application-uuid",
"parameters": [
{
"name": "uuid",
"in": "path",
"description": "UUID of the application.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get all scheduled tasks for an application.",
"content": {
"application\/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#\/components\/schemas\/ScheduledTask"
}
}
}
}
},
"401": {
"$ref": "#\/components\/responses\/401"
},
"404": {
"$ref": "#\/components\/responses\/404"
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": [
"Scheduled Tasks"
],
"summary": "Create Tasks",
"description": "Create a new scheduled task for an application.",
"operationId": "create-scheduled-task-by-application-uuid",
"parameters": [
{
"name": "uuid",
"in": "path",
"description": "UUID of the application.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Scheduled task data",
"required": true,
"content": {
"application\/json": {
"schema": {
"required": [
"name",
"command",
"frequency"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the scheduled task."
},
"command": {
"type": "string",
"description": "The command to execute."
},
"frequency": {
"type": "string",
"description": "The frequency of the scheduled task."
},
"container": {
"type": "string",
"nullable": true,
"description": "The container where the command should be executed."
},
"timeout": {
"type": "integer",
"description": "The timeout of the scheduled task in seconds.",
"default": 3600
},
"enabled": {
"type": "boolean",
"description": "The flag to indicate if the scheduled task is enabled.",
"default": true
}
},
"type": "object"
}
}
}
},
"responses": {
"201": {
"description": "Scheduled task created.",
"content": {
"application\/json": {
"schema": {
"$ref": "#\/components\/schemas\/ScheduledTask"
}
}
}
},
"401": {
"$ref": "#\/components\/responses\/401"
},
"404": {
"$ref": "#\/components\/responses\/404"
},
"422": {
"$ref": "#\/components\/responses\/422"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"\/cloud-tokens": {
"get": {
"tags": [
@ -9967,6 +10104,143 @@
]
}
},
"\/services\/{uuid}\/scheduled-tasks": {
"get": {
"tags": [
"Scheduled Tasks"
],
"summary": "List (Service)",
"description": "List all scheduled tasks for a service.",
"operationId": "list-scheduled-tasks-by-service-uuid",
"parameters": [
{
"name": "uuid",
"in": "path",
"description": "UUID of the service.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get all scheduled tasks for a service.",
"content": {
"application\/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#\/components\/schemas\/ScheduledTask"
}
}
}
}
},
"401": {
"$ref": "#\/components\/responses\/401"
},
"404": {
"$ref": "#\/components\/responses\/404"
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": [
"Scheduled Tasks"
],
"summary": "Create (Service)",
"description": "Create a new scheduled task for a service.",
"operationId": "create-scheduled-task-by-service-uuid",
"parameters": [
{
"name": "uuid",
"in": "path",
"description": "UUID of the service.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Scheduled task data",
"required": true,
"content": {
"application\/json": {
"schema": {
"required": [
"name",
"command",
"frequency"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the scheduled task."
},
"command": {
"type": "string",
"description": "The command to execute."
},
"frequency": {
"type": "string",
"description": "The frequency of the scheduled task."
},
"container": {
"type": "string",
"nullable": true,
"description": "The container where the command should be executed."
},
"timeout": {
"type": "integer",
"description": "The timeout of the scheduled task in seconds.",
"default": 3600
},
"enabled": {
"type": "boolean",
"description": "The flag to indicate if the scheduled task is enabled.",
"default": true
}
},
"type": "object"
}
}
}
},
"responses": {
"201": {
"description": "Scheduled task created.",
"content": {
"application\/json": {
"schema": {
"$ref": "#\/components\/schemas\/ScheduledTask"
}
}
}
},
"401": {
"$ref": "#\/components\/responses\/401"
},
"404": {
"$ref": "#\/components\/responses\/404"
},
"422": {
"$ref": "#\/components\/responses\/422"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"\/teams": {
"get": {
"tags": [
@ -10967,6 +11241,55 @@
},
"type": "object"
},
"ScheduledTask": {
"description": "Scheduled Task model",
"properties": {
"id": {
"type": "integer",
"description": "The unique identifier of the scheduled task in the database."
},
"uuid": {
"type": "string",
"description": "The unique identifier of the scheduled task."
},
"enabled": {
"type": "boolean",
"description": "The flag to indicate if the scheduled task is enabled."
},
"name": {
"type": "string",
"description": "The name of the scheduled task."
},
"command": {
"type": "string",
"description": "The command to execute."
},
"frequency": {
"type": "string",
"description": "The frequency of the scheduled task."
},
"container": {
"type": "string",
"nullable": true,
"description": "The container where the command should be executed."
},
"timeout": {
"type": "integer",
"description": "The timeout of the scheduled task in seconds."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The date and time when the scheduled task was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The date and time when the scheduled task was last updated."
}
},
"type": "object"
},
"Service": {
"description": "Service model",
"properties": {

View file

@ -2163,6 +2163,100 @@ paths:
security:
-
bearerAuth: []
'/applications/{uuid}/scheduled-tasks':
get:
tags:
- 'Scheduled Tasks'
summary: 'List Tasks'
description: 'List all scheduled tasks for an application.'
operationId: list-scheduled-tasks-by-application-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the application.'
required: true
schema:
type: string
responses:
'200':
description: 'Get all scheduled tasks for an application.'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduledTask'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
security:
-
bearerAuth: []
post:
tags:
- 'Scheduled Tasks'
summary: 'Create Tasks'
description: 'Create a new scheduled task for an application.'
operationId: create-scheduled-task-by-application-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the application.'
required: true,
schema:
type: string
requestBody:
description: 'Scheduled task data'
required: true
content:
application/json:
schema:
required:
- name
- command
- frequency
properties:
name:
type: string
description: 'The name of the scheduled task.'
command:
type: string
description: 'The command to execute.'
frequency:
type: string
description: 'The frequency of the scheduled task.'
container:
type: string
nullable: true
description: 'The container where the command should be executed.'
timeout:
type: integer
description: 'The timeout of the scheduled task in seconds.'
default: 3600
enabled:
type: boolean
description: 'The flag to indicate if the scheduled task is enabled.'
default: true
type: object
responses:
'201':
description: 'Scheduled task created.'
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduledTask'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'422':
$ref: '#/components/responses/422'
security:
-
bearerAuth: []
/cloud-tokens:
get:
tags:
@ -6231,6 +6325,100 @@ paths:
security:
-
bearerAuth: []
'/services/{uuid}/scheduled-tasks':
get:
tags:
- 'Scheduled Tasks'
summary: 'List (Service)'
description: 'List all scheduled tasks for a service.'
operationId: list-scheduled-tasks-by-service-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the service.'
required: true
schema:
type: string
responses:
'200':
description: 'Get all scheduled tasks for a service.'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduledTask'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
security:
-
bearerAuth: []
post:
tags:
- 'Scheduled Tasks'
summary: 'Create (Service)'
description: 'Create a new scheduled task for a service.'
operationId: create-scheduled-task-by-service-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the service.'
required: true
schema:
type: string
requestBody:
description: 'Scheduled task data'
required: true
content:
application/json:
schema:
required:
- name
- command
- frequency
properties:
name:
type: string
description: 'The name of the scheduled task.'
command:
type: string
description: 'The command to execute.'
frequency:
type: string
description: 'The frequency of the scheduled task.'
container:
type: string
nullable: true
description: 'The container where the command should be executed.'
timeout:
type: integer
description: 'The timeout of the scheduled task in seconds.'
default: 3600
enabled:
type: boolean
description: 'The flag to indicate if the scheduled task is enabled.'
default: true
type: object
responses:
'201':
description: 'Scheduled task created.'
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduledTask'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'422':
$ref: '#/components/responses/422'
security:
-
bearerAuth: []
/teams:
get:
tags:
@ -6944,6 +7132,43 @@ components:
type: boolean
description: 'The flag to indicate if the unused networks should be deleted.'
type: object
ScheduledTask:
description: 'Scheduled Task model'
properties:
id:
type: integer
description: 'The unique identifier of the scheduled task in the database.'
uuid:
type: string
description: 'The unique identifier of the scheduled task.'
enabled:
type: boolean
description: 'The flag to indicate if the scheduled task is enabled.'
name:
type: string
description: 'The name of the scheduled task.'
command:
type: string
description: 'The command to execute.'
frequency:
type: string
description: 'The frequency of the scheduled task.'
container:
type: string
nullable: true
description: 'The container where the command should be executed.'
timeout:
type: integer
description: 'The timeout of the scheduled task in seconds.'
created_at:
type: string
format: date-time
description: 'The date and time when the scheduled task was created.'
updated_at:
type: string
format: date-time
description: 'The date and time when the scheduled task was last updated.'
type: object
Service:
description: 'Service model'
properties: