purge_caches_request_model.go raw
1 // This file is auto-generated, don't edit it. Thanks.
2 package client
3
4 import (
5 "github.com/alibabacloud-go/tea/dara"
6 )
7
8 type iPurgeCachesRequest interface {
9 dara.Model
10 String() string
11 GoString() string
12 SetContent(v *PurgeCachesRequestContent) *PurgeCachesRequest
13 GetContent() *PurgeCachesRequestContent
14 SetEdgeComputePurge(v bool) *PurgeCachesRequest
15 GetEdgeComputePurge() *bool
16 SetForce(v bool) *PurgeCachesRequest
17 GetForce() *bool
18 SetSiteId(v int64) *PurgeCachesRequest
19 GetSiteId() *int64
20 SetType(v string) *PurgeCachesRequest
21 GetType() *string
22 }
23
24 type PurgeCachesRequest struct {
25 // Content to be refreshed.
26 Content *PurgeCachesRequestContent `json:"Content,omitempty" xml:"Content,omitempty" type:"Struct"`
27 // Used for refreshing cached resources in edge computing, such as allowing the refresh of content cached using the CacheAPI interface of an edge function.
28 //
29 // example:
30 //
31 // true
32 EdgeComputePurge *bool `json:"EdgeComputePurge,omitempty" xml:"EdgeComputePurge,omitempty"`
33 // Indicates whether to refresh all resources under the directory when the content from the origin and the source resource are inconsistent. The default is false.
34 //
35 // - **true**: Refreshes all resources under the specified directory.
36 //
37 // - **false**: Refreshes only the changed resources under the specified directory.
38 //
39 // >
40 //
41 // > Applies to: Directory refresh, cachetag refresh, ignoreParams refresh, hostname refresh, and purge all cache of the site.
42 //
43 // example:
44 //
45 // true
46 Force *bool `json:"Force,omitempty" xml:"Force,omitempty"`
47 // Site ID, which can be obtained by calling the [ListSites](https://help.aliyun.com/document_detail/2850189.html) interface.
48 //
49 // This parameter is required.
50 //
51 // example:
52 //
53 // 123456789****
54 SiteId *int64 `json:"SiteId,omitempty" xml:"SiteId,omitempty"`
55 // The type of refresh task. Possible values:
56 //
57 // - **file* - (default): File refresh.
58 //
59 // - **cachekey**: Cachekey refresh.
60 //
61 // - **cachetag**: Cachetag refresh.
62 //
63 // - **directory**: Directory refresh.
64 //
65 // - **ignoreParams**: Ignore parameters refresh. Ignoring parameters means removing the ? and everything after it in the request URL. When performing an ignore parameters refresh, the user first submits the URL without parameters through the interface. The submitted URLs to be refreshed will then be matched against the cached resource URLs with the parameters removed. If the cached resource URL, after removing the parameters, matches the URL to be refreshed, the CDN node will refresh the cached resources.
66 //
67 // - **hostname**: Hostname refresh.
68 //
69 // - **purgeall**: Purge all cache under the site.
70 //
71 // This parameter is required.
72 //
73 // example:
74 //
75 // file
76 Type *string `json:"Type,omitempty" xml:"Type,omitempty"`
77 }
78
79 func (s PurgeCachesRequest) String() string {
80 return dara.Prettify(s)
81 }
82
83 func (s PurgeCachesRequest) GoString() string {
84 return s.String()
85 }
86
87 func (s *PurgeCachesRequest) GetContent() *PurgeCachesRequestContent {
88 return s.Content
89 }
90
91 func (s *PurgeCachesRequest) GetEdgeComputePurge() *bool {
92 return s.EdgeComputePurge
93 }
94
95 func (s *PurgeCachesRequest) GetForce() *bool {
96 return s.Force
97 }
98
99 func (s *PurgeCachesRequest) GetSiteId() *int64 {
100 return s.SiteId
101 }
102
103 func (s *PurgeCachesRequest) GetType() *string {
104 return s.Type
105 }
106
107 func (s *PurgeCachesRequest) SetContent(v *PurgeCachesRequestContent) *PurgeCachesRequest {
108 s.Content = v
109 return s
110 }
111
112 func (s *PurgeCachesRequest) SetEdgeComputePurge(v bool) *PurgeCachesRequest {
113 s.EdgeComputePurge = &v
114 return s
115 }
116
117 func (s *PurgeCachesRequest) SetForce(v bool) *PurgeCachesRequest {
118 s.Force = &v
119 return s
120 }
121
122 func (s *PurgeCachesRequest) SetSiteId(v int64) *PurgeCachesRequest {
123 s.SiteId = &v
124 return s
125 }
126
127 func (s *PurgeCachesRequest) SetType(v string) *PurgeCachesRequest {
128 s.Type = &v
129 return s
130 }
131
132 func (s *PurgeCachesRequest) Validate() error {
133 if s.Content != nil {
134 if err := s.Content.Validate(); err != nil {
135 return err
136 }
137 }
138 return nil
139 }
140
141 type PurgeCachesRequestContent struct {
142 // List of cachekeys to be refreshed, required when the type is cachekey.
143 CacheKeys []*PurgeCachesRequestContentCacheKeys `json:"CacheKeys,omitempty" xml:"CacheKeys,omitempty" type:"Repeated"`
144 // List of cachetags to be refreshed, required when the type is cachetag.
145 CacheTags []*string `json:"CacheTags,omitempty" xml:"CacheTags,omitempty" type:"Repeated"`
146 // List of directories to be refreshed, required when the type is directory.
147 Directories []*string `json:"Directories,omitempty" xml:"Directories,omitempty" type:"Repeated"`
148 // List of files to be refreshed, required when the type is file.
149 Files []interface{} `json:"Files,omitempty" xml:"Files,omitempty" type:"Repeated"`
150 // List of hostnames to be refreshed, required when the type is hostname.
151 Hostnames []*string `json:"Hostnames,omitempty" xml:"Hostnames,omitempty" type:"Repeated"`
152 // List of files with ignored parameters, required when the type is ignoreParams.
153 IgnoreParams []*string `json:"IgnoreParams,omitempty" xml:"IgnoreParams,omitempty" type:"Repeated"`
154 // Flag for purging all content. Default is false, set to true when the type is purgeall.
155 //
156 // example:
157 //
158 // true
159 PurgeAll *bool `json:"PurgeAll,omitempty" xml:"PurgeAll,omitempty"`
160 }
161
162 func (s PurgeCachesRequestContent) String() string {
163 return dara.Prettify(s)
164 }
165
166 func (s PurgeCachesRequestContent) GoString() string {
167 return s.String()
168 }
169
170 func (s *PurgeCachesRequestContent) GetCacheKeys() []*PurgeCachesRequestContentCacheKeys {
171 return s.CacheKeys
172 }
173
174 func (s *PurgeCachesRequestContent) GetCacheTags() []*string {
175 return s.CacheTags
176 }
177
178 func (s *PurgeCachesRequestContent) GetDirectories() []*string {
179 return s.Directories
180 }
181
182 func (s *PurgeCachesRequestContent) GetFiles() []interface{} {
183 return s.Files
184 }
185
186 func (s *PurgeCachesRequestContent) GetHostnames() []*string {
187 return s.Hostnames
188 }
189
190 func (s *PurgeCachesRequestContent) GetIgnoreParams() []*string {
191 return s.IgnoreParams
192 }
193
194 func (s *PurgeCachesRequestContent) GetPurgeAll() *bool {
195 return s.PurgeAll
196 }
197
198 func (s *PurgeCachesRequestContent) SetCacheKeys(v []*PurgeCachesRequestContentCacheKeys) *PurgeCachesRequestContent {
199 s.CacheKeys = v
200 return s
201 }
202
203 func (s *PurgeCachesRequestContent) SetCacheTags(v []*string) *PurgeCachesRequestContent {
204 s.CacheTags = v
205 return s
206 }
207
208 func (s *PurgeCachesRequestContent) SetDirectories(v []*string) *PurgeCachesRequestContent {
209 s.Directories = v
210 return s
211 }
212
213 func (s *PurgeCachesRequestContent) SetFiles(v []interface{}) *PurgeCachesRequestContent {
214 s.Files = v
215 return s
216 }
217
218 func (s *PurgeCachesRequestContent) SetHostnames(v []*string) *PurgeCachesRequestContent {
219 s.Hostnames = v
220 return s
221 }
222
223 func (s *PurgeCachesRequestContent) SetIgnoreParams(v []*string) *PurgeCachesRequestContent {
224 s.IgnoreParams = v
225 return s
226 }
227
228 func (s *PurgeCachesRequestContent) SetPurgeAll(v bool) *PurgeCachesRequestContent {
229 s.PurgeAll = &v
230 return s
231 }
232
233 func (s *PurgeCachesRequestContent) Validate() error {
234 if s.CacheKeys != nil {
235 for _, item := range s.CacheKeys {
236 if item != nil {
237 if err := item.Validate(); err != nil {
238 return err
239 }
240 }
241 }
242 }
243 return nil
244 }
245
246 type PurgeCachesRequestContentCacheKeys struct {
247 // When refreshing, specify the header information corresponding to the cache key. When the custom cache key feature switch is enabled, the cache key will be generated based on the specified header for refreshing.
248 //
249 // **UserGeo: Country/Region**
250 //
251 // - Country/region codes follow the ISO 3166-2 standard.
252 //
253 // **UserDeviceType: Device Type, currently there are three enum values**
254 //
255 // - desktop
256 //
257 // - tablet
258 //
259 // - mobile
260 //
261 // **UserLanguage: Language**
262 //
263 // - Language codes follow the ISO 639-1 or BCP47 standards. For example, input \\"zh\\" to refresh content in Chinese.
264 Headers map[string]*string `json:"Headers,omitempty" xml:"Headers,omitempty"`
265 // URL address to be refreshed.
266 //
267 // example:
268 //
269 // http://a.com/1.jpg?b=1
270 Url *string `json:"Url,omitempty" xml:"Url,omitempty"`
271 }
272
273 func (s PurgeCachesRequestContentCacheKeys) String() string {
274 return dara.Prettify(s)
275 }
276
277 func (s PurgeCachesRequestContentCacheKeys) GoString() string {
278 return s.String()
279 }
280
281 func (s *PurgeCachesRequestContentCacheKeys) GetHeaders() map[string]*string {
282 return s.Headers
283 }
284
285 func (s *PurgeCachesRequestContentCacheKeys) GetUrl() *string {
286 return s.Url
287 }
288
289 func (s *PurgeCachesRequestContentCacheKeys) SetHeaders(v map[string]*string) *PurgeCachesRequestContentCacheKeys {
290 s.Headers = v
291 return s
292 }
293
294 func (s *PurgeCachesRequestContentCacheKeys) SetUrl(v string) *PurgeCachesRequestContentCacheKeys {
295 s.Url = &v
296 return s
297 }
298
299 func (s *PurgeCachesRequestContentCacheKeys) Validate() error {
300 return dara.Validate(s)
301 }
302