Skip to content

Commit b598e3c

Browse files
author
lilang
committed
参数补充
1 parent d3e671c commit b598e3c

File tree

4 files changed

+119
-27
lines changed

4 files changed

+119
-27
lines changed

ci_fileprocess.go

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,14 @@ type FileUncompressResult struct {
4040
}
4141

4242
type FileCompressConfig struct {
43-
Flatten string `xml:",omitempty"`
44-
Format string `xml:",omitempty"`
45-
UrlList string `xml:",omitempty"`
46-
PrefixConfig []FileCompressPrefixConfig `xml:",omitempty"`
47-
Prefix string `xml:",omitempty"`
48-
KeyConfig []FileCompressKeyConfig `xml:",omitempty"`
49-
Key []string `xml:",omitempty"`
50-
Type string `xml:",omitempty"`
51-
CompressKey string `xml:",omitempty"`
52-
IgnoreError string `xml:",omitempty"`
53-
}
54-
55-
type FileCompressPrefixConfig struct {
56-
Prefix string `xml:",omitempty"`
57-
Folder string `xml:",omitempty"`
58-
ImageParams string `xml:",omitempty"`
59-
}
60-
61-
type FileCompressKeyConfig struct {
62-
Key string `xml:",omitempty"`
63-
Folder string `xml:",omitempty"`
64-
Rename string `xml:",omitempty"`
65-
ImageParams string `xml:",omitempty"`
43+
Flatten string `xml:",omitempty"`
44+
Format string `xml:",omitempty"`
45+
UrlList string `xml:",omitempty"`
46+
Prefix string `xml:",omitempty"`
47+
Key []string `xml:",omitempty"`
48+
Type string `xml:",omitempty"`
49+
CompressKey string `xml:",omitempty"`
50+
IgnoreError string `xml:",omitempty"`
6651
}
6752

6853
type FileCompressResult struct {

ci_media.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,23 @@ func (s *CIService) DescribeASRProcessQueues(ctx context.Context, opt *DescribeM
11831183
return &res, resp, err
11841184
}
11851185

1186+
type DescribeFielProcessQueuesOptions DescribeMediaProcessQueuesOptions
1187+
type DescribeFileProcessQueuesResult DescribeMediaProcessQueuesResult
1188+
1189+
// DescribeFileProcessQueues TODO
1190+
func (s *CIService) DescribeFileProcessQueues(ctx context.Context, opt *DescribeFielProcessQueuesOptions) (*DescribeFileProcessQueuesResult, *Response, error) {
1191+
var res DescribeFileProcessQueuesResult
1192+
sendOpt := sendOptions{
1193+
baseURL: s.client.BaseURL.CIURL,
1194+
uri: "/file_queue",
1195+
optQuery: opt,
1196+
method: http.MethodGet,
1197+
result: &res,
1198+
}
1199+
resp, err := s.client.send(ctx, &sendOpt)
1200+
return &res, resp, err
1201+
}
1202+
11861203
// UpdateMediaProcessQueueOptions TODO
11871204
type UpdateMediaProcessQueueOptions struct {
11881205
XMLName xml.Name `xml:"Request"`

ci_media_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,29 @@ func TestCIService_DescribeASRProcessQueues(t *testing.T) {
383383
}
384384
}
385385

386+
func TestCIService_DescribeFileProcessQueues(t *testing.T) {
387+
setup()
388+
defer teardown()
389+
390+
queueIds := "A,B,C"
391+
mux.HandleFunc("/file_queue", func(w http.ResponseWriter, r *http.Request) {
392+
testMethod(t, r, http.MethodGet)
393+
v := values{
394+
"queueIds": queueIds,
395+
}
396+
testFormValues(t, r, v)
397+
})
398+
399+
opt := &DescribeFielProcessQueuesOptions{
400+
QueueIds: queueIds,
401+
}
402+
403+
_, _, err := client.CI.DescribeFileProcessQueues(context.Background(), opt)
404+
if err != nil {
405+
t.Fatalf("CI.DescribeFileProcessQueues returned error: %v", err)
406+
}
407+
}
408+
386409
func TestCIService_UpdateMediaProcessQueue(t *testing.T) {
387410
setup()
388411
defer teardown()
@@ -3374,6 +3397,10 @@ func TestCIService_CosImageInspect(t *testing.T) {
33743397
name := "/test.jpg"
33753398
mux.HandleFunc(name, func(w http.ResponseWriter, r *http.Request) {
33763399
testMethod(t, r, http.MethodGet)
3400+
v := values{
3401+
"ci-process": "ImageInspect",
3402+
}
3403+
testFormValues(t, r, v)
33773404
})
33783405
opt := &CosImageInspectOptions{}
33793406

example/CI/workflow_and_job/ci_queue.go

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,34 @@ func GetASRQueue() {
142142
fmt.Printf("%+v\n", DescribeQueueRes)
143143
}
144144

145+
// GetFileQueue 获取文件处理队列
146+
func GetFileQueue() {
147+
u, _ := url.Parse("https://lilang-1253960454.cos.ap-chongqing.myqcloud.com")
148+
cu, _ := url.Parse("https://lilang-1253960454.ci.ap-chongqing.myqcloud.com")
149+
b := &cos.BaseURL{BucketURL: u, CIURL: cu}
150+
c := cos.NewClient(b, &http.Client{
151+
Transport: &cos.AuthorizationTransport{
152+
SecretID: os.Getenv("COS_SECRETID"),
153+
SecretKey: os.Getenv("COS_SECRETKEY"),
154+
Transport: &debug.DebugRequestTransport{
155+
RequestHeader: true,
156+
// Notice when put a large file and set need the request body, might happend out of memory error.
157+
RequestBody: true,
158+
ResponseHeader: true,
159+
ResponseBody: true,
160+
},
161+
},
162+
})
163+
DescribeQueueOpt := &cos.DescribeFielProcessQueuesOptions{
164+
PageNumber: 1,
165+
PageSize: 2,
166+
Category: "CateAll",
167+
}
168+
DescribeQueueRes, _, err := c.CI.DescribeFileProcessQueues(context.Background(), DescribeQueueOpt)
169+
log_status(err)
170+
fmt.Printf("%+v\n", DescribeQueueRes)
171+
}
172+
145173
func UpdateMediaQueue() {
146174
u, _ := url.Parse("https://test-1234567890.cos.ap-chongqing.myqcloud.com")
147175
cu, _ := url.Parse("https://test-1234567890.ci.ap-chongqing.myqcloud.com")
@@ -278,13 +306,48 @@ func UpdateASRQueue() {
278306
fmt.Printf("%+v\n", DescribeQueueRes)
279307
}
280308

309+
func UpdateFileQueue() {
310+
u, _ := url.Parse("https://test-1234567890.cos.ap-chongqing.myqcloud.com")
311+
cu, _ := url.Parse("https://test-1234567890.ci.ap-chongqing.myqcloud.com")
312+
b := &cos.BaseURL{BucketURL: u, CIURL: cu}
313+
c := cos.NewClient(b, &http.Client{
314+
Transport: &cos.AuthorizationTransport{
315+
SecretID: os.Getenv("COS_SECRETID"),
316+
SecretKey: os.Getenv("COS_SECRETKEY"),
317+
Transport: &debug.DebugRequestTransport{
318+
RequestHeader: true,
319+
// Notice when put a large file and set need the request body, might happend out of memory error.
320+
RequestBody: true,
321+
ResponseHeader: true,
322+
ResponseBody: true,
323+
},
324+
},
325+
})
326+
DescribeQueueOpt := &cos.UpdateMediaProcessQueueOptions{
327+
Name: "queue-asr",
328+
QueueID: "pe91d0af11fc14337987ff0c34f8b0886",
329+
State: "Active",
330+
NotifyConfig: &cos.MediaProcessQueueNotifyConfig{
331+
State: "On",
332+
Url: "http://www.callback.com",
333+
Event: "TaskFinish",
334+
Type: "Url",
335+
ResultFormat: "JSON",
336+
},
337+
}
338+
DescribeQueueRes, _, err := c.CI.UpdateMediaProcessQueue(context.Background(), DescribeQueueOpt)
339+
log_status(err)
340+
fmt.Printf("%+v\n", DescribeQueueRes)
341+
}
342+
281343
func main() {
282344
// UpdateMediaQueue()
283345
// UpdatePicQueue()
284346
// UpdateAIQueue()
285347
// UpdateASRQueue()
286-
GetMediaQueue()
287-
GetPicQueue()
288-
GetAIQueue()
289-
GetASRQueue()
348+
// GetMediaQueue()
349+
// GetPicQueue()
350+
// GetAIQueue()
351+
// GetASRQueue()
352+
// GetFileQueue()
290353
}

0 commit comments

Comments
 (0)