Create a new instance template. :param project_string_id: :return:
(project_string_id, instance_id)
| 7 | @routes.route('/api/v1/project/<string:project_string_id>/instance/<int:instance_id>/history', methods = ['POST']) |
| 8 | @Project_permissions.user_has_project(Roles = ["admin", "Editor", "Viewer"], apis_user_list = ["api_enabled_builder"]) |
| 9 | def instance_history_api(project_string_id, instance_id): |
| 10 | """ |
| 11 | Create a new instance template. |
| 12 | :param project_string_id: |
| 13 | :return: |
| 14 | """ |
| 15 | instance_history_spec_list = [] |
| 16 | |
| 17 | log, input, untrusted_input = regular_input.master( |
| 18 | request = request, |
| 19 | spec_list = instance_history_spec_list) |
| 20 | |
| 21 | if len(log["error"].keys()) >= 1: |
| 22 | return jsonify(log = log), 400 |
| 23 | |
| 24 | with sessionMaker.session_scope() as session: |
| 25 | project = Project.get_by_string_id(session, project_string_id) |
| 26 | user = User.get(session) |
| 27 | |
| 28 | if user: |
| 29 | member = user.member |
| 30 | else: |
| 31 | client_id = request.authorization.get('username', None) |
| 32 | auth = Auth_api.get(session, client_id) |
| 33 | member = auth.member |
| 34 | |
| 35 | instance_history_data, log = instance_history_core( |
| 36 | session = session, |
| 37 | instance_id = instance_id, |
| 38 | project = project, |
| 39 | log = log, |
| 40 | ) |
| 41 | if len(log["error"].keys()) >= 1: |
| 42 | return jsonify(log = log), 400 |
| 43 | |
| 44 | return jsonify(instance_history = instance_history_data), 200 |
| 45 | |
| 46 | |
| 47 | def instance_history_core( |
nothing calls this directly
no test coverage detected