-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.go
260 lines (223 loc) · 8.6 KB
/
template.go
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
package batch
//创建任务模板 https://cloud.tencent.com/document/api/599/15899
type CreateTaskTemplateArgs struct {
TaskTemplateName string `qcloud_arg:"TaskTemplateName"`
TaskTemplateDescription string `qcloud_arg:"TaskTemplateDescription"`
TaskTemplateInfo Task `qcloud_arg:"TaskTemplateInfo"`
}
type Task struct {
TaskName string `qcloud_arg:"TaskName"`
EnvId string `qcloud_arg:"EnvId"`
FailedAction string `qcloud_arg:"FailedAction"`
MaxRetryCount int `qcloud_arg:"MaxRetryCount"`
Timeout int32 `qcloud_arg:"Timeout"`
TaskInstanceNum Application `qcloud_arg:"Application"`
ComputeEnv AnonymousComputeEnv `qcloud_arg:"ComputeEnv"`
RedirectInfo RedirectInfo `qcloud_arg:"RedirectInfo"`
RedirectLocalInfo RedirectLocalInfo `qcloud_arg:"RedirectLocalInfo"`
InputMappings []InputMapping `qcloud_arg:"InputMappings"`
OutputMappings []OutputMapping `qcloud_arg:"OutputMappings"`
OutputMappingConfigs []OutputMappingConfig `qcloud_arg:"OutputMappingConfigs"`
EnvVars []Authentication `qcloud_arg:"EnvVars"`
Authentications []EnvVar `qcloud_arg:"Authentications"`
}
type EnvVar struct {
Name string `qcloud_arg:"Name"`
Value int `qcloud_arg:"Value"`
}
type Authentication struct {
Scene string `qcloud_arg:"Scene"`
SecretId string `qcloud_arg:"SecretId"`
SecretKey string `qcloud_arg:"SecretKey"`
}
type OutputMappingConfig struct {
Scene string `qcloud_arg:"Scene"`
WorkerNum int `qcloud_arg:"WorkerNum"`
WorkerPartSize int `qcloud_arg:"WorkerPartSize"`
}
type OutputMapping struct {
SourcePath string `qcloud_arg:"SourcePath"`
DestinationPath string `qcloud_arg:"DestinationPath"`
}
type InputMapping struct {
SourcePath string `qcloud_arg:"SourcePath"`
DestinationPath string `qcloud_arg:"DestinationPath"`
MountOptionParameter string `qcloud_arg:"MountOptionParameter"`
}
type RedirectInfo struct {
StdoutRedirectPath string `qcloud_arg:"StdoutRedirectPath"`
StderrRedirectPath string `qcloud_arg:"StderrRedirectPath"`
StdoutRedirectFileName string `qcloud_arg:"StdoutRedirectFileName"`
StderrRedirectFileName string `qcloud_arg:"StderrRedirectFileName"`
}
type RedirectLocalInfo struct {
StdoutLocalPath string `qcloud_arg:"StdoutLocalPath"`
StderrLocalPath string `qcloud_arg:"StderrLocalPath"`
StdoutLocalFileName string `qcloud_arg:"StdoutLocalFileName"`
StderrLocalFileName string `qcloud_arg:"StderrLocalFileName"`
}
type Application struct {
Command string `qcloud_arg:"Command"`
DeliveryForm string `qcloud_arg:"DeliveryForm"`
PackagePath string `qcloud_arg:"PackagePath"`
Docker Docker `qcloud_arg:"Docker"`
}
type Docker struct {
User string `qcloud_arg:"User"`
Password string `qcloud_arg:"Password"`
Server string `qcloud_arg:"Server"`
Image string `qcloud_arg:"Image"`
}
type AnonymousComputeEnv struct {
EnvType string `qcloud_arg:"EnvType"`
EnvData EnvData `qcloud_arg:"EnvData"`
MountDataDisks []MountDataDisk `qcloud_arg:"MountDataDisks"`
AgentRunningMode AgentRunningMode `qcloud_arg:"AgentRunningMode"`
}
type EnvData struct {
InstanceType string `qcloud_arg:"InstanceType"`
ImageId string `qcloud_arg:"ImageId"`
InstanceName string `qcloud_arg:"InstanceName"`
SecurityGroupIds *[]string `qcloud_arg:"SecurityGroupIds"`
SystemDisk SystemDisk `qcloud_arg:"SystemDisk"`
DataDisks []DataDisk `qcloud_arg:"DataDisks"`
VirtualPrivateCloud VirtualPrivateCloud `qcloud_arg:"VirtualPrivateCloud"`
InternetAccessible InternetAccessible `qcloud_arg:"InternetAccessible"`
LoginSettings LoginSettings `qcloud_arg:"LoginSettings"`
EnhancedService EnhancedService `qcloud_arg:"EnhancedService"`
}
type MountDataDisk struct {
FileSystemType string `qcloud_arg:"FileSystemType"`
LocalPath string `qcloud_arg:"LocalPath"`
}
type AgentRunningMode struct {
Scene string `qcloud_arg:"Scene"`
User string `qcloud_arg:"User"`
Session string `qcloud_arg:"Session"`
}
type DataDisk struct {
DiskType string `json:"DiskType"`
DiskId string `json:"DiskId"`
DiskSize int `json:"DiskSize"`
}
type SystemDisk struct {
DiskType string `json:"DiskType"`
DiskId string `json:"DiskId"`
DiskSize int `json:"DiskSize"`
}
type InternetAccessible struct {
InternetChargeType string `qcloud_arg:"InternetChargeType"`
InternetMaxBandwidthOut int `qcloud_arg:"InternetMaxBandwidthOut"`
PublicIpAssigned bool `qcloud_arg:"PublicIpAssigned"`
}
type VirtualPrivateCloud struct {
VpcId string `qcloud_arg:"VpcId"`
SubnetId string `qcloud_arg:"SubnetId"`
AsVpcGateway bool `qcloud_arg:"AsVpcGateway"`
}
type LoginSettings struct {
Password string `qcloud_arg:"Password"`
KeepImageLogin string `qcloud_arg:"KeepImageLogin"`
KeyIds interface{} `qcloud_arg:"KeyIds"`
}
type RunMonitorServiceEnabled struct {
Enabled bool `qcloud_arg:"Enabled"`
}
type RunSecurityServiceEnabled struct {
Enabled bool `qcloud_arg:"Enabled"`
}
type EnhancedService struct {
SecurityService RunSecurityServiceEnabled `qcloud_arg:"SecurityService"`
MonitorService RunMonitorServiceEnabled `qcloud_arg:"MonitorService"`
}
type CreateTaskTemplateResponse struct {
RequestId string `json:"RequestId"`
TaskTemplateId string `json:"TaskTemplateId"`
}
func (client *Client) CreateTaskTemplate(args CreateTaskTemplateArgs) (*CreateTaskTemplateResponse, error) {
realRsp := &CreateTaskTemplateResponse{}
Response := &Response{
Response: realRsp,
}
err := client.Invoke("CreateTaskTemplate", args, Response)
if err != nil {
return &CreateTaskTemplateResponse{}, err
}
return realRsp, nil
}
//删除任务模板 https://cloud.tencent.com/document/api/599/15900
type DeleteTaskTemplatesArgs struct {
TaskTemplateIds *[]string `qcloud_arg:"TaskTemplateIds"`
}
type DeleteTaskTemplatesResponse struct {
RequestId string `json:"RequestId"`
}
func (client *Client) DeleteTaskTemplates(args DeleteTaskTemplatesArgs) (*DeleteTaskTemplatesResponse, error) {
realRsp := &DeleteTaskTemplatesResponse{}
Response := &Response{
Response: realRsp,
}
err := client.Invoke("DeleteTaskTemplates", args, Response)
if err != nil {
return &DeleteTaskTemplatesResponse{}, err
}
return realRsp, nil
}
//获取任务模板 https://cloud.tencent.com/document/api/599/15902
type Filter struct {
Name string `qcloud_arg:"Name"`
Values []interface{} `qcloud_arg:"Values"`
}
func NewFilter(name string, values ...interface{}) Filter {
return Filter{Name: name, Values: values}
}
type DescribeTaskTemplatesArgs struct {
Offset int `qcloud_arg:"Offset"`
Limit int `qcloud_arg:"Limit"`
TaskTemplateIds *[]string `qcloud_arg:"TaskTemplateIds"`
Filters *[]Filter `qcloud_arg:"Filters"`
}
type DescribeTaskTemplatesResponse struct {
RequestId string `json:"RequestId"`
TotalCount int `json:"TotalCount"`
TaskTemplateSet []TaskTemplateView `json:"TaskTemplateSet"`
}
type TaskTemplateView struct {
TaskTemplateId string `json:"TaskTemplateId"`
TaskTemplateName string `json:"TaskTemplateName"`
TaskTemplateDescription string `json:"TaskTemplateDescription"`
CreateTime string `json:"CreateTime"`
TaskTemplateInfo Task `json:"TaskTemplateInfo"`
}
func (client *Client) DescribeTaskTemplates(args DescribeTaskTemplatesArgs) (*DescribeTaskTemplatesResponse, error) {
realRsp := &DescribeTaskTemplatesResponse{}
Response := &Response{
Response: realRsp,
}
err := client.Invoke("DescribeTaskTemplates", args, Response)
if err != nil {
return &DescribeTaskTemplatesResponse{}, err
}
return realRsp, nil
}
//修改任务模板 https://cloud.tencent.com/document/api/599/15901
type ModifyTaskTemplateArgs struct {
TaskTemplateId string `qcloud_arg:"TaskTemplateId"`
TaskTemplateName string `qcloud_arg:"TaskTemplateName"`
TaskTemplateDescription string `qcloud_arg:"TaskTemplateDescription"`
TaskTemplateInfo Task `qcloud_arg:"TaskTemplateInfo"`
}
type ModifyTaskTemplateResponse struct {
RequestId string `json:"RequestId"`
}
func (client *Client) ModifyTaskTemplate(args ModifyTaskTemplateArgs) (*ModifyTaskTemplateResponse, error) {
realRsp := &ModifyTaskTemplateResponse{}
Response := &Response{
Response: realRsp,
}
err := client.Invoke("ModifyTaskTemplate", args, Response)
if err != nil {
return &ModifyTaskTemplateResponse{}, err
}
return realRsp, nil
}