Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
1243039=脚本版本 ID 已存在
1243040=作业模板名称[{0}]已存在
1243041=更新模版失败!并发冲突,请不要多次点击保存
1243042=执行方案名称已存在
1243045=同步脚本失败
1243046=批量更新变量值失败
1243047=脚本版本不存在
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
1243039=Script version id already exist
1243040=Job template name [{0}] already exist
1243041=Update template acquire lock failed! Please do not click save multiple times!
1243042=Job plan name already exists
1243045=Sync script failed
1243046=Failed to batch update variable values
1243047=Script version does not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
1243039=Script version id already exist
1243040=Job template name [{0}] already exist
1243041=Update template acquire lock failed! Please do not click save multiple times!
1243042=Job plan name already exists
1243045=Sync script failed
1243046=Failed to batch update variable values
1243047=Script version does not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
1243039=脚本版本 ID 已存在
1243040=作业模板名称[{0}]已存在
1243041=更新模版失败!并发冲突,请不要多次点击保存
1243042=执行方案名称已存在
1243045=同步脚本失败
1243046=批量更新变量值失败
1243047=脚本版本不存在
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
1243039=脚本版本 ID 已存在
1243040=作业模板名称[{0}]已存在
1243041=更新模版失败!并发冲突,请不要多次点击保存
1243042=执行方案名称已存在
1243045=同步脚本失败
1243046=批量更新变量值失败
1243047=脚本版本不存在
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ validation.constraints.InvalidCronJobName_outOfLength.message=定时作业名称
validation.constraints.InvalidCronExpression.message=非法的 Cron 表达式
validation.constraints.InvalidCronExecuteTime.message=非法的执行时间

## 执行方案 OpenAPI V4
validation.constraints.InvalidJobTemplateId.message=作业模板 ID(job_template_id)非法
validation.constraints.InvalidJobPlanName_empty.message=执行方案名称(name)不能为空
validation.constraints.InvalidJobPlanName_outOfLength.message=执行方案名称(name)不能超过 {max} 个字符
validation.constraints.InvalidEnableSteps_empty.message=enable_steps 不允许传空数组
validation.constraints.InvalidJobPlanVariableName_empty.message=变量名(variables[].name)不能为空

## 账号
validation.constraints.AccountId_empty.message=账号ID不能为空
validation.constraints.AccountName_empty.message=账号名称不能为空
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ validation.constraints.InvalidCronJobName_outOfLength.message=Cron name can not
validation.constraints.InvalidCronExpression.message=Invalid cron expression
validation.constraints.InvalidCronExecuteTime.message=Invalid cron execute time

## Job Plan OpenAPI V4
validation.constraints.InvalidJobTemplateId.message=job_template_id is invalid
validation.constraints.InvalidJobPlanName_empty.message=name cannot be empty
validation.constraints.InvalidJobPlanName_outOfLength.message=name cannot exceed {max} characters
validation.constraints.InvalidEnableSteps_empty.message=enable_steps must not be an empty array
validation.constraints.InvalidJobPlanVariableName_empty.message=variables[].name cannot be empty

## Account
validation.constraints.AccountId_empty.message=Account id cannot be empty
validation.constraints.AccountName_empty.message=Account name cannot be empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ validation.constraints.InvalidCronJobName_outOfLength.message=Cron name can not
validation.constraints.InvalidCronExpression.message=Invalid cron expression
validation.constraints.InvalidCronExecuteTime.message=Invalid cron execute time

## Job Plan OpenAPI V4
validation.constraints.InvalidJobTemplateId.message=job_template_id is invalid
validation.constraints.InvalidJobPlanName_empty.message=name cannot be empty
validation.constraints.InvalidJobPlanName_outOfLength.message=name cannot exceed {max} characters
validation.constraints.InvalidEnableSteps_empty.message=enable_steps must not be an empty array
validation.constraints.InvalidJobPlanVariableName_empty.message=variables[].name cannot be empty

## Account
validation.constraints.AccountId_empty.message=Account id cannot be empty
validation.constraints.AccountName_empty.message=Account name cannot be empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ validation.constraints.InvalidCronJobName_outOfLength.message=定时作业名称
validation.constraints.InvalidCronExpression.message=非法的 Cron 表达式
validation.constraints.InvalidCronExecuteTime.message=非法的执行时间

## 执行方案 OpenAPI V4
validation.constraints.InvalidJobTemplateId.message=作业模板 ID(job_template_id)非法
validation.constraints.InvalidJobPlanName_empty.message=执行方案名称(name)不能为空
validation.constraints.InvalidJobPlanName_outOfLength.message=执行方案名称(name)不能超过 {max} 个字符
validation.constraints.InvalidEnableSteps_empty.message=enable_steps 不允许传空数组
validation.constraints.InvalidJobPlanVariableName_empty.message=变量名(variables[].name)不能为空

