Debian Codegraph @

cdn/refresh.go

raw symbols SCIP
1 package cdn
2
3 import (
4 "time"
5
6 "github.com/denverdino/aliyungo/common"
7 )
8
9 type RefreshRequest struct {
10 ObjectPath string
11 // optional
12 ObjectType string
13 }
14
15 type RefreshResponse struct {
16 CdnCommonResponse
17 RefreshTaskId string
18 }
19
20 type PushResponse struct {
21 CdnCommonResponse
22 PushTaskId string
23 }
24
25 type DescribeRequest struct {
26 // optional
27 TaskId string
28 ObjectPath string
29 common.Pagination
30 }
31
32 type Task struct {
33 TaskId string
34 ObjectPath string
35 Status string
36 Process string
37 CreationTime time.Time
38 Description string
39 }
40
41 type DescribeResponse struct {
42 CdnCommonResponse
43 common.PaginationResult
44 Tasks struct {
45 CDNTask []Task
46 }
47 }
48
49 type QuotaResponse struct {
50 CdnCommonResponse
51 UrlQuota string
52 DirQuota string
53 UrlRemain string
54 DirRemain string
55 }
56
57 func (client *CdnClient) RefreshObjectCaches(req RefreshRequest) (RefreshResponse, error) {
58 var resp RefreshResponse
59 err := client.Invoke("RefreshObjectCaches", req, &resp)
60 if err != nil {
61 return RefreshResponse{}, err
62 }
63 return resp, nil
64 }
65
66 func (client *CdnClient) PushObjectCache(req RefreshRequest) (PushResponse, error) {
67 var resp PushResponse
68 err := client.Invoke("PushObjectCache", req, &resp)
69 if err != nil {
70 return PushResponse{}, err
71 }
72 return resp, nil
73 }
74
75 func (client *CdnClient) DescribeRefreshTasks(req DescribeRequest) (DescribeResponse, error) {
76 var resp DescribeResponse
77 err := client.Invoke("DescribeRefreshTasks", req, &resp)
78 if err != nil {
79 return DescribeResponse{}, err
80 }
81 return resp, nil
82 }
83
84 func (client *CdnClient) DescribeRefreshQuota() (QuotaResponse, error) {
85 var resp QuotaResponse
86 err := client.Invoke("DescribeRefreshQuota", struct{}{}, &resp)
87 if err != nil {
88 return QuotaResponse{}, err
89 }
90 return resp, nil
91 }