dfilppi | fd22d8e | 2017-08-03 20:07:26 +0000 | [diff] [blame] | 1 | # |
| 2 | # ============LICENSE_START=================================================== |
| 3 | # Copyright (c) 2017 Cloudify.co. All rights reserved. |
| 4 | # =================================================================== |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 6 | # use this file except in compliance with the License. You may obtain a copy |
| 7 | # of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations under |
| 15 | # the License. |
| 16 | # ============LICENSE_END==================================================== |
| 17 | # |
| 18 | |
| 19 | from flask import Flask, render_template |
| 20 | from aria.exceptions import AriaException |
| 21 | |
| 22 | version_id = "0.1" |
| 23 | route_base = "/api/" + version_id + "/" |
| 24 | app = Flask("onap-aria-rest") |
| 25 | |
| 26 | @app.route("/") |
| 27 | def index(): |
| 28 | return render_template('index.html') |
| 29 | |
| 30 | |
| 31 | @app.route(route_base + "templates/", methods = ['GET']) |
| 32 | def list_templates(): |
| 33 | |
| 34 | @app.route(route_base + "templates/<template_id>", methods = ['POST']) |
| 35 | def install_template( template_id ): |
| 36 | |
| 37 | # GET CSAR FROM SDC |
| 38 | |
| 39 | # DEPLOY CSAR |
| 40 | |
| 41 | # UPDATE A&AI? |
| 42 | |
| 43 | return "template {} instantiated" |
| 44 | |
| 45 | @app.route(route_base + "templates/<template_id>", methods = ['DELETE']) |
| 46 | def delete_template( template_id ): |
| 47 | |
| 48 | # RUN UNINSTALL |
| 49 | |
| 50 | # DELETE TEMPLATE |
| 51 | |
| 52 | # UPDATE A&AI? |
| 53 | |
| 54 | return "template {} deleted" |
| 55 | |
| 56 | if __name__ == "__main__": |
| 57 | app.run() |