Skip to content

Commit

Permalink
perf: API 校验优化 #2769
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliaozhong committed Jul 21, 2024
1 parent b83562a commit 4ca137b
Show file tree
Hide file tree
Showing 65 changed files with 1,483 additions and 838 deletions.
36 changes: 18 additions & 18 deletions docs/apidoc/bk-api-gateway/v3/zh/fast_execute_script.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@

#### Body参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------|
| bk_scope_type | string | | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string || 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| bk_biz_id | long | | *已弃用*。业务ID。此字段已被弃用并由字段bk_scope_type+bk_scope_id替换 |
| script_version_id | long | | 脚本版本ID。当script_version_id不为空的时候,使用script_version_id对应的脚本版本 |
| script_id | string || 脚本ID。当传入script_id,且script_version_id为空的时候,使用脚本的上线版本 |
| script_content | string || 脚本内容Base64。如果不存在script_version_id和script_id,那么使用script_content。优先级:script_version_id>script_id>script_content |
| task_name | string | | 自定义作业名称 |
| script_param | string | | 脚本参数Base64。注意:如果有多个参数,比如"param1 param2"这种,需要对"param1 param2"整体进行base64编码,而不是对每个参数进行base64编码再拼接起来 |
| timeout | long | | 脚本执行超时时间,秒。默认7200,取值范围1-259200 |
| account_alias | string | | 执行账号别名。与account_id必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| account_id | long || 执行账号ID。与account_alias必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| is_param_sensitive | int | | 敏感参数将会在执行详情页面上隐藏, 0:不是(默认),1:是 |
| script_language | int | | 脚本语言:1 - shell, 2 - bat, 3 - perl, 4 - python, 5 - powershell。当使用script_content传入自定义脚本的时候,需要指定script_language |
| target_server | object | | 目标服务器,见server定义 |
| callback_url | string | | 回调URL,当任务执行完成后,JOB会调用该URL告知任务执行结果。回调协议参考callback_protocol组件文档 |
| rolling_config | object | | 滚动配置,见rolling_config定义 |
| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|----|------------|
| bk_scope_type | string || 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| bk_biz_id | long || *已弃用*。业务ID。此字段已被弃用并由字段bk_scope_type+bk_scope_id替换 |
| script_version_id | long || 脚本版本ID。当script_version_id不为空的时候,使用script_version_id对应的脚本版本 |
| script_id | string | | 脚本ID。当传入script_id,且script_version_id为空的时候,使用脚本的上线版本 |
| script_content | string | | 脚本内容Base64。如果不存在script_version_id和script_id,那么使用script_content。优先级:script_version_id>script_id>script_content |
| task_name | string || 自定义作业名称 |
| script_param | string || 脚本参数Base64。注意:如果有多个参数,比如"param1 param2"这种,需要对"param1 param2"整体进行base64编码,而不是对每个参数进行base64编码再拼接起来 |
| timeout | long || 脚本执行超时时间,秒。默认7200,取值范围1-259200 |
| account_alias | string || 执行账号别名。与account_id必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| account_id | long | | 执行账号ID。与account_alias必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| is_param_sensitive | int || 敏感参数将会在执行详情页面上隐藏, 0:不是(默认),1:是 |
| script_language | int || 脚本语言:1 - shell, 2 - bat, 3 - perl, 4 - python, 5 - powershell。当使用script_content传入自定义脚本的时候,需要指定script_language |
| target_server | object | | 目标服务器,见server定义 |
| callback_url | string || 回调URL,当任务执行完成后,JOB会调用该URL告知任务执行结果。回调协议参考callback_protocol组件文档 |
| rolling_config | object || 滚动配置,见rolling_config定义 |

##### server
| 字段 | 类型 | 必选 | 描述 |
Expand Down
30 changes: 15 additions & 15 deletions docs/apidoc/esb/jobv3-confapis/apidocs/en/fast_execute_script.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ Start Job Plan
#### Interface parameters

