Rebuild API using Flask-RESTful and Swagger docs

This commit is contained in:
2019-12-23 20:43:20 -05:00
parent 91cb542e37
commit a6683d5b17
12 changed files with 10065 additions and 1981 deletions

21
client-api/gen-doc.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# gen-doc.py - Generate a Swagger JSON document for the API
# Part of the Parallel Virtual Cluster (PVC) system
from flask_swagger import swagger
import sys
import json
sys.path.append(',')
pvc_api = __import__('pvc-api')
swagger_file = "swagger.json"
swagger_data = swagger(pvc_api.app)
swagger_data['info']['version'] = "1.0"
swagger_data['info']['title'] = "PVC Client and Provisioner API"
with open(swagger_file, 'w') as fd:
fd.write(json.dumps(swagger_data, sort_keys=True, indent=4))