diff options
Diffstat (limited to 'mock-msb-k8s/app/app.py')
-rw-r--r-- | mock-msb-k8s/app/app.py | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/mock-msb-k8s/app/app.py b/mock-msb-k8s/app/app.py index 5da64d7..3e9cec9 100644 --- a/mock-msb-k8s/app/app.py +++ b/mock-msb-k8s/app/app.py @@ -76,7 +76,7 @@ INSTANCE_EXAMPLE = { } -@app.route('/api/multicloud-k8s/v1/v1/connectivity-info/<string:region_id>', methods=['GET', 'DELETE']) +@app.route('/v1/connectivity-info/<string:region_id>', methods=['GET', 'DELETE']) def connectivity_info_get_delete(region_id): if request.method == 'GET': for conninfo in CONNECTIVITY_INFOS: @@ -94,7 +94,7 @@ def connectivity_info_get_delete(region_id): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/connectivity-info', methods=['POST']) +@app.route('/v1/connectivity-info', methods=['POST']) def connectivity_info_create(): if request.method == 'POST': kubeconfig = request.files['file'] @@ -108,7 +108,7 @@ def connectivity_info_create(): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition', methods=['POST']) +@app.route('/v1/rb/definition', methods=['POST']) def definition_create(): if request.method == 'POST': data = json.loads(request.data) @@ -123,7 +123,7 @@ def definition_create(): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/content', methods=['POST']) +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/content', methods=['POST']) def definition_upload_artifact(rb_name, rb_version): if request.method == 'POST': data = request.data @@ -131,7 +131,7 @@ def definition_upload_artifact(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>', methods=['GET', 'DELETE']) +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>', methods=['GET', 'DELETE']) def definition_get_delete(rb_name, rb_version): if request.method == 'GET': for rb in DEFINITIONS: @@ -149,14 +149,14 @@ def definition_get_delete(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition', methods=['GET']) +@app.route('/v1/rb/definition', methods=['GET']) def definition_get_all(): if request.method == 'GET': return json.dumps(DEFINITIONS), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile', methods=['POST']) +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile', methods=['POST']) def profile_create(**kwargs): if request.method == 'POST': data = json.loads(request.data) @@ -172,9 +172,7 @@ def profile_create(**kwargs): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route( - '/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile/<string:profile_name>/content' - , methods=['POST']) +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile/<string:profile_name>/content', methods=['POST']) def profile_upload_artifact(rb_name, rb_version, profile_name): if request.method == 'POST': data = request.data @@ -182,7 +180,7 @@ def profile_upload_artifact(rb_name, rb_version, profile_name): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile/<string:profile_name>', +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile/<string:profile_name>', methods=['GET', 'DELETE']) def profile_get_delete(rb_name, rb_version, profile_name): if request.method == 'GET': @@ -203,7 +201,7 @@ def profile_get_delete(rb_name, rb_version, profile_name): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile', methods=['GET']) +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/profile', methods=['GET']) def profile_get_all(rb_name, rb_version): if request.method == 'GET': profiles = [] @@ -213,7 +211,7 @@ def profile_get_all(rb_name, rb_version): return json.dumps(PROFILES), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance', methods=['POST']) +@app.route('/v1/instance', methods=['POST']) def instance_create(): if request.method == 'POST': data = json.loads(request.data) @@ -224,7 +222,7 @@ def instance_create(): return instance_details, http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance/<string:instance_id>', methods=['GET', 'DELETE']) +@app.route('/v1/instance/<string:instance_id>', methods=['GET', 'DELETE']) def instance_get_delete(instance_id): if request.method == 'GET': for instance in INSTANCES: @@ -242,14 +240,14 @@ def instance_get_delete(instance_id): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance', methods=['GET']) +@app.route('/v1/instance', methods=['GET']) def instance_get_all(): if request.method == 'GET': return json.dumps(INSTANCES), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template', +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template', methods=["POST"]) def configuration_template_create(rb_name, rb_version): if request.method == "POST": @@ -260,19 +258,19 @@ def configuration_template_create(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template/<string:name>', +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template/<string:template_name>', methods=["GET"]) -def configuration_template_get(rb_name, rb_version, name): +def configuration_template_get(rb_name, rb_version, template_name): if request.method == "GET": for template in CONFIGURATIONS_TEMPLATES: - if template['template-name'] == name: + if template['template-name'] == template_name: return json.dumps(template), http.HTTPStatus.OK else: return '', http.HTTPStatus.NOT_FOUND return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template', +@app.route('/v1/rb/definition/<string:rb_name>/<string:rb_version>/config-template', methods=["GET"]) def configuration_template_get_all(rb_name, rb_version): if request.method == 'GET': |