## 账号
validation.constraints.AccountId_empty.message=账号ID不能为空
validation.constraints.AccountName_empty.message=账号名称不能为空
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ validation.constraints.InvalidCronJobName_outOfLength.message=定时作业名称
validation.constraints.InvalidCronExpression.message=非法的 Cron 表达式
validation.constraints.InvalidCronExecuteTime.message=非法的执行时间

## 执行方案 OpenAPI V4
validation.constraints.InvalidJobTemplateId.message=作业模板 ID(job_template_id)非法
validation.constraints.InvalidJobPlanName_empty.message=执行方案名称(name)不能为空
validation.constraints.InvalidJobPlanName_outOfLength.message=执行方案名称(name)不能超过 {max} 个字符
validation.constraints.InvalidEnableSteps_empty.message=enable_steps 不允许传空数组
validation.constraints.InvalidJobPlanVariableName_empty.message=变量名(variables[].name)不能为空

## 账号
validation.constraints.AccountId_empty.message=账号ID不能为空
validation.constraints.AccountName_empty.message=账号名称不能为空
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 Tencent. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

package com.tencent.bk.job.manage.api.esb.v4;

import com.tencent.bk.job.common.annotation.EsbV4API;
import com.tencent.bk.job.common.constant.JobCommonHeaders;
import com.tencent.bk.job.common.esb.model.v4.EsbV4Response;
import com.tencent.bk.job.manage.model.esb.v4.OpenApiV4JobPlanDTO;
import com.tencent.bk.job.manage.model.esb.v4.req.V4CreateJobPlanRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* OpenAPI V4 执行方案管理资源。当前包含基于作业模板创建执行方案的接口。
*/
@RequestMapping("/esb/api/v4")
@EsbV4API
@RestController
@Validated
public interface OpenApiJobPlanV4Resource {

/**
* 基于作业模板创建执行方案
*/
@PostMapping("/create_job_plan")
EsbV4Response<OpenApiV4JobPlanDTO> createJobPlan(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody @Validated V4CreateJobPlanRequest request
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 Tencent. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

package com.tencent.bk.job.manage.model.esb.v4;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.tencent.bk.job.common.esb.model.EsbAppScopeDTO;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
* OpenAPI V4 执行方案响应体(如 create_job_plan 的 data)。
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
public class OpenApiV4JobPlanDTO extends EsbAppScopeDTO {

/**
* 执行方案 ID
*/
@JsonProperty("job_plan_id")
@JsonPropertyDescription("Job plan id")
private Long jobPlanId;

/**
* 执行方案名称
*/
@JsonProperty("job_plan_name")
@JsonPropertyDescription("Job plan name")
private String jobPlanName;

/**
* 作业模板 ID
*/
@JsonProperty("job_template_id")
@JsonPropertyDescription("Job template id")
private Long jobTemplateId;

/**
* 创建人(来自请求头 username)
*/
@JsonProperty("creator")
@JsonPropertyDescription("Creator")
private String creator;

/**
* 创建时间,Unix 时间戳,单位毫秒
*/
@JsonProperty("create_time")
@JsonPropertyDescription("Create time, unix timestamp in milliseconds")
private Long createTime;

/**
* 是否需要从作业模板同步;与 Web 端执行方案详情 needUpdate 语义一致
*/
@JsonProperty("need_update")
@JsonPropertyDescription("Whether plan need to sync with template")
private Boolean needUpdate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 Tencent. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

package com.tencent.bk.job.manage.model.esb.v4.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbAppScopeReq;
import com.tencent.bk.job.common.validation.NoXss;
import lombok.Getter;
import lombok.Setter;

import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;

/**
* OpenAPI V4 创建执行方案请求体。
*/
@Getter
@Setter
public class V4CreateJobPlanRequest extends EsbAppScopeReq {

/**
* 作业模板 ID,必填且必须 > 0。
*/
@JsonProperty("job_template_id")
@NotNull(message = "{validation.constraints.InvalidJobTemplateId.message}")
@Min(value = 1L, message = "{validation.constraints.InvalidJobTemplateId.message}")
private Long jobTemplateId;

/**
* 执行方案名称,必填且 1-60 字符;在 (appId, templateId) 下需唯一。
*/
@JsonProperty("name")
@NotBlank(message = "{validation.constraints.InvalidJobPlanName_empty.message}")
@Size(max = 60, message = "{validation.constraints.InvalidJobPlanName_outOfLength.message}")
@NoXss(fieldName = "name")
private String name;

/**
* 启用的模板步骤 ID 列表。可选;不传或传 null 时启用全部模板步骤;
* 不允许传空数组(与 Web 端一致地校验);列表内出现非模板步骤 ID 将报错。
*/
@JsonProperty("enable_steps")
@Size(min = 1, message = "{validation.constraints.InvalidEnableSteps_empty.message}")
private List<Long> enableSteps;

/**
* 变量覆盖列表。可选;按变量名定位模板变量并覆盖默认值。
*/
@JsonProperty("variables")
@Valid
private List<V4JobPlanVariableItem> variables;
}
Loading
Loading