154 lines
3.5 KiB
YAML
154 lines
3.5 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: Backup Scheduler & Task API
|
|
version: 1.0.0
|
|
paths:
|
|
/tasks:
|
|
get:
|
|
summary: List all tasks
|
|
parameters:
|
|
- name: limit
|
|
in: query
|
|
schema:
|
|
type: integer
|
|
default: 50
|
|
- name: type
|
|
in: query
|
|
schema:
|
|
type: string
|
|
enum: [backup, migration]
|
|
- name: status
|
|
in: query
|
|
schema:
|
|
type: string
|
|
enum: [running, success, failed, pending]
|
|
responses:
|
|
'200':
|
|
description: List of tasks
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/Task'
|
|
|
|
/tasks/backup:
|
|
post:
|
|
summary: Manually trigger a backup
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- environment_id
|
|
properties:
|
|
environment_id:
|
|
type: string
|
|
format: uuid
|
|
responses:
|
|
'202':
|
|
description: Backup task started
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Task'
|
|
|
|
/tasks/{id}:
|
|
get:
|
|
summary: Get task details
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
format: uuid
|
|
responses:
|
|
'200':
|
|
description: Task details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Task'
|
|
|
|
/environments/{id}/schedule:
|
|
get:
|
|
summary: Get backup schedule for environment
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
format: uuid
|
|
responses:
|
|
'200':
|
|
description: Schedule configuration
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Schedule'
|
|
put:
|
|
summary: Update backup schedule
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
format: uuid
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Schedule'
|
|
responses:
|
|
'200':
|
|
description: Schedule updated
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Schedule'
|
|
|
|
components:
|
|
schemas:
|
|
Task:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: string
|
|
format: uuid
|
|
type:
|
|
type: string
|
|
enum: [backup, migration]
|
|
status:
|
|
type: string
|
|
enum: [pending, running, success, failed]
|
|
environment_id:
|
|
type: string
|
|
format: uuid
|
|
started_at:
|
|
type: string
|
|
format: date-time
|
|
finished_at:
|
|
type: string
|
|
format: date-time
|
|
created_at:
|
|
type: string
|
|
format: date-time
|
|
error:
|
|
type: string
|
|
logs:
|
|
type: string
|
|
|
|
Schedule:
|
|
type: object
|
|
properties:
|
|
enabled:
|
|
type: boolean
|
|
cron_expression:
|
|
type: string
|
|
example: "0 0 * * *" |