debian-forge-composer/internal/worker/api/openapi.yml
Lars Karlitski b03e1254e9 worker/api: remove token in favor of callback URLs
Instead of sending a `token` to workers, send back to URLs:

 1. "location": URL at which the job can be inspected (GET) and updated
    (PATCH).
 2. "artifact_location": URL at which artifacts should be uploaded to.

The actual URLs remain the same, but a client does not need to stitch
them together manually (except appending the artifact's name).

Unfortunately, the client code generated by `deepmap` does not lend
itself to this style of APIs. Use standard http.Client again, which is a
partial revert of 0962fbd30.
2020-09-11 14:23:24 +01:00

133 lines
3.1 KiB
YAML

openapi: 3.0.0
info:
title: worker
version: '1.0'
servers: []
paths:
/status:
get:
summary: status
tags: []
responses:
'200':
description: OK
headers: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- OK
required:
- status
operationId: GetStatus
description: Simple status handler to check whether the service is up.
/jobs:
post:
summary: Request a job
tags: []
responses:
'201':
description: Created
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
manifest: {}
targets:
type: array
items: {}
location:
type: string
artifact_location:
type: string
required:
- manifest
- location
operationId: RequestJob
requestBody:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
description: Requests a job. This operation blocks until a job is available.
parameters: []
'/jobs/{token}':
parameters:
- schema:
type: string
name: token
in: path
required: true
get:
summary: Get running job
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
canceled:
type: boolean
required:
- canceled
operationId: GetJob
description: ''
patch:
summary: Update a running job
tags: []
responses: {}
operationId: UpdateJob
requestBody:
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- WAITING
- RUNNING
- FINISHED
- FAILED
result: {}
required:
- status
- result
'/jobs/{token}/artifacts/{name}':
parameters:
- schema:
type: string
name: name
in: path
required: true
- schema:
type: string
name: token
in: path
required: true
put:
summary: Upload an artifact
tags: []
responses:
'200':
description: OK
operationId: UploadJobArtifact
requestBody:
content:
application/octet-stream:
schema:
type: string
components:
schemas: {}