From 26f92503cf5ce0a505df2c347ad3bfa44c4c3464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sat, 16 Jul 2022 15:57:41 +0200 Subject: [PATCH] OAPI: operations for getting & setting worker sleep schedule Manifest Task: T99397 --- pkg/api/flamenco-openapi.yaml | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/pkg/api/flamenco-openapi.yaml b/pkg/api/flamenco-openapi.yaml index e70c27b6..a9851469 100644 --- a/pkg/api/flamenco-openapi.yaml +++ b/pkg/api/flamenco-openapi.yaml @@ -489,6 +489,56 @@ paths: schema: $ref: "#/components/schemas/Error" + /api/v3/worker-mgt/workers/{worker_id}/sleep-schedule: + summary: Get or update the worker's sleep schedule. + get: + operationId: fetchWorkerSleepSchedule + tags: [worker-mgt] + parameters: + - name: worker_id + in: path + required: true + schema: { type: string, format: uuid } + responses: + "200": + description: Normal response, the sleep schedule. + content: + application/json: + schema: + $ref: "#/components/schemas/WorkerSleepSchedule" + "204": + description: The worker has no sleep schedule. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + operationId: setWorkerSleepSchedule + tags: [worker-mgt] + parameters: + - name: worker_id + in: path + required: true + schema: { type: string, format: uuid } + requestBody: + description: The new sleep schedule. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/WorkerSleepSchedule" + responses: + "204": + description: The schedule has been stored. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + ## Jobs /api/v3/jobs/types: @@ -1937,6 +1987,30 @@ components: worker's current task is finished. required: [status, is_lazy] + WorkerSleepSchedule: + type: object + description: > + Sleep schedule for a single Worker. Start and end time indicate the time + of each day at which the schedule is active. Applies only when today is + in `days_of_week`, or when `days_of_week` is empty. + + Start and end time are in 24-hour HH:MM notation. + properties: + "is_active": { type: boolean } + "days_of_week": + type: string + description: > + Space-separated two-letter strings indicating days of week the + schedule is active ("mo", "tu", etc.). Empty means "every day". + "start_time": { type: string, format: "HH:MM" } + "end_time": { type: string, format: "HH:MM" } + required: [is_active, days_of_week, start_time, end_time] + example: + is_active: true + days_of_week: "mo,tu,th,fr" + start_time: "09:00" + end_time: "18:00" + securitySchemes: worker_auth: description: Username is the worker ID, password is the secret given at worker registration.