| Fields | Type | Required | Description |
|---------------|------------|--------|------------|
| bk_scope_type | string | yes | Resource scope type. Optional values: biz - Business,biz_set - Business Set |
| bk_scope_id | string | yes | Resource scope ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| script_version_id | long | no | Script version ID. When script_version_id is not empty, the script version corresponding to script_version_id is used|
| script_id | string | no |Script id. When script_id is passed in and script_version_id is empty, the online version of the script is used|
| script_content | string | no |Script content Base64. If script_version_id and script_id do not exist, script_content is used. Priority: script_version_id>script_id>script_content|
| task_name | string | no | Custom job name|
| script_param | string | no | Script parameter Base64 encoding.|
| timeout | long | no | Script execution timeout in seconds. The default value is 7200, and the value range is [1,86400]|
| account_alias | string | no | Execution account alias. The account_id takes precedence when both account_alias and account_id exist. |
| account_id | long | no |Execution account ID. The account_id takes precedence when both account_alias and account_id exist. |
| is_param_sensitive | int | no | Sensitive parameters will be hidden on the execution details page, 0: No (default), 1: Yes|
| script_language | int | no |Scripting languages: 1 - shell, 2 - bat, 3 - Perl, 4 - Python, 5 - PowerShell. Script_language needs to be specified when you pass in a custom script using script_content|
| target_server | object | no | Target server, see server definition|
| callback_url | string | no | Callback URL, when the task execution is completed, the JOB will call this URL to inform the task execution result. Callback protocol refer to the callback_protocol component documentation|
|---------------|------------|----------|------------|
| bk_scope_type | string | yes | Resource scope type. Optional values: biz - Business,biz_set - Business Set |
| bk_scope_id | string | yes | Resource scope ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| script_version_id | long | no | Script version ID. When script_version_id is not empty, the script version corresponding to script_version_id is used|
| script_id | string | no |Script id. When script_id is passed in and script_version_id is empty, the online version of the script is used|
| script_content | string | no |Script content Base64. If script_version_id and script_id do not exist, script_content is used. Priority: script_version_id>script_id>script_content|
| task_name | string | no | Custom job name|
| script_param | string | no | Script parameter Base64 encoding.|
| timeout | long | no | Script execution timeout in seconds. The default value is 7200, and the value range is [1,86400]|
| account_alias | string | no | Execution account alias. The account_id takes precedence when both account_alias and account_id exist. |
| account_id | long | no |Execution account ID. The account_id takes precedence when both account_alias and account_id exist. |
| is_param_sensitive | int | no | Sensitive parameters will be hidden on the execution details page, 0: No (default), 1: Yes|
| script_language | int | no |Scripting languages: 1 - shell, 2 - bat, 3 - Perl, 4 - Python, 5 - PowerShell. Script_language needs to be specified when you pass in a custom script using script_content|
| target_server | object | yes | Target server, see server definition|
| callback_url | string | no | Callback URL, when the task execution is completed, the JOB will call this URL to inform the task execution result. Callback protocol refer to the callback_protocol component documentation|

