From 169aa3ddc3961470bcf690bdf0fcf76b2dc570b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 2 Jun 2022 12:16:03 +0200 Subject: [PATCH] OAPI: extract worker status request fields into their own struct Instead of always passing `status_requested` and `lazy_status_request` in tandem, and requiring one when the other is present, they are now always passed as a struct `WorkerStatusChangeRequest`. This struct has both fields required. `WorkerStatusChangeRequest` already existed, and is now altered by changing its field `status_requested` to simply `status` -- the fact that it's requested is already clear from the context. --- pkg/api/flamenco-openapi.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pkg/api/flamenco-openapi.yaml b/pkg/api/flamenco-openapi.yaml index aa33ab02..2e578943 100644 --- a/pkg/api/flamenco-openapi.yaml +++ b/pkg/api/flamenco-openapi.yaml @@ -1392,12 +1392,8 @@ components: description: Timestamp of last update "status": { $ref: "#/components/schemas/WorkerStatus" } "previous_status": { $ref: "#/components/schemas/WorkerStatus" } - "status_requested": { $ref: "#/components/schemas/WorkerStatus" } - "lazy_status_request": - type: boolean - description: > - Whether the worker is allowed to finish its current task before the - status change is enforced. Mandatory when `status_requested` is set. + "status_change": + $ref: "#/components/schemas/WorkerStatusChangeRequest" "version": { type: string } required: [id, nickname, updated, status, version] @@ -1445,8 +1441,8 @@ components: "id": { type: string, format: uuid } "nickname": { type: string } "status": { $ref: "#/components/schemas/WorkerStatus" } - "status_requested": { $ref: "#/components/schemas/WorkerStatus" } - "lazy_status_request": { type: boolean } + "status_change": + $ref: "#/components/schemas/WorkerStatusChangeRequest" # These will be implemented soon: # "task_id": # type: string @@ -1486,15 +1482,15 @@ components: WorkerStatusChangeRequest: type: object - description: Request for a Worker to change its status. + description: Request for a Worker to change its status to `status`. properties: - "status_requested": { $ref: "#/components/schemas/WorkerStatus" } + "status": { $ref: "#/components/schemas/WorkerStatus" } "is_lazy": type: boolean description: > Whether the status change should happen immediately, or after the worker's current task is finished. - required: [status_requested, is_lazy] + required: [status, is_lazy] securitySchemes: worker_auth: