def update_resource_member(resource_id, res_type, member_id, values, session=None): # Only member who is not the owner of the resource can update the # membership status. if member_id != security.get_project_id(): raise exc.NotFoundException( "Resource member not found [resource_id=%s, member_id=%s]" % (resource_id, member_id)) query = _secure_query( models.ResourceMember).filter_by(resource_type=res_type) res_member = query.filter( _get_criterion(resource_id, member_id, is_owner=False)).first() if not res_member: raise exc.NotFoundException( "Resource member not found [resource_id=%s, member_id=%s]" % (resource_id, member_id)) res_member.update(values.copy()) return res_member
def delete_environment(name, session=None): env = _get_environment(name) if not env: raise exc.NotFoundException("Environment not found [name=%s]" % name) session.delete(env)
def delete_delayed_call(id, session=None): delayed_call = _get_delayed_call(id) if not delayed_call: raise exc.NotFoundException("DelayedCall not found [id=%s]" % id) session.delete(delayed_call)
def get_environment(name): env = _get_environment(name) if not env: raise exc.NotFoundException("Environment not found [name=%s]" % name) return env
def update_cron_trigger(name, values, session=None, query_filter=None): cron_trigger = _get_cron_trigger(name) if not cron_trigger: raise exc.NotFoundException("Cron trigger not found [name=%s]" % name) if query_filter: try: # Execute the UPDATE statement with the query_filter as the WHERE. specimen = models.CronTrigger(id=cron_trigger.id, **query_filter) cron_trigger = b.model_query(models.CronTrigger).update_on_match( specimen=specimen, surrogate_key='id', values=values) return cron_trigger, 1 except oslo_sqlalchemy.update_match.NoRowsMatched: LOG.debug( "No rows matched for cron update call" "[id=%s, values=%s, query_filter=%s", id, values, query_filter) return cron_trigger, 0 else: cron_trigger.update(values.copy()) return cron_trigger, len(session.dirty)
def delete_cron_trigger(name, session=None): cron_trigger = _get_cron_trigger(name) if not cron_trigger: raise exc.NotFoundException("Cron trigger not found [name=%s]" % name) session.delete(cron_trigger)
def get_delayed_call(id, session=None): delayed_call = _get_delayed_call(id=id, session=session) if not delayed_call: raise exc.NotFoundException("Delayed Call not found [id=%s]" % id) return delayed_call
def delete_action_execution(id, session=None): a_ex = _get_action_execution(id) if not a_ex: raise exc.NotFoundException("ActionExecution not found [id=%s]" % id) session.delete(a_ex)
def get_cron_trigger(name): cron_trigger = _get_cron_trigger(name) if not cron_trigger: raise exc.NotFoundException("Cron trigger not found [name=%s]" % name) return cron_trigger
def get_action_execution(id): a_ex = _get_action_execution(id) if not a_ex: raise exc.NotFoundException("ActionExecution not found [id=%s]" % id) return a_ex
def delete_workflow_execution(id, session=None): wf_ex = _get_workflow_execution(id) if not wf_ex: raise exc.NotFoundException("WorkflowExecution not found [id=%s]" % id) session.delete(wf_ex)
def get_task_execution(id): task_ex = _get_task_execution(id) if not task_ex: raise exc.NotFoundException("Task execution not found [id=%s]" % id) return task_ex
def get_action_definition_by_id(id): action_def = _get_db_object_by_id(models.ActionDefinition, id) if not action_def: raise exc.NotFoundException("Action not found [action_id=%s]" % id) return action_def
def delete_task_execution(id, session=None): task_ex = _get_task_execution(id) if not task_ex: raise exc.NotFoundException("TaskExecution not found [id=%s]" % id) session.delete(task_ex)
def get_workflow_definition_by_id(id): wf_def = _get_workflow_definition_by_id(id) if not wf_def: raise exc.NotFoundException("Workflow not found [workflow_id=%s]" % id) return wf_def
def get_workflow_execution(id): wf_ex = _get_workflow_execution(id) if not wf_ex: raise exc.NotFoundException("WorkflowExecution not found [id=%s]" % id) return wf_ex
def delete_workbook(name, session=None): wb = _get_workbook(name) if not wb: raise exc.NotFoundException("Workbook not found [workbook_name=%s]" % name) session.delete(wb)
def delete_execution(id, session=None): ex = _get_execution(id) if not ex: raise exc.NotFoundException("Execution not found [execution_id=%s]" % id) session.delete(ex)
def delete_action_definition(name, session=None): a_def = _get_action_definition(name) if not a_def: raise exc.NotFoundException( "Action definition not found [action_name=%s]" % name) session.delete(a_def)
def get_action_definition(name): a_def = _get_action_definition(name) if not a_def: raise exc.NotFoundException( "Action definition not found [action_name=%s]" % name) return a_def
def get_workbook(name): wb = _get_workbook(name) if not wb: raise exc.NotFoundException("Workbook not found [workbook_name=%s]" % name) return wb
def get_execution(id): ex = _get_execution(id) if not ex: raise exc.NotFoundException("Execution not found [execution_id=%s]" % id) return ex
def get_workflow_definition(name): wf_def = _get_workflow_definition(name) if not wf_def: raise exc.NotFoundException( "Workflow not found [workflow_name=%s]" % name ) return wf_def
def update_environment(name, values, session=None): env = _get_environment(name) if not env: raise exc.NotFoundException("Environment not found [name=%s]" % name) env.update(values) return env
def update_cron_trigger(name, values, session=None): cron_trigger = _get_cron_trigger(name) if not cron_trigger: raise exc.NotFoundException("Cron trigger not found [name=%s]" % name) cron_trigger.update(values.copy()) return cron_trigger
def delete_workflow_definition(name, session=None): wf_def = _get_workflow_definition(name) if not wf_def: raise exc.NotFoundException( "Workflow not found [workflow_name=%s]" % name ) session.delete(wf_def)
def update_task_execution(id, values, session=None): task_ex = _get_task_execution(id) if not task_ex: raise exc.NotFoundException("TaskExecution not found [id=%s]" % id) task_ex.update(values.copy()) return task_ex
def update_action_execution(id, values, session=None): a_ex = _get_action_execution(id) if not a_ex: raise exc.NotFoundException("ActionExecution not found [id=%s]" % id) a_ex.update(values.copy()) return a_ex
def update_workflow_execution(id, values, session=None): wf_ex = _get_workflow_execution(id) if not wf_ex: raise exc.NotFoundException("WorkflowExecution not found [id=%s]" % id) wf_ex.update(values.copy()) return wf_ex
def update_execution(id, values, session=None): ex = _get_execution(id) if not ex: raise exc.NotFoundException("Execution not found [execution_id=%s]" % id) ex.update(values.copy()) return ex