Blob Blame History Raw
openapi: 3.0.0
info:
  title: OSBuild Composer - Worker
  version: '1'
  description: This is an API for workers to request and handle jobs.
servers:
  - url: /api/worker/v1
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
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        5XX:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      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:
                  id:
                    type: string
                    format: uuid
                  location:
                    type: string
                  artifact_location:
                    type: string
                  type:
                    type: string
                    enum:
                      - osbuild
                  args: {}
                  dynamic_args:
                    type: array
                    items: {}
                required:
                  - type
                  - location
                  - id
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        5XX:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: RequestJob
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                types:
                  type: array
                  items:
                    type: string
                    enum:
                      - osbuild
                arch:
                  type: string
              required:
                - types
                - arch
        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
        4XX:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        5XX:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      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
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        5XX:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: UploadJobArtifact
      requestBody:
        content:
          application/octet-stream:
            schema:
              type: string
components:
  schemas:
    Error:
      title: Error
      type: object
      properties:
        message:
          type: string
      required:
        - message