Skip to content

Commit 9c7b6a8

Browse files
authored
fix(waf): [121984203] Update WAF resource query logic (#3141)
* add * add
1 parent 1a6be80 commit 9c7b6a8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.changelog/3141.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/waf: Update WAF resource query logic
3+
```

tencentcloud/services/waf/service_tencentcloud_waf.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (me *WafService) DescribeWafCustomRuleById(ctx context.Context, domain, rul
2929
request.Limit = common.Uint64Ptr(20)
3030
request.Filters = []*waf.FiltersItemNew{
3131
{
32-
Name: common.StringPtr("RuleID"),
32+
Name: common.StringPtr("RuleId"),
3333
Values: common.StringPtrs([]string{ruleId}),
3434
ExactMatch: common.BoolPtr(true),
3535
},
@@ -94,7 +94,7 @@ func (me *WafService) DescribeWafCustomWhiteRuleById(ctx context.Context, domain
9494
request.Limit = common.Uint64Ptr(20)
9595
request.Filters = []*waf.FiltersItemNew{
9696
{
97-
Name: common.StringPtr("RuleID"),
97+
Name: common.StringPtr("RuleId"),
9898
Values: common.StringPtrs([]string{ruleId}),
9999
ExactMatch: common.BoolPtr(true),
100100
},
@@ -886,7 +886,7 @@ func (me *WafService) DescribeWafAntiFakeById(ctx context.Context, id, domain st
886886
request.Limit = common.Uint64Ptr(10)
887887
request.Filters = []*waf.FiltersItemNew{
888888
{
889-
Name: common.StringPtr("RuleID"),
889+
Name: common.StringPtr("RuleId"),
890890
Values: common.StringPtrs([]string{id}),
891891
ExactMatch: common.BoolPtr(true),
892892
},
@@ -948,6 +948,15 @@ func (me *WafService) DescribeWafAntiInfoLeakById(ctx context.Context, ruleId, d
948948

949949
request := waf.NewDescribeAntiInfoLeakageRulesRequest()
950950
request.Domain = &domain
951+
request.Limit = common.Uint64Ptr(10)
952+
request.Offset = common.Uint64Ptr(0)
953+
request.Filters = []*waf.FiltersItemNew{
954+
{
955+
Name: common.StringPtr("RuleId"),
956+
Values: common.StringPtrs([]string{ruleId}),
957+
ExactMatch: common.BoolPtr(true),
958+
},
959+
}
951960

952961
defer func() {
953962
if errRet != nil {
@@ -969,14 +978,7 @@ func (me *WafService) DescribeWafAntiInfoLeakById(ctx context.Context, ruleId, d
969978
return
970979
}
971980

972-
ruleIdInt, _ := strconv.ParseUint(ruleId, 10, 64)
973-
for _, item := range response.Response.RuleList {
974-
if *item.RuleId == ruleIdInt {
975-
antiInfoLeak = item
976-
break
977-
}
978-
}
979-
981+
antiInfoLeak = response.Response.RuleList[0]
980982
return
981983
}
982984

@@ -1189,7 +1191,7 @@ func (me *WafService) DescribeWafCcById(ctx context.Context, domain, ruleId stri
11891191
request.Domain = &domain
11901192
request.Filters = []*waf.FiltersItemNew{
11911193
{
1192-
Name: common.StringPtr("RuleID"),
1194+
Name: common.StringPtr("RuleId"),
11931195
Values: common.StringPtrs([]string{ruleId}),
11941196
ExactMatch: common.BoolPtr(true),
11951197
},

0 commit comments

Comments
 (0)