Skip to content

Commit 99e9093

Browse files
committed
add
1 parent 7510103 commit 99e9093

File tree

7 files changed

+294
-5
lines changed

7 files changed

+294
-5
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ require (
4545
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.860
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
48-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.955
48+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
5252
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860 h1:IU20AhN
862862
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860/go.mod h1:RP3NkBvKio1dFmCNKozHX9qmef57sUCfsTcE0FnCvjk=
863863
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952 h1:+4g+Wp3WKTf/QU814lF+kft4jP/NNUkggciB/n0joTM=
864864
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952/go.mod h1:OW+FNkQgeQTesREQ7iPA4g9V81cEb/NcWSYO6bYe2Qo=
865+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962 h1:rkceP3tcjU0BCh9xloqZ5cuzDXP327YlQgWHXEaVgns=
866+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962/go.mod h1:OEg00w6fKlT/3Q/4UI13P5kEJU2IvZm3XMZGUYEKPPs=
865867
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.414/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
866868
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
867869
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.524/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
@@ -942,6 +944,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.952 h1:fqO7
942944
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.952/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
943945
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.955 h1:kr5Kx0zMcPkO9f/ao0xhk0f6V8TxziFGo+AGa5BW5QY=
944946
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.955/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
947+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962 h1:H7V/7lpplT3r5zW5/W+agrsJC8MCA1/f6zWWrMZYykU=
948+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
945949
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
946950
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY=
947951
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 h1:nEZqsoqt1pEoaP9JjkHQy3/H00suCfzlHW1qOm2nYD8=

tencentcloud/services/cls/resource_tc_cls_topic.go

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,63 @@ func ResourceTencentCloudClsTopic() *schema.Resource {
8282
Optional: true,
8383
Description: "Log Topic Description.",
8484
},
85+
"is_web_tracking": {
86+
Type: schema.TypeBool,
87+
Optional: true,
88+
Computed: true,
89+
Description: "No authentication switch. False: closed; True: Enable. The default is false. After activation, anonymous access to the log topic will be supported for specified operations.",
90+
},
91+
"extends": {
92+
Type: schema.TypeList,
93+
Optional: true,
94+
Computed: true,
95+
MaxItems: 1,
96+
Description: "Log Subject Extension Information.",
97+
Elem: &schema.Resource{
98+
Schema: map[string]*schema.Schema{
99+
"anonymous_access": {
100+
Type: schema.TypeList,
101+
Optional: true,
102+
MaxItems: 1,
103+
Description: "Log topic authentication free configuration information.",
104+
Elem: &schema.Resource{
105+
Schema: map[string]*schema.Schema{
106+
"operations": {
107+
Type: schema.TypeList,
108+
Optional: true,
109+
Description: "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log).",
110+
Elem: &schema.Schema{Type: schema.TypeString},
111+
},
112+
"conditions": {
113+
Type: schema.TypeList,
114+
Optional: true,
115+
Description: "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log).",
116+
Elem: &schema.Resource{
117+
Schema: map[string]*schema.Schema{
118+
"attributes": {
119+
Type: schema.TypeString,
120+
Optional: true,
121+
Description: "Condition attribute, currently only VpcID is supported.",
122+
},
123+
"rule": {
124+
Type: schema.TypeInt,
125+
Optional: true,
126+
Description: "Conditional rule, 1: equal, 2: not equal.",
127+
},
128+
"condition_value": {
129+
Type: schema.TypeString,
130+
Optional: true,
131+
Description: "The value of the corresponding conditional attribute.",
132+
},
133+
},
134+
},
135+
},
136+
},
137+
},
138+
},
139+
},
140+
},
141+
},
85142
},
86143
}
87144
}
@@ -144,6 +201,49 @@ func resourceTencentCloudClsTopicCreate(d *schema.ResourceData, meta interface{}
144201
request.Describes = helper.String("")
145202
}
146203

