@@ -117,6 +117,122 @@ func dataSourceTencentCloudCdnDomains() *schema.Resource {
117117 Computed : true ,
118118 Description : "Whether to enable full-path cache." ,
119119 },
120+ "range_origin_switch" : {
121+ Type : schema .TypeString ,
122+ Computed : true ,
123+ Description : "Sharding back to source configuration switch." ,
124+ },
125+ "request_header" : {
126+ Type : schema .TypeList ,
127+ Computed : true ,
128+ Description : "Request header configuration." ,
129+ Elem : & schema.Resource {
130+ Schema : map [string ]* schema.Schema {
131+ "switch" : {
132+ Type : schema .TypeString ,
133+ Computed : true ,
134+ Description : "Custom request header configuration switch." ,
135+ },
136+ "header_rules" : {
137+ Type : schema .TypeList ,
138+ Computed : true ,
139+ Description : "Custom request header configuration rules." ,
140+ Elem : & schema.Resource {
141+ Schema : map [string ]* schema.Schema {
142+ "header_mode" : {
143+ Type : schema .TypeString ,
144+ Computed : true ,
145+ Description : "Http header setting method." ,
146+ },
147+ "header_name" : {
148+ Type : schema .TypeString ,
149+ Computed : true ,
150+ Description : "Http header name." ,
151+ },
152+ "header_value" : {
153+ Type : schema .TypeString ,
154+ Computed : true ,
155+ Description : "Http header value." ,
156+ },
157+ "rule_type" : {
158+ Type : schema .TypeString ,
159+ Computed : true ,
160+ Description : "Rule type." ,
161+ },
162+ "rule_paths" : {
163+ Type : schema .TypeList ,
164+ Computed : true ,
165+ Elem : & schema.Schema {Type : schema .TypeString },
166+ Description : "Rule paths." ,
167+ },
168+ },
169+ },
170+ },
171+ },
172+ },
173+ },
174+ "rule_cache" : {
175+ Type : schema .TypeList ,
176+ Computed : true ,
177+ Description : "Advanced path cache configuration." ,
178+ Elem : & schema.Resource {
179+ Schema : map [string ]* schema.Schema {
180+ "rule_paths" : {
181+ Type : schema .TypeList ,
182+ Computed : true ,
183+ Elem : & schema.Schema {
184+ Type : schema .TypeString ,
185+ },
186+ Description : "Rule paths." ,
187+ },
188+ "rule_type" : {
189+ Type : schema .TypeString ,
190+ Computed : true ,
191+ Description : "Rule type." ,
192+ },
193+ "switch" : {
194+ Type : schema .TypeString ,
195+ Computed : true ,
196+ Description : "Cache configuration switch." ,
197+ },
198+ "cache_time" : {
199+ Type : schema .TypeInt ,
200+ Required : true ,
201+ Description : "Cache expiration time setting, the unit is second." ,
202+ },
203+ "compare_max_age" : {
204+ Type : schema .TypeString ,
205+ Optional : true ,
206+ Description : "Advanced cache expiration configuration." ,
207+ },
208+ "ignore_cache_control" : {
209+ Type : schema .TypeString ,
210+ Optional : true ,
211+ Description : "Force caching. After opening, the no-store and no-cache resources returned by the origin site will also be cached in accordance with the CacheRules rules." ,
212+ },
213+ "ignore_set_cookie" : {
214+ Type : schema .TypeString ,
215+ Computed : true ,
216+ Description : "Ignore the Set-Cookie header of the origin site." ,
217+ },
218+ "no_cache_switch" : {
219+ Type : schema .TypeString ,
220+ Computed : true ,
221+ Description : "Cache configuration switch." ,
222+ },
223+ "re_validate" : {
224+ Type : schema .TypeString ,
225+ Computed : true ,
226+ Description : "Always check back to origin." ,
227+ },
228+ "follow_origin_switch" : {
229+ Type : schema .TypeString ,
230+ Computed : true ,
231+ Description : "Follow the source station configuration switch." ,
232+ },
233+ },
234+ },
235+ },
120236 "origin" : {
121237 Type : schema .TypeList ,
122238 Computed : true ,
@@ -266,6 +382,41 @@ func dataSourceTencentCloudCdnDomainsRead(d *schema.ResourceData, meta interface
266382 fullUrlCache = true
267383 }
268384
385+ requestHeaders := make ([]map [string ]interface {}, 0 , 1 )
386+ requestHeader := make (map [string ]interface {})
387+ requestHeader ["switch" ] = detailDomain .RequestHeader .Switch
388+ if len (detailDomain .RequestHeader .HeaderRules ) > 0 {
389+ headerRules := make ([]map [string ]interface {}, len (detailDomain .RequestHeader .HeaderRules ))
390+ headerRuleList := detailDomain .RequestHeader .HeaderRules
391+ for index , value := range headerRuleList {
392+ headerRule := make (map [string ]interface {})
393+ headerRule ["header_mode" ] = value .HeaderMode
394+ headerRule ["header_name" ] = value .HeaderName
395+ headerRule ["header_value" ] = value .HeaderValue
396+ headerRule ["rule_type" ] = value .RuleType
397+ headerRule ["rule_paths" ] = value .RulePaths
398+ headerRules [index ] = headerRule
399+ }
400+ requestHeader ["header_rules" ] = headerRules
401+ }
402+ requestHeaders = append (requestHeaders , requestHeader )
403+
404+ ruleCaches := make ([]map [string ]interface {}, len (detailDomain .Cache .RuleCache ))
405+ for index , value := range detailDomain .Cache .RuleCache {
406+ ruleCache := make (map [string ]interface {})
407+ ruleCache ["rule_paths" ] = value .RulePaths
408+ ruleCache ["rule_type" ] = value .RuleType
409+ ruleCache ["switch" ] = value .CacheConfig .Cache .Switch
410+ ruleCache ["cache_time" ] = value .CacheConfig .Cache .CacheTime
411+ ruleCache ["compare_max_age" ] = value .CacheConfig .Cache .CompareMaxAge
412+ ruleCache ["ignore_cache_control" ] = value .CacheConfig .Cache .IgnoreCacheControl
413+ ruleCache ["ignore_set_cookie" ] = value .CacheConfig .Cache .IgnoreSetCookie
414+ ruleCache ["no_cache_switch" ] = value .CacheConfig .NoCache .Switch
415+ ruleCache ["re_validate" ] = value .CacheConfig .NoCache .Revalidate
416+ ruleCache ["follow_origin_switch" ] = value .CacheConfig .FollowOrigin .Switch
417+ ruleCaches [index ] = ruleCache
418+ }
419+
269420 origins := make ([]map [string ]interface {}, 0 , 1 )
270421 origin := make (map [string ]interface {}, 8 )
271422 origin ["origin_type" ] = detailDomain .Origin .OriginType
@@ -295,19 +446,22 @@ func dataSourceTencentCloudCdnDomainsRead(d *schema.ResourceData, meta interface
295446 }
296447
297448 mapping := map [string ]interface {}{
298- "id" : detailDomain .ResourceId ,
299- "domain" : detailDomain .Domain ,
300- "cname" : detailDomain .Cname ,
301- "status" : detailDomain .Status ,
302- "create_time" : detailDomain .CreateTime ,
303- "update_time" : detailDomain .UpdateTime ,
304- "service_type" : detailDomain .ServiceType ,
305- "area" : detailDomain .Area ,
306- "project_id" : detailDomain .ProjectId ,
307- "full_url_cache" : fullUrlCache ,
308- "origin" : origins ,
309- "https_config" : httpsconfigs ,
310- "tags" : tags ,
449+ "id" : detailDomain .ResourceId ,
450+ "domain" : detailDomain .Domain ,
451+ "cname" : detailDomain .Cname ,
452+ "status" : detailDomain .Status ,
453+ "create_time" : detailDomain .CreateTime ,
454+ "update_time" : detailDomain .UpdateTime ,
455+ "service_type" : detailDomain .ServiceType ,
456+ "area" : detailDomain .Area ,
457+ "project_id" : detailDomain .ProjectId ,
458+ "full_url_cache" : fullUrlCache ,
459+ "range_origin_switch" : detailDomain .RangeOriginPull .Switch ,
460+ "request_header" : requestHeaders ,
461+ "rule_cache" : ruleCaches ,
462+ "origin" : origins ,
463+ "https_config" : httpsconfigs ,
464+ "tags" : tags ,
311465 }
312466
313467 cdnDomainList = append (cdnDomainList , mapping )
0 commit comments