kojiapi: add OpenAPI spec

This adds the OpenAPI spec for the new composer-koji API. This API is meant
to expose expose just the functionality needed to generate images and push
them to koji.

Each compose may consist of several images, each image may have a
different architecture and image type, and the set of repositories with
their contents may be distinct. However, a compose is restricted to one
distro and one koji transaction.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-04-23 19:02:06 +02:00
parent 509964bede
commit 7109f49692

View file

@ -0,0 +1,188 @@
openapi: 3.0.1
info:
version: '1'
title: OSBuild Composer - Koji
description: Service to build and push images to Koji.
license:
name: Apache 2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
paths:
'/compose/{id}':
get:
summary: The status of a compose
parameters:
- in: path
name: id
schema:
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426655440000
required: true
description: ID of compose status to get
description: 'Get the status of a running or finished compose. This includes whether or not it succeeded, and also meta information about the result.'
responses:
'200':
description: Compose status
content:
application/json:
schema:
$ref: '#/components/schemas/ComposeStatus'
'400':
description: Invalid compose id
content:
text/plain:
schema:
type: string
'404':
description: Unknown compose id
content:
text/plain:
schema:
type: string
/compose:
post:
summary: Create compose
description: 'Create a new compose, potentially consisting of several images and upload each to koji.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ComposeRequest'
responses:
'201':
description: Compose has started
content:
application/json:
schema:
$ref: '#/components/schemas/ComposeResponse'
'400':
description: Invalid compose request
content:
text/plain:
schema:
type: string
'415':
description: The content type is not supported
content:
text/plain:
schema:
type: string
components:
schemas:
ComposeStatus:
required:
- status
- image_statuses
- koji_task_id
properties:
status:
type: string
enum:
- success
- failure
- pending
- registering
example: success
image_statuses:
type: array
items:
$ref: '#/components/schemas/ImageStatus'
koji_task_id:
type: integer
example: 203143
ImageStatus:
required:
- status
properties:
status:
type: string
enum:
- success
- failure
- pending
- building
- uploading
example: success
ComposeRequest:
type: object
required:
- name
- version
- release
- distribution
- image_requests
- koji
properties:
name:
type: string
example: Fedora-Cloud-Base
version:
type: string
example: '31'
release:
type: string
example: '20200907.0'
distribution:
type: string
example: fedora-32
image_requests:
type: array
items:
$ref: '#/components/schemas/ImageRequest'
koji:
$ref: '#/components/schemas/Koji'
ImageRequest:
required:
- architecture
- image_type
- repositories
properties:
architecture:
type: string
example: x86_64
image_type:
type: string
example: ami
repositories:
type: array
items:
$ref: '#/components/schemas/Repository'
Repository:
type: object
required:
- baseurl
- gpgkey
properties:
baseurl:
type: string
format: url
example: 'https://cdn.redhat.com/content/dist/rhel8/8/x86_64/baseos/os/'
gpgkey:
type: string
example: "-----BEGIN PGP PUBLIC KEY BLOCK-----\\n\\nmQINBErgSTsBEACh2A4b0O9t+vzC9VrVtL1AKvUWi9OPCjkvR7Xd8DtJxeeMZ5eF\\n0HtzIG58qDRybwUe89FZprB1ffuUKzdE+HcL3FbNWSSOXVjZIersdXyH3NvnLLLF\\n0DNRB2ix3bXG9Rh/RXpFsNxDp2CEMdUvbYCzE79K1EnUTVh1L0Of023FtPSZXX0c\\nu7Pb5DI5lX5YeoXO6RoodrIGYJsVBQWnrWw4xNTconUfNPk0EGZtEnzvH2zyPoJh\\nXGF+Ncu9XwbalnYde10OCvSWAZ5zTCpoLMTvQjWpbCdWXJzCm6G+/hx9upke546H\\n5IjtYm4dTIVTnc3wvDiODgBKRzOl9rEOCIgOuGtDxRxcQkjrC+xvg5Vkqn7vBUyW\\n9pHedOU+PoF3DGOM+dqv+eNKBvh9YF9ugFAQBkcG7viZgvGEMGGUpzNgN7XnS1gj\\n/DPo9mZESOYnKceve2tIC87p2hqjrxOHuI7fkZYeNIcAoa83rBltFXaBDYhWAKS1\\nPcXS1/7JzP0ky7d0L6Xbu/If5kqWQpKwUInXtySRkuraVfuK3Bpa+X1XecWi24JY\\nHVtlNX025xx1ewVzGNCTlWn1skQN2OOoQTV4C8/qFpTW6DTWYurd4+fE0OJFJZQF\\nbuhfXYwmRlVOgN5i77NTIJZJQfYFj38c/Iv5vZBPokO6mffrOTv3MHWVgQARAQAB\\ntDNSZWQgSGF0LCBJbmMuIChyZWxlYXNlIGtleSAyKSA8c2VjdXJpdHlAcmVkaGF0\\nLmNvbT6JAjYEEwECACAFAkrgSTsCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAK\\nCRAZni+R/UMdUWzpD/9s5SFR/ZF3yjY5VLUFLMXIKUztNN3oc45fyLdTI3+UClKC\\n2tEruzYjqNHhqAEXa2sN1fMrsuKec61Ll2NfvJjkLKDvgVIh7kM7aslNYVOP6BTf\\nC/JJ7/ufz3UZmyViH/WDl+AYdgk3JqCIO5w5ryrC9IyBzYv2m0HqYbWfphY3uHw5\\nun3ndLJcu8+BGP5F+ONQEGl+DRH58Il9Jp3HwbRa7dvkPgEhfFR+1hI+Btta2C7E\\n0/2NKzCxZw7Lx3PBRcU92YKyaEihfy/aQKZCAuyfKiMvsmzs+4poIX7I9NQCJpyE\\nIGfINoZ7VxqHwRn/d5mw2MZTJjbzSf+Um9YJyA0iEEyD6qjriWQRbuxpQXmlAJbh\\n8okZ4gbVFv1F8MzK+4R8VvWJ0XxgtikSo72fHjwha7MAjqFnOq6eo6fEC/75g3NL\\nGht5VdpGuHk0vbdENHMC8wS99e5qXGNDued3hlTavDMlEAHl34q2H9nakTGRF5Ki\\nJUfNh3DVRGhg8cMIti21njiRh7gyFI2OccATY7bBSr79JhuNwelHuxLrCFpY7V25\\nOFktl15jZJaMxuQBqYdBgSay2G0U6D1+7VsWufpzd/Abx1/c3oi9ZaJvW22kAggq\\ndzdA27UUYjWvx42w9menJwh/0jeQcTecIUd0d0rFcw/c1pvgMMl/Q73yzKgKYw==\\n=zbHE\\n-----END PGP PUBLIC KEY BLOCK-----\\n"
Koji:
type: object
required:
- server
- task_id
properties:
server:
type: string
format: url
example: 'https://koji.fedoraproject.org/kojihub'
task_id:
type: integer
example: 42
ComposeResponse:
required:
- id
- koji_build_id
properties:
id:
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426655440000
koji_build_id:
type: integer
example: 42