From aff6d41a91ea679142bbd4032aca44927ce80fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sat, 16 Dec 2023 13:34:21 +0100 Subject: [PATCH] OAPI: Add endpoint for mass job deletion This endpoint will not actually delete the jobs, but just mark them for deletion. Flamenco Manager will process the deletions in the background. --- pkg/api/flamenco-openapi.yaml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/pkg/api/flamenco-openapi.yaml b/pkg/api/flamenco-openapi.yaml index 92e9fd26..93cfd215 100644 --- a/pkg/api/flamenco-openapi.yaml +++ b/pkg/api/flamenco-openapi.yaml @@ -762,6 +762,40 @@ paths: application/json: schema: { $ref: "#/components/schemas/Error" } + /api/v3/jobs/mass-delete: + summary: > + Mark many jobs for deletion, based on certain criteria. This endpoint will + not actually delete the jobs, but just mark them for deletion. Flamenco + Manager will process the deletions in the background. + + Note that the `last_updated_max` parameter is rounded up to entire + seconds. This may mark more jobs for deletion than you expect, if their + `updated_at` timestamps differ by less than a second. + delete: + operationId: deleteJobMass + summary: Mark jobs for deletion, based on certain criteria. + tags: [jobs] + requestBody: + description: Parameters to determine which jobs to delete. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/JobMassDeletionSelection" + responses: + "204": + description: Jobs were succesfully marked for deletion. + "416": + description: There were no jobs that match the request. + content: + application/json: + schema: { $ref: "#/components/schemas/Error" } + default: + description: Error message + content: + application/json: + schema: { $ref: "#/components/schemas/Error" } + /api/v3/jobs/check: summary: Check the job for validity, without creating it. post: @@ -1878,6 +1912,17 @@ components: description: Whether the Shaman checkout directory will be removed along with the job. required: ["shaman_checkout"] + JobMassDeletionSelection: + type: object + description: Parameters to describe which jobs should be deleted. + properties: + "last_updated_max": + type: string + format: date-time + description: All jobs that were last updated before or on this timestamp will be deleted. + example: + "last_updated_max": "2023-06-01T13:14:15+02:00" + JobsQuery: type: object properties: