forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Job 支持容器执行 - 脚本任务 TencentBlueKing#2631
- Loading branch information
Showing
4 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
...ns/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/model/job/v4/OpenApiContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. 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.common.esb.model.job.v4; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* OpenAPI - 作业执行对象-容器模型 | ||
*/ | ||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Slf4j | ||
public class OpenApiContainer { | ||
/** | ||
* 容器在 cmdb 注册的 ID | ||
*/ | ||
@JsonProperty("id") | ||
private String id; | ||
|
||
/** | ||
* 容器 ID | ||
*/ | ||
@JsonProperty("container_id") | ||
private String containerId; | ||
|
||
|
||
/** | ||
* 容器所在 Node 对应的主机ID | ||
*/ | ||
@JsonProperty("hostId") | ||
private Long hostId; | ||
|
||
/** | ||
* 容器名称 | ||
*/ | ||
@JsonProperty("name") | ||
private String name; | ||
} |
65 changes: 65 additions & 0 deletions
65
...sb-sdk/src/main/java/com/tencent/bk/job/common/esb/model/job/v4/OpenApiExecuteObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. 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.common.esb.model.job.v4; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
import lombok.Data; | ||
|
||
/** | ||
* OpenAPI - 执行对象定义 | ||
*/ | ||
@Data | ||
public class OpenApiExecuteObject { | ||
|
||
/** | ||
* 执行对象类型 | ||
* | ||
* @see com.tencent.bk.job.common.constant.ExecutionObjectTypeEnum | ||
*/ | ||
@JsonPropertyDescription("Execute object type") | ||
private Integer type; | ||
|
||
/** | ||
* 执行对象 ID,比如主机 ID、容器 ID | ||
*/ | ||
@JsonPropertyDescription("Execute object id") | ||
private String id; | ||
|
||
/** | ||
* 容器 | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonPropertyDescription("Container") | ||
private OpenApiContainer container; | ||
|
||
/** | ||
* 主机 | ||
*/ | ||
@JsonPropertyDescription("Host") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
private OpenApiHost host; | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
...b-sdk/src/main/java/com/tencent/bk/job/common/esb/model/job/v4/OpenApiExecuteObjects.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. 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.common.esb.model.job.v4; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
import com.tencent.bk.job.common.esb.model.job.EsbCmdbTopoNodeDTO; | ||
import com.tencent.bk.job.common.esb.model.job.v3.EsbDynamicGroupDTO; | ||
import lombok.Data; | ||
|
||
import javax.validation.Valid; | ||
import java.util.List; | ||
|
||
/** | ||
* 执行对象定义 | ||
*/ | ||
@Data | ||
public class OpenApiExecuteObjects { | ||
/** | ||
* 全局变量名 | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonPropertyDescription("Variable name") | ||
private String variable; | ||
|
||
@JsonProperty("host_list") | ||
@JsonPropertyDescription("Hosts") | ||
@Valid | ||
private List<OpenApiHost> hosts; | ||
|
||
@JsonProperty("container_list") | ||
@JsonPropertyDescription("Containers") | ||
@Valid | ||
private List<OpenApiContainer> containers; | ||
|
||
|
||
/** | ||
* 动态分组ID列表 | ||
*/ | ||
@JsonProperty("dynamic_group_list") | ||
@JsonPropertyDescription("Cmdb dynamic groups") | ||
@Valid | ||
private List<EsbDynamicGroupDTO> dynamicGroups; | ||
|
||
/** | ||
* 分布式拓扑节点列表 | ||
*/ | ||
@JsonProperty("topo_node_list") | ||
@JsonPropertyDescription("Cmdb topo nodes") | ||
@Valid | ||
private List<EsbCmdbTopoNodeDTO> topoNodes; | ||
} |
74 changes: 74 additions & 0 deletions
74
...commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/model/job/v4/OpenApiHost.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. 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.common.esb.model.job.v4; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import javax.validation.constraints.Min; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Pattern; | ||
|
||
/** | ||
* 作业执行对象-主机模型 | ||
*/ | ||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@ToString | ||
@Slf4j | ||
public class OpenApiHost { | ||
|
||
@JsonProperty("bk_host_id") | ||
@JsonPropertyDescription("Host ID") | ||
private Long hostId; | ||
|
||
@JsonProperty("bk_cloud_id") | ||
@NotNull(message = "{validation.constraints.InvalidBkCloudId.message}") | ||
@Min(value = 0L, message = "{validation.constraints.InvalidBkCloudId.message}") | ||
@JsonPropertyDescription("BK-Network Area") | ||
private Long bkCloudId; | ||
|
||
@JsonProperty("ip") | ||
@Pattern(regexp = "\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)" + | ||
"\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)" + | ||
"\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b", | ||
message = "{validation.constraints.InvalidIp.message}") | ||
@JsonPropertyDescription("ip") | ||
private String ip; | ||
|
||
@JsonProperty("ipv6") | ||
@JsonPropertyDescription("ipv6") | ||
private String ipv6; | ||
|
||
|
||
} |