Skip to content

Commit

Permalink
Add REST index page
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jun 7, 2024
1 parent 22e2bbd commit bc7d571
Show file tree
Hide file tree
Showing 4 changed files with 1,626 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IM/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import json
import base64
import flask
import os
import yaml

from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher
from cheroot.ssl.builtin import BuiltinSSLAdapter
Expand Down Expand Up @@ -939,6 +941,14 @@ def RESTGetVersion():
return return_error(400, "Error getting IM version: %s" % get_ex_error(ex))


@app.route('/')
def RESTIndex():
rest_path = os.path.dirname(os.path.abspath(__file__))
abs_file_path = os.path.join(rest_path, 'swagger_api.yaml')
api_docs = yaml.safe_load(open(abs_file_path, 'r'))
return flask.make_response(json.dumps(api_docs), 200, {'Content-Type': 'application/json'})


@app.route('/infrastructures/<infid>/vms/<vmid>/disks/<disknum>/snapshot', methods=['PUT'])
def RESTCreateDiskSnapshot(infid=None, vmid=None, disknum=None):
try:
Expand Down
Loading

0 comments on commit bc7d571

Please sign in to comment.