#### server
| Fields | Type | Required | Description |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------|
| bk_scope_type | string | | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string || 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| script_version_id | long | | 脚本版本ID。当script_version_id不为空的时候,使用script_version_id对应的脚本版本 |
| script_id | string || 脚本ID。当传入script_id,且script_version_id为空的时候,使用脚本的上线版本 |
| script_content | string || 脚本内容Base64。如果不存在script_version_id和script_id,那么使用script_content。优先级:script_version_id>script_id>script_content |
| task_name | string | | 自定义作业名称 |
| script_param | string | | 脚本参数Base64。注意:如果有多个参数,比如"param1 param2"这种,需要对"param1 param2"整体进行base64编码,而不是对每个参数进行base64编码再拼接起来 |
| timeout | long | | 脚本执行超时时间,秒。默认7200,取值范围1-259200 |
| account_alias | string | | 执行账号别名。与account_id必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| account_id | long || 执行账号ID。与account_alias必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| is_param_sensitive | int | | 敏感参数将会在执行详情页面上隐藏, 0:不是(默认),1:是 |
| script_language | int | | 脚本语言:1 - shell, 2 - bat, 3 - perl, 4 - python, 5 - powershell。当使用script_content传入自定义脚本的时候,需要指定script_language |
| target_server | object | | 目标服务器,见server定义 |
| callback_url | string | | 回调URL,当任务执行完成后,JOB会调用该URL告知任务执行结果。回调协议参考callback_protocol组件文档 |
| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|----|------------|
| bk_scope_type | string || 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| script_version_id | long || 脚本版本ID。当script_version_id不为空的时候,使用script_version_id对应的脚本版本 |
| script_id | string | | 脚本ID。当传入script_id,且script_version_id为空的时候,使用脚本的上线版本 |
| script_content | string | | 脚本内容Base64。如果不存在script_version_id和script_id,那么使用script_content。优先级:script_version_id>script_id>script_content |
| task_name | string || 自定义作业名称 |
| script_param | string || 脚本参数Base64。注意:如果有多个参数,比如"param1 param2"这种,需要对"param1 param2"整体进行base64编码,而不是对每个参数进行base64编码再拼接起来 |
| timeout | long || 脚本执行超时时间,秒。默认7200,取值范围1-259200 |
| account_alias | string || 执行账号别名。与account_id必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| account_id | long | | 执行账号ID。与account_alias必须存在一个。当同时存在account_alias和account_id时,account_id优先。 |
| is_param_sensitive | int || 敏感参数将会在执行详情页面上隐藏, 0:不是(默认),1:是 |
| script_language | int || 脚本语言:1 - shell, 2 - bat, 3 - perl, 4 - python, 5 - powershell。当使用script_content传入自定义脚本的时候,需要指定script_language |
| target_server | object | | 目标服务器,见server定义 |
| callback_url | string || 回调URL,当任务执行完成后,JOB会调用该URL告知任务执行结果。回调协议参考callback_protocol组件文档 |

#### server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
validation.constraints.NotContainSpecialChar.message=不可包含 \\|/:*<>"? 特殊字符
validation.constraints.NotBlankField.message=不能为空
validation.constraints.InvalidEnumValue.message=枚举值非法
validation.constraints.NotBlankAtLeastOneField.message=至少有一个属性不为空
validation.constraints.InvalidCollectionSize_outOfLimit.message=集合大小超过了最大限制

## 主机
validation.constraints.InvalidBkCloudId.message=管控区域 ID 非法
Expand All @@ -45,6 +43,9 @@ validation.constraints.TaskName_empty.message=作业名称不能为空
validation.constraints.TaskName_outOfLength.message=作业名称不能超过 {max} 个字符
validation.constraints.TaskName_illegal.message=作业名称非法
validation.constraints.ExecuteTarget_empty.message=作业执行目标不能为空
validation.constraints.InvalidTaskTarget_VarName_empty.message=作业执行目标-全局变量不能为空
validation.constraints.InvalidTaskTarget_HostNode_empty.message=作业执行目标-主机节点不能为空
validation.constraints.InvalidTaskTarget_ExecuteObj_empty.message=作业执行目标-执行对象不能为空
validation.constraints.InvalidFileUploadSettingAmount.message=文件大小只能为大于0的浮点数
validation.constraints.InvalidFileName_empty.message=文件名称不能为空
validation.constraints.InvalidFileContent_empty.message=文件内容不能为空
Expand All @@ -54,7 +55,7 @@ validation.constraints.InvalidPort.message=端口号只能为1-65535之间的整
validation.constraints.InvalidJobInstanceId.message=任务实例ID必须为正整数
validation.constraints.InvalidStepInstanceId.message=步骤实例ID必须为正整数
validation.constraints.InvalidGlobalVarId.message=全局变量ID不能为空且必须大于0
validation.constraints.InvalidGlobalVarIdOrName_empty.message=全局变量 ID、名称不能同时为空
validation.constraints.InvalidGlobalVarName_empty.message=全局变量名称不能为空
validation.constraints.InvalidGlobalVarType_illegal.message=全局变量类型非法
validation.constraints.InvalidGlobalVarType_empty.message=全局变量类型不能为空
validation.constraints.InvalidUploadFileSuffix.message=非法的上传文件后缀
Expand All @@ -69,6 +70,7 @@ validation.constraints.InvalidSourceFileObject_empty.message=源文件对象不
validation.constraints.InvalidSourceFileHost_empty.message=源文件主机信息不能为空
validation.constraints.InvalidSourceFileList_empty.message=源文件的文件列表不能为空
validation.constraints.InvalidSourceFilePath_illegal.message=源文件的文件路径不合法
validation.constraints.InvalidSourceFileType_empty.message=源文件类型不能为空
validation.constraints.InvalidSourceFileType_illegal.message=源文件类型非法
validation.constraints.InvalidTaskType_illegal.message=任务类型非法
validation.constraints.InvalidTaskOperationType_illegal.message=作业实例操作类型非法
Expand Down Expand Up @@ -97,7 +99,7 @@ validation.constraints.InvalidHighRiskRegularStatus.message=非法的规则启
validation.constraints.InvalidHighRiskRegularDescription_outOfLength.message=规则说明不能超过{max}个字符

