core rest - added set default services

This commit is contained in:
bharnden 2018-11-24 00:48:01 -08:00
parent d522649489
commit 57dc69b9da

View file

@ -22,11 +22,21 @@ def get_services():
@api.route("/sessions/<int:session_id>/services/default")
def get_session_options(session_id):
def get_session_service_defaults(session_id):
session = core_utils.get_session(coreemu, session_id)
return jsonify(defaults=session.services.default_services)
@api.route("/sessions/<int:session_id>/services/default", methods=["POST"])
def set_session_service_defaults(session_id):
data = request.get_json() or {}
session = core_utils.get_session(coreemu, session_id)
session.services.default_services.clear()
session.services.default_services.update(data)
logger.info("default services: %s", session.services.default_services)
return jsonify()
@api.route("/sessions/<int:session_id>/nodes/<node_id>/services/<service_name>")
def get_node_service(session_id, node_id, service_name):
session = core_utils.get_session(coreemu, session_id)