[Feature][API] New restful API for workflow and schedule (#11912)
* [feat] New restful API for workflow and schedule
CURD for workflow and schedule, different with exists
API, this new restful api only operate single resource
in each request, and return the latest. For example,
previous workflow should also need to post tasks definition
and tasks relation definition, but this patch will allow
you to create workflow without task relate information
* use checkProjectAndAuthThrowException, and fix CI error
* Update dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ScheduleV2Controller.java
* change method name
from createProcessDefinitionV2 to createSingleProcessDefinition
from updateProcessDefinitionV2 to updateSingleProcessDefinition
Co-authored-by: caishunfeng <caishunfeng2021@gmail.com>
QUERY_PARENT_PROCESS_INSTANCE_DETAIL_INFO_BY_SUB_PROCESS_INSTANCE_ID_ERROR(10119,"query parent process instance detail info by sub process instance id error","查询子流程该工作流实例错误"),
"query sub process instance detail info by task id error","查询子流程任务实例错误"),
PARSE_TO_CRON_EXPRESSION_ERROR(10140,"parse cron to cron expression error","解析调度表达式错误"),
PARSE_TO_CRON_EXPRESSION_ERROR(10140,"parse cron to cron expression error","解析调度表达式错误"),
SCHEDULE_START_TIME_END_TIME_SAME(10141,"The start time must not be the same as the end","开始时间不能和结束时间一样"),
SCHEDULE_START_TIME_END_TIME_SAME(10141,"The start time must not be the same as the end","开始时间不能和结束时间一样"),
DELETE_TENANT_BY_ID_FAIL(10142,"delete tenant by id fail, for there are {0} process instances in executing using it","删除租户失败,有[{0}]个运行中的工作流实例正在使用"),
DELETE_TENANT_BY_ID_FAIL(10142,
DELETE_TENANT_BY_ID_FAIL_DEFINES(10143,"delete tenant by id fail, for there are {0} process definitions using it","删除租户失败,有[{0}]个工作流定义正在使用"),
"delete tenant by id fail, for there are {0} process instances in executing using it",
DELETE_TENANT_BY_ID_FAIL_USERS(10144,"delete tenant by id fail, for there are {0} users using it","删除租户失败,有[{0}]个用户正在使用"),
"删除租户失败,有[{0}]个运行中的工作流实例正在使用"),
DELETE_WORKER_GROUP_BY_ID_FAIL(10145,"delete worker group by id fail, for there are {0} process instances in executing using it","删除Worker分组失败,有[{0}]个运行中的工作流实例正在使用"),
DELETE_TENANT_BY_ID_FAIL_DEFINES(10143,"delete tenant by id fail, for there are {0} process definitions using it",
"删除租户失败,有[{0}]个工作流定义正在使用"),
DELETE_TENANT_BY_ID_FAIL_USERS(10144,"delete tenant by id fail, for there are {0} users using it",
"删除租户失败,有[{0}]个用户正在使用"),
DELETE_WORKER_GROUP_BY_ID_FAIL(10145,
"delete worker group by id fail, for there are {0} process instances in executing using it",
"删除Worker分组失败,有[{0}]个运行中的工作流实例正在使用"),
QUERY_WORKER_GROUP_FAIL(10146,"query worker group fail ","查询worker分组失败"),
QUERY_WORKER_GROUP_FAIL(10146,"query worker group fail ","查询worker分组失败"),
DELETE_WORKER_GROUP_FAIL(10147,"delete worker group fail ","删除worker分组失败"),
DELETE_WORKER_GROUP_FAIL(10147,"delete worker group fail ","删除worker分组失败"),
USER_DISABLED(10148,"The current user is disabled","当前用户已停用"),
USER_DISABLED(10148,"The current user is disabled","当前用户已停用"),
COPY_PROCESS_DEFINITION_ERROR(10149,"copy process definition from {0} to {1} error : {2}","从{0}复制工作流到{1}错误 : {2}"),
COPY_PROCESS_DEFINITION_ERROR(10149,"copy process definition from {0} to {1} error : {2}",
MOVE_PROCESS_DEFINITION_ERROR(10150,"move process definition from {0} to {1} error : {2}","从{0}移动工作流到{1}错误 : {2}"),
"从{0}复制工作流到{1}错误 : {2}"),
MOVE_PROCESS_DEFINITION_ERROR(10150,"move process definition from {0} to {1} error : {2}",
"从{0}移动工作流到{1}错误 : {2}"),
SWITCH_PROCESS_DEFINITION_VERSION_ERROR(10151,"Switch process definition version error","切换工作流版本出错"),
SWITCH_PROCESS_DEFINITION_VERSION_ERROR(10151,"Switch process definition version error","切换工作流版本出错"),
,"Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]","切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"),
QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162,"query authorized and user created project error error","查询授权的和用户创建的项目错误"),
QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162,"query authorized and user created project error error",
DELETE_PROCESS_DEFINITION_EXECUTING_FAIL(10163,"delete process definition by code fail, for there are {0} process instances in executing using it","删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"),
"查询授权的和用户创建的项目错误"),
CHECK_OS_TENANT_CODE_ERROR(10164,"Tenant code invalid, should follow linux's users naming conventions","非法的租户名,需要遵守 Linux 用户命名规范"),
DELETE_PROCESS_DEFINITION_EXECUTING_FAIL(10163,
"delete process definition by code fail, for there are {0} process instances in executing using it",
"删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"),
CHECK_OS_TENANT_CODE_ERROR(10164,"Tenant code invalid, should follow linux's users naming conventions",
TASK_INSTANCE_STATE_OPERATION_ERROR(10166,"the status of task instance {0} is {1},Cannot perform force success operation","任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
TASK_INSTANCE_STATE_OPERATION_ERROR(10166,
"the status of task instance {0} is {1},Cannot perform force success operation",
"任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
DATASOURCE_TYPE_NOT_EXIST(10167,"data source type not exist","数据源类型不存在"),
DATASOURCE_TYPE_NOT_EXIST(10167,"data source type not exist","数据源类型不存在"),
PROCESS_DEFINITION_NAME_EXIST(10168,"process definition name {0} already exists","工作流定义名称[{0}]已存在"),
PROCESS_DEFINITION_NAME_EXIST(10168,"process definition name {0} already exists","工作流定义名称[{0}]已存在"),
DATASOURCE_DB_TYPE_ILLEGAL(10169,"datasource type illegal","数据源类型参数不合法"),
DATASOURCE_DB_TYPE_ILLEGAL(10169,"datasource type illegal","数据源类型参数不合法"),
@ -211,20 +233,28 @@ public enum Status {
QUERY_WORKER_ADDRESS_LIST_FAIL(10178,"query worker address list fail ","查询worker地址列表失败"),
QUERY_WORKER_ADDRESS_LIST_FAIL(10178,"query worker address list fail ","查询worker地址列表失败"),
RESOURCE_FILE_EXIST(20011,"resource file {0} already exists in hdfs,please delete it or change name!","资源文件[{0}]在hdfs中已存在,请删除或修改资源名"),
RESOURCE_FILE_EXIST(20011,"resource file {0} already exists in hdfs,please delete it or change name!",
"资源文件[{0}]在hdfs中已存在,请删除或修改资源名"),
RESOURCE_FILE_NOT_EXIST(20012,"resource file {0} not exists !","资源文件[{0}]不存在"),
RESOURCE_FILE_NOT_EXIST(20012,"resource file {0} not exists !","资源文件[{0}]不存在"),
UDF_RESOURCE_IS_BOUND(20013,"udf resource file is bound by UDF functions:{0}","udf函数绑定了资源文件[{0}]"),
UDF_RESOURCE_IS_BOUND(20013,"udf resource file is bound by UDF functions:{0}","udf函数绑定了资源文件[{0}]"),
RESOURCE_IS_USED(20014,"resource file is used by process definition","资源文件被上线的流程定义使用了"),
RESOURCE_IS_USED(20014,"resource file is used by process definition","资源文件被上线的流程定义使用了"),
PARENT_RESOURCE_NOT_EXIST(20015,"parent resource not exist","父资源文件不存在"),
PARENT_RESOURCE_NOT_EXIST(20015,"parent resource not exist","父资源文件不存在"),
RESOURCE_NOT_EXIST_OR_NO_PERMISSION(20016,"resource not exist or no permission,please view the task node and remove error resource","请检查任务节点并移除无权限或者已删除的资源"),
RESOURCE_NOT_EXIST_OR_NO_PERMISSION(20016,
RESOURCE_IS_AUTHORIZED(20017,"resource is authorized to user {0},suffix not allowed to be modified","资源文件已授权其他用户[{0}],后缀不允许修改"),
"resource not exist or no permission,please view the task node and remove error resource",
"请检查任务节点并移除无权限或者已删除的资源"),
RESOURCE_IS_AUTHORIZED(20017,"resource is authorized to user {0},suffix not allowed to be modified",
"资源文件已授权其他用户[{0}],后缀不允许修改"),
RESOURCE_HAS_FOLDER(20018,"There are files or folders in the current directory:{0}","当前目录下有文件或文件夹[{0}]"),
RESOURCE_HAS_FOLDER(20018,"There are files or folders in the current directory:{0}","当前目录下有文件或文件夹[{0}]"),
USER_NO_OPERATION_PERM(30001,"user has no operation privilege","当前用户没有操作权限"),
USER_NO_OPERATION_PERM(30001,"user has no operation privilege","当前用户没有操作权限"),
USER_NO_OPERATION_PROJECT_PERM(30002,"user {0} is not has project {1} permission","当前用户[{0}]没有[{1}]项目的操作权限"),
USER_NO_OPERATION_PROJECT_PERM(30002,"user {0} is not has project {1} permission","当前用户[{0}]没有[{1}]项目的操作权限"),
PROCESS_INSTANCE_NOT_EXIST(50001,"process instance {0} does not exist","工作流实例[{0}]不存在"),
PROCESS_INSTANCE_NOT_EXIST(50001,"process instance {0} does not exist","工作流实例[{0}]不存在"),
PROCESS_DEFINE_NOT_EXIST(50003,"process definition {0} does not exist","工作流定义[{0}]不存在"),
PROCESS_DEFINE_NOT_EXIST(50003,"process definition {0} does not exist","工作流定义[{0}]不存在"),
PROCESS_DEFINE_NOT_RELEASE(50004,"process definition {0} process version {1} not online","工作流定义[{0}] 工作流版本[{1}]不是上线状态"),
PROCESS_DEFINE_NOT_RELEASE(50004,"process definition {0} process version {1} not online",
"工作流定义[{0}] 工作流版本[{1}]不是上线状态"),
SUB_PROCESS_DEFINE_NOT_RELEASE(50004,"exist sub process definition not online","存在子工作流定义不是上线状态"),
SUB_PROCESS_DEFINE_NOT_RELEASE(50004,"exist sub process definition not online","存在子工作流定义不是上线状态"),
PROCESS_INSTANCE_ALREADY_CHANGED(50005,"the status of process instance {0} is already {1}","工作流实例[{0}]的状态已经是[{1}]"),
PROCESS_INSTANCE_ALREADY_CHANGED(50005,"the status of process instance {0} is already {1}",
PROCESS_INSTANCE_STATE_OPERATION_ERROR(50006,"the status of process instance {0} is {1},Cannot perform {2} operation","工作流实例[{0}]的状态是[{1}],无法执行[{2}]操作"),
"工作流实例[{0}]的状态已经是[{1}]"),
PROCESS_INSTANCE_STATE_OPERATION_ERROR(50006,
"the status of process instance {0} is {1},Cannot perform {2} operation",
"工作流实例[{0}]的状态是[{1}],无法执行[{2}]操作"),
SUB_PROCESS_INSTANCE_NOT_EXIST(50007,"the task belong to process instance does not exist","子工作流实例不存在"),
SUB_PROCESS_INSTANCE_NOT_EXIST(50007,"the task belong to process instance does not exist","子工作流实例不存在"),
PROCESS_DEFINE_NOT_ALLOWED_EDIT(50008,"process definition {0} does not allow edit","工作流定义[{0}]不允许修改"),
PROCESS_DEFINE_NOT_ALLOWED_EDIT(50008,"process definition {0} does not allow edit","工作流定义[{0}]不允许修改"),
PROCESS_INSTANCE_EXECUTING_COMMAND(50009,"process instance {0} is executing the command, please wait ...","工作流实例[{0}]正在执行命令,请稍等..."),
PROCESS_INSTANCE_EXECUTING_COMMAND(50009,"process instance {0} is executing the command, please wait ...",
PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE(50010,"process instance {0} is not sub process instance","工作流实例[{0}]不是子工作流实例"),
"工作流实例[{0}]正在执行命令,请稍等..."),
PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE(50010,"process instance {0} is not sub process instance",
"工作流实例[{0}]不是子工作流实例"),
TASK_INSTANCE_STATE_COUNT_ERROR(50011,"task instance state count error","查询各状态任务实例数错误"),
TASK_INSTANCE_STATE_COUNT_ERROR(50011,"task instance state count error","查询各状态任务实例数错误"),
COUNT_PROCESS_INSTANCE_STATE_ERROR(50012,"count process instance state error","查询各状态流程实例数错误"),
COUNT_PROCESS_INSTANCE_STATE_ERROR(50012,"count process instance state error","查询各状态流程实例数错误"),
COUNT_PROCESS_DEFINITION_USER_ERROR(50013,"count process definition user error","查询各用户流程定义数错误"),
COUNT_PROCESS_DEFINITION_USER_ERROR(50013,"count process definition user error","查询各用户流程定义数错误"),
ACCESS_TOKEN_NOT_EXIST(70015,"access token not exist","访问token不存在"),
ACCESS_TOKEN_NOT_EXIST(70015,"access token not exist","访问token不存在"),
QUERY_ACCESSTOKEN_BY_USER_ERROR(70016,"query access token by user error","查询访问指定用户的token错误"),
QUERY_ACCESSTOKEN_BY_USER_ERROR(70016,"query access token by user error","查询访问指定用户的token错误"),
COMMAND_STATE_COUNT_ERROR(80001,"task instance state count error","查询各状态任务实例数错误"),
COMMAND_STATE_COUNT_ERROR(80001,"task instance state count error","查询各状态任务实例数错误"),
NEGTIVE_SIZE_NUMBER_ERROR(80002,"query size number error","查询size错误"),
NEGTIVE_SIZE_NUMBER_ERROR(80002,"query size number error","查询size错误"),
START_TIME_BIGGER_THAN_END_TIME_ERROR(80003,"start time bigger than end time error","开始时间在结束时间之后错误"),
START_TIME_BIGGER_THAN_END_TIME_ERROR(80003,"start time bigger than end time error","开始时间在结束时间之后错误"),
@ -340,9 +382,11 @@ public enum Status {
// audit log
// audit log
QUERY_AUDIT_LOG_LIST_PAGING(10057,"query resources list paging","分页查询资源列表错误"),
QUERY_AUDIT_LOG_LIST_PAGING(10057,"query resources list paging","分页查询资源列表错误"),
//plugin
//plugin
PLUGIN_NOT_A_UI_COMPONENT(110001,"query plugin error, this plugin has no UI component","查询插件错误,此插件无UI组件"),
PLUGIN_NOT_A_UI_COMPONENT(110001,"query plugin error, this plugin has no UI component","查询插件错误,此插件无UI组件"),
QUERY_PLUGINS_RESULT_IS_NULL(110002,"query alarm plugins result is empty, please check the startup status of the alarm component and confirm that the relevant alarm plugin is successfully registered","查询告警插件为空, 请检查告警组件启动状态并确认相关告警插件已注册成功"),
QUERY_PLUGINS_RESULT_IS_NULL(110002,
"query alarm plugins result is empty, please check the startup status of the alarm component and confirm that the relevant alarm plugin is successfully registered",
DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED(110012,"failed to delete the alert instance, there is an alarm group associated with this alert instance",
CLUSTER_PROCESS_DEFINITIONS_IS_INVALID(1200031,"cluster worker groups is invalid format","集群关联的工作组参数解析错误"),
CLUSTER_PROCESS_DEFINITIONS_IS_INVALID(1200031,"cluster worker groups is invalid format","集群关联的工作组参数解析错误"),
UPDATE_CLUSTER_PROCESS_DEFINITION_RELATION_ERROR(1200032,"You can't modify the process definition, because the process definition [{0}] and this cluster [{1}] already be used in the task [{2}]",
ENVIRONMENT_WORKER_GROUPS_IS_INVALID(130015,"environment worker groups is invalid format","环境关联的工作组参数解析错误"),
ENVIRONMENT_WORKER_GROUPS_IS_INVALID(130015,"environment worker groups is invalid format","环境关联的工作组参数解析错误"),
UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR(130016,"You can't modify the worker group, because the worker group [{0}] and this environment [{1}] already be used in the task [{2}]",