forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EsbCronJobV3Resource.java
152 lines (142 loc) · 6.9 KB
/
EsbCronJobV3Resource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* 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.crontab.api.esb.v3;
import com.tencent.bk.job.common.annotation.EsbAPI;
import com.tencent.bk.job.common.constant.JobCommonHeaders;
import com.tencent.bk.job.common.esb.model.EsbResp;
import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3;
import com.tencent.bk.job.crontab.model.esb.v3.request.EsbDeleteCronV3Request;
import com.tencent.bk.job.crontab.model.esb.v3.request.EsbGetCronDetailV3Request;
import com.tencent.bk.job.crontab.model.esb.v3.request.EsbGetCronListV3Request;
import com.tencent.bk.job.crontab.model.esb.v3.request.EsbSaveCronV3Request;
import com.tencent.bk.job.crontab.model.esb.v3.request.EsbUpdateCronStatusV3Request;
import com.tencent.bk.job.crontab.model.esb.v3.response.EsbCronInfoV3DTO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @since 26/2/2020 16:24
*/
@RequestMapping("/esb/api/v3")
@RestController
@EsbAPI
public interface EsbCronJobV3Resource {
@GetMapping("/get_cron_list")
EsbResp<EsbPageDataV3<EsbCronInfoV3DTO>> getCronList(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestParam(value = "bk_biz_id", required = false) Long bizId,
@RequestParam(value = "bk_scope_type", required = false) String scopeType,
@RequestParam(value = "bk_scope_id", required = false) String scopeId,
@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "creator", required = false) String creator,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(value = "create_time_start", required = false) Long createTimeStart,
@RequestParam(value = "create_time_end", required = false) Long createTimeEnd,
@RequestParam(value = "last_modify_user", required = false) String lastModifyUser,
@RequestParam(value = "last_modify_time_start", required = false) Long lastModifyTimeStart,
@RequestParam(value = "last_modify_time_end", required = false) Long lastModifyTimeEnd,
@RequestParam(value = "start", required = false) Integer start,
@RequestParam(value = "length", required = false) Integer length);
@GetMapping("/get_cron_detail")
EsbResp<EsbCronInfoV3DTO> getCronDetail(@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestParam(value = "bk_biz_id", required = false) Long bizId,
@RequestParam(value = "bk_scope_type", required = false) String scopeType,
@RequestParam(value = "bk_scope_id", required = false) String scopeId,
@RequestParam(value = "id") Long id);
/**
* 获取定时任务列表
*
* @param request 查询请求
* @return 定时任务列表
*/
@PostMapping("/get_cron_list")
EsbResp<EsbPageDataV3<EsbCronInfoV3DTO>> getCronListUsingPost(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody
@Validated
EsbGetCronListV3Request request
);
/**
* 获取定时任务详情
*
* @param request 查询请求
* @return 定时任务详情
*/
@PostMapping("/get_cron_detail")
EsbResp<EsbCronInfoV3DTO> getCronDetailUsingPost(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody
@Validated
EsbGetCronDetailV3Request request
);
/**
* 更新定时任务状态
*
* @param request 更新请求
* @return 定时任务详情
*/
@PostMapping(value = "/update_cron_status")
EsbResp<EsbCronInfoV3DTO> updateCronStatus(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody
@Validated
EsbUpdateCronStatusV3Request request
);
/**
* 更新定时任务详情
*
* @param request 更新请求
* @return 定时任务详情
*/
@PostMapping(value = "/save_cron")
EsbResp<EsbCronInfoV3DTO> saveCron(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody
@Validated
EsbSaveCronV3Request request
);
/**
* 删除定时任务
*/
@PostMapping(value = "/delete_cron")
EsbResp deleteCron(
@RequestHeader(value = JobCommonHeaders.USERNAME) String username,
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode,
@RequestBody
@Validated
EsbDeleteCronV3Request request
);
}