204+
if v, ok := d.GetOkExists("is_web_tracking"); ok {
205+
request.IsWebTracking = helper.Bool(v.(bool))
206+
}
207+
208+
if dMap, ok := helper.InterfacesHeadMap(d, "extends"); ok {
209+
topicExtendInfo := cls.TopicExtendInfo{}
210+
if anonymousAccessMap, ok := helper.InterfaceToMap(dMap, "anonymous_access"); ok {
211+
anonymousInfo := cls.AnonymousInfo{}
212+
if v, ok := anonymousAccessMap["operations"]; ok {
213+
tmpList := make([]*string, 0)
214+
for _, operation := range v.([]interface{}) {
215+
tmpList = append(tmpList, helper.String(operation.(string)))
216+
}
217+
218+
anonymousInfo.Operations = tmpList
219+
}
220+
221+
if v, ok := anonymousAccessMap["conditions"]; ok {
222+
for _, condition := range v.([]interface{}) {
223+
conditionMap := condition.(map[string]interface{})
224+
conditionInfo := cls.ConditionInfo{}
225+
if v, ok := conditionMap["attributes"]; ok {
226+
conditionInfo.Attributes = helper.String(v.(string))
227+
}
228+
229+
if v, ok := conditionMap["rule"]; ok {
230+
conditionInfo.Rule = helper.IntUint64(v.(int))
231+
}
232+
233+
if v, ok := conditionMap["condition_value"]; ok {
234+
conditionInfo.ConditionValue = helper.String(v.(string))
235+
}
236+
237+
anonymousInfo.Conditions = append(anonymousInfo.Conditions, &conditionInfo)
238+
}
239+
}
240+
241+
topicExtendInfo.AnonymousAccess = &anonymousInfo
242+
}
243+
244+
request.Extends = &topicExtendInfo
245+
}
246+
147247
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
148248
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClsClient().CreateTopic(request)
149249
if e != nil {
@@ -209,6 +309,48 @@ func resourceTencentCloudClsTopicRead(d *schema.ResourceData, meta interface{})
209309
_ = d.Set("period", topic.Period)
210310
_ = d.Set("hot_period", topic.HotPeriod)
211311
_ = d.Set("describes", topic.Describes)
312+
_ = d.Set("is_web_tracking", topic.IsWebTracking)
313+
314+
if topic.Extends != nil {
315+
extendMap := map[string]interface{}{}
316+
if topic.Extends.AnonymousAccess != nil {
317+
anonymousAccessMap := map[string]interface{}{}
318+
if topic.Extends.AnonymousAccess.Operations != nil {
319+
operationList := make([]string, 0, len(topic.Extends.AnonymousAccess.Operations))
320+
for _, v := range topic.Extends.AnonymousAccess.Operations {
321+
operationList = append(operationList, *v)
322+
}
323+
324+
anonymousAccessMap["operations"] = operationList
325+
}
326+
327+
if topic.Extends.AnonymousAccess.Conditions != nil {
328+
conditionList := []interface{}{}
329+
for _, v := range topic.Extends.AnonymousAccess.Conditions {
330+
conditionMap := map[string]interface{}{}
331+
if v.Attributes != nil {
332+
conditionMap["attributes"] = *v.Attributes
333+
}
334+
335+
if v.Rule != nil {
336+
conditionMap["rule"] = *v.Rule
337+
}
338+
339+
if v.ConditionValue != nil {
340+
conditionMap["condition_value"] = *v.ConditionValue
341+
}
342+
343+
conditionList = append(conditionList, conditionMap)
344+
}
345+
346+
anonymousAccessMap["conditions"] = conditionList
347+
}
348+
349+
extendMap["anonymous_access"] = []interface{}{anonymousAccessMap}
350+
}
351+
352+
_ = d.Set("extends", []interface{}{extendMap})
353+
}
212354

213355
return nil
214356
}
@@ -269,6 +411,53 @@ func resourceTencentCloudClsTopicUpdate(d *schema.ResourceData, meta interface{}
269411
request.Describes = helper.String(d.Get("describes").(string))
270412
}
271413

414+
if d.HasChange("is_web_tracking") {
415+
if v, ok := d.GetOkExists("is_web_tracking"); ok {
416+
request.IsWebTracking = helper.Bool(v.(bool))
417+
}
418+
}
419+
420+
if d.HasChange("extends") {
421+
if dMap, ok := helper.InterfacesHeadMap(d, "extends"); ok {
422+
topicExtendInfo := cls.TopicExtendInfo{}
423+
if anonymousAccessMap, ok := helper.InterfaceToMap(dMap, "anonymous_access"); ok {
424+
anonymousInfo := cls.AnonymousInfo{}
425+
if v, ok := anonymousAccessMap["operations"]; ok {
426+
tmpList := make([]*string, 0)
427+
for _, operation := range v.([]interface{}) {
428+
tmpList = append(tmpList, helper.String(operation.(string)))
429+
}
430+
431+
anonymousInfo.Operations = tmpList
432+
}
433+
434+
if v, ok := anonymousAccessMap["conditions"]; ok {
435+
for _, condition := range v.([]interface{}) {
436+
conditionMap := condition.(map[string]interface{})
437+
conditionInfo := cls.ConditionInfo{}
438+
if v, ok := conditionMap["attributes"]; ok {
439+
conditionInfo.Attributes = helper.String(v.(string))
440+
}
441+
442+
if v, ok := conditionMap["rule"]; ok {
443+
conditionInfo.Rule = helper.IntUint64(v.(int))
444+
}
445+
446+
if v, ok := conditionMap["condition_value"]; ok {
447+
conditionInfo.ConditionValue = helper.String(v.(string))
448+
}
449+
450+
anonymousInfo.Conditions = append(anonymousInfo.Conditions, &conditionInfo)
451+
}
452+
}
453+
454+
topicExtendInfo.AnonymousAccess = &anonymousInfo
455+
}
456+
457+
request.Extends = &topicExtendInfo
458+
}
459+
}
460+
272461
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
273462
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClsClient().ModifyTopic(request)
274463
if e != nil {

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016/models.go

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317
11541154
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
11551155
## explicit; go 1.14
11561156
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319
1157-
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952
1157+
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962
11581158
## explicit; go 1.14
11591159
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016
1160-
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.955
1160+
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962
11611161
## explicit; go 1.11
11621162
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common
11631163
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors

0 commit comments

Comments
 (0)