Skip to content

Commit 525e246

Browse files
committed
WIP: swagger yaml defination
Using openapi 3.0 specification to define the restAPI for beaker backend. skeleton api with some dummy methods to allow for testing the test framework. Once this is fleshed out we can start migrating the model code over and then create the actual rest methods.
1 parent ef0bc9c commit 525e246

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1858
-0
lines changed

API/requirements.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
attrs==23.1.0
2+
blinker==1.6.3
3+
certifi==2023.7.22
4+
charset-normalizer==3.3.0
5+
click==8.1.7
6+
clickclick==20.10.2
7+
connexion==3.0.5
8+
Flask==2.2.2
9+
flask-marshmallow==0.14.0
10+
Flask-SQLAlchemy==3.0.3
11+
greenlet==3.0.0
12+
idna==3.4
13+
inflection==0.5.1
14+
itsdangerous==2.1.2
15+
Jinja2==3.1.2
16+
jsonschema==4.19.1
17+
jsonschema-specifications==2023.7.1
18+
MarkupSafe==2.1.3
19+
marshmallow==3.20.1
20+
marshmallow-sqlalchemy==0.29.0
21+
packaging==23.2
22+
PyYAML==6.0.1
23+
referencing==0.30.2
24+
requests==2.31.0
25+
rpds-py==0.10.3
26+
six==1.16.0
27+
SQLAlchemy==2.0.22
28+
swagger-ui-bundle==0.0.9
29+
typing_extensions==4.8.0
30+
urllib3==2.0.6
31+
Werkzeug==2.2.2

API/setup.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[metadata]
2+
name = bkr.api
3+
4+
[options]
5+
package_dir=
6+
=src
7+
packages = find:
8+
zip_safe = False
9+
python_requires = >= 3
10+
[options.packages.find]
11+
where = src
12+
exclude =
13+
tests*
14+
.gitignore

API/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from setuptools import setup
2+
setup()

API/src/bkr/api/__init__.py

Whitespace-only changes.

API/src/bkr/api/arches.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from flask import abort
2+
3+
ARCHES = {}
4+
5+
def post(arch):
6+
if arch and arch not in ARCHES:
7+
ARCHES[arch] = {
8+
"arch": arch,
9+
}
10+
return ARCHES[arch], 201
11+
else:
12+
abort(
13+
406,
14+
f"{arch} already exists",
15+
)
16+
17+
def search(offset=0, limit=None):
18+
start = 0
19+
end = len(ARCHES.values())
20+
if offset and limit:
21+
start = offset * limit
22+
end = start + limit
23+
return list(ARCHES.values())[start:end]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def post(distro):
2+
pass
3+
4+
def search(offset=0, limit=None):
5+
pass
6+
7+
def get(id):
8+
pass
9+
10+
def put(id):
11+
pass
12+
13+
def delete(id):
14+
pass

API/src/bkr/api/distros/tags.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def search():
2+
pass
3+
4+
def post():
5+
pass
6+
7+
def put():
8+
pass
9+
10+
def get():
11+
pass
12+
13+
def delete():
14+
pass

API/src/bkr/api/health.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def search():
2+
return {'msg': 'ok'}, 200
3+

API/src/bkr/api/jobs/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def search():
2+
pass
3+
4+
def post():
5+
pass
6+
7+
def put():
8+
pass
9+
10+
def get():
11+
pass
12+
13+
def delete():
14+
pass
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def put():
2+
pass

0 commit comments

Comments
 (0)