'DELETE /api/workflows/{encoded_workflow_id}
Deletes a specified workflow
Author: rpark
copied from galaxy.web.controllers.workflows.py (delete)'

@expose_api
def delete(self, trans, id, **kwd):

    workflow_id = id
    try:
        stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(self.decode_id(workflow_id))
    except Exception as e:
        trans.response.status = 400
        return ("Workflow    with    ID='%s'    can    not    be    found\n    Exception:    %s" % (workflow_id, str(e)))
    if ((stored_workflow.user != trans.user) and (not trans.user_is_admin())):
        trans.response.status = 403
        return 'Workflow    is    not    owned    by    current    user'
    stored_workflow.deleted = True
    trans.sa_session.flush()
    return ("Workflow    '%s'    successfully    deleted" % stored_workflow.name)