## 脚本
validation.constraints.ScriptTypeList_empty.message=脚本类型不能为空
validation.constraints.ScriptTypeList_empty.message=脚本类型列表不能为空
validation.constraints.ScriptName_outOfLength.message=脚本名称不能超过{max}个字符
validation.constraints.ScriptVersion_outOfLength.message=脚本版本不能超过{max}个字符
validation.constraints.ScriptVersion_illegal.message=脚本版本非法
Expand All @@ -109,8 +111,9 @@ validation.constraints.ScriptId_empty.message=脚本ID不能为空
validation.constraints.ScriptName_illegal.message=脚本名称非法
validation.constraints.ScriptName_empty.message=脚本名称不能为空
validation.constraints.ScriptContent_empty.message=脚本内容不能为空
validation.constraints.ScriptIdOrVersionIdOrContent_empty.message=脚本ID、脚本版本ID、脚本内容不能同时为空
validation.constraints.ScriptSource_empty.message=脚本来源不能为空
validation.constraints.ScriptSource_Illegal.message=脚本来源非法
validation.constraints.ScriptDesc_empty.message=脚本描述不能为空

## 业务
validation.constraints.InvalidBkBizId.message=业务ID不能为空且必须大于0
Expand Down Expand Up @@ -140,7 +143,6 @@ validation.constraints.AccountPassword_tooLong.message=账号密码不能超过2
validation.constraints.AccountAlias_tooLong.message=账号别名不能超过255字符
validation.constraints.AccountDescription_tooLong.message=账号描述不能超过1024字符
validation.constraints.AccountAlias_empty.message=账号别名不能为空
validation.constraints.AccountIdOrAlias_empty.message=账号ID、账号别名不能同时为空
validation.constraints.DbSystemAccountId_empty.message=数据库关联的系统账号不能为空

## 标签
Expand Down Expand Up @@ -169,7 +171,7 @@ validation.constraints.InvalidFileSourceAlias_illegal.message=文件源别名非
validation.constraints.InvalidFileSourceCode_illegal.message=非法文件源code(由英文字符开头,1-32位英文字符、下划线、数字组成)
validation.constraints.InvalidFileSourceType_empty.message=文件源类型不能为空
validation.constraints.InvalidFileSourceType_illegal.message=文件源类型非法
validation.constraints.InvalidFileSourceIdOrCode_empty.message=文件源ID、code不能同时为空
validation.constraints.InvalidFileSourceId_empty.message=文件源ID不能为空且必须大于0
validation.constraints.InvalidFileSourceCredentialId_empty.message=文件源凭证ID不能为空
validation.constraints.InvalidFileSourceCredentialId_illegal.message=文件源凭证ID非法

Expand All @@ -189,3 +191,5 @@ validation.constraints.queryAgentInfoHostIds_tooMany.message=单次查询主机
validation.constraints.queryExecuteObjects_outOfRange.message=单次查询执行对象数量范围必须在 {min}-{max} 之间
validation.constraints.FileNameList_empty.message=文件名列表不能为空
validation.constraints.InvalidOperation_empty.message=操作ID不能为空
validation.constraints.InvalidUpdateField_empty.message=更新的字段不能为空
validation.constraints.InvalidApprovalUser_empty.message=审批人不能为空
Loading

0 comments on commit 4ca137b

Please sign in to comment.