def post_source_variable(team_id, source_id): """ .. :quickref: POST; Lorem ipsum.""" if not TeamPermission.is_manager_or_editor(team_id): abort(403) payload = get_payload() payload.update({"team_id": team_id, "source_id": source_id}) variable = VariableController.create(payload) return jsonify(format_variable(variable)), 200
def list_check_variables(team_id, source_id, check_id): """ .. :quickref: GET; Lorem ipsum.""" if not TeamPermission.is_user(team_id): abort(403) variables = VariableController.list( filters={ "Variable": { "team_id": team_id, "rule_id": None, "source_id": source_id, "check_id": check_id, } }) return jsonify([format_variable(v) for v in variables]), 200
def delete_check_variable(team_id, source_id, check_id, variable_id): """ .. :quickref: DELETE; Lorem ipsum.""" if not TeamPermission.is_manager_or_editor(team_id): abort(403) variable = VariableController.delete( filters={ "Variable": { "id": variable_id, "team_id": team_id, "rule_id": None, "source_id": source_id, "check_id": check_id, } }) return jsonify(format_variable(variable)), 200
def get_check_variable(team_id, source_id, check_id, variable_id): """ .. :quickref: GET; Lorem ipsum.""" if not TeamPermission.is_user(team_id): abort(403) variable = VariableController.get( filters={ "Variable": { "id": variable_id, "team_id": team_id, "rule_id": None, "source_id": source_id, "check_id": check_id, } }) return jsonify(format_variable(variable)), 200
def put_check_variable(team_id, source_id, check_id, variable_id): """ .. :quickref: PUT; Lorem ipsum.""" if not TeamPermission.is_manager_or_editor(team_id): abort(403) payload = get_payload() variable = VariableController.update( payload, { "Variable": { "id": variable_id, "team_id": team_id, "rule_id": None, "source_id": source_id, "check_id": check_id, } }, ) return jsonify(format_variable(variable)), 200