From 340611f85ab322382ac51eb74673b09ef4ff14ac Mon Sep 17 00:00:00 2001 From: solimant Date: Wed, 9 Oct 2024 02:21:52 +0000 Subject: [PATCH] Add StreamLogsPolling Signed-off-by: solimant --- .../src/schema/openapi.yaml | 59 +++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 0dfdd57d8e..733d816b12 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -13,6 +13,12 @@ components: examples: {} headers: {} parameters: + eventsAfter: + name: after + in: query + description: Offset event ID to stream events after. + schema: + type: integer kind: name: kind in: path @@ -212,6 +218,28 @@ components: items: $ref: '#/components/schemas/SerializedTask' description: The response shape for the `listTasks` call to the `scaffolder-backend` + SerializedTaskEvent: + type: object + properties: + id: + type: integer + isTaskRecoverable: + type: boolean + taskId: + type: string + body: + $ref: '#/components/schemas/JsonObject' + type: + $ref: '#/components/schemas/TaskEventType' + createdAt: + type: string + required: + - id + - taskId + - body + - type + - createdAt + description: SerializedTaskEvent ScaffolderScaffoldOptions: type: object properties: @@ -385,6 +413,14 @@ components: - status - createdAt description: SerializedTask + TaskEventType: + type: string + description: TaskEventType + enum: + - completion + - log + - cancelled + - recovered TaskRecovery: type: object properties: @@ -729,9 +765,22 @@ paths: schema: type: string parameters: + - $ref: '#/components/parameters/eventsAfter' + - $ref: '#/components/parameters/taskId' + + /v2/tasks/{taskId}/events: + get: + operationId: StreamLogsPolling + description: Get events for a task by ID. + responses: + '200': + description: Ok + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SerializedTaskEvent' + parameters: + - $ref: '#/components/parameters/eventsAfter' - $ref: '#/components/parameters/taskId' - - name: after - in: query - description: Offset event ID to stream events after. - schema: - type: integer