@@ -8,10 +8,10 @@ import (
88 "time"
99
1010 "github.com/libdns/libdns"
11-
1211 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
1312 tp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
14- dnspod "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod/v20210323"
13+
14+ "github.com/libdns/tencentcloud/dnspod"
1515)
1616
1717// getClient gets the client for Tencent Cloud DNS
@@ -38,15 +38,16 @@ func (p *Provider) describeRecordList(ctx context.Context, zone string) ([]libdn
3838 if err != nil {
3939 return nil , err
4040 }
41- list := []libdns.Record {}
41+
42+ var list []libdns.Record
4243 request := dnspod .NewDescribeRecordListRequest ()
4344 request .Domain = common .StringPtr (strings .Trim (zone , "." ))
4445 request .Offset = common .Uint64Ptr (0 )
4546 request .Limit = common .Uint64Ptr (3000 )
4647
4748 totalCount := uint64 (100 )
4849 for * request .Offset < totalCount {
49- response , err := client .DescribeRecordList ( request )
50+ response , err := client .DescribeRecordListWithContext ( ctx , request )
5051 if err != nil {
5152 return nil , err
5253 }
@@ -73,13 +74,15 @@ func (p *Provider) createRecord(ctx context.Context, zone string, record libdns.
7374 if err != nil {
7475 return "" , err
7576 }
77+
7678 request := dnspod .NewCreateRecordRequest ()
7779 request .Domain = common .StringPtr (strings .Trim (zone , "." ))
7880 request .SubDomain = common .StringPtr (record .Name )
7981 request .RecordType = common .StringPtr (record .Type )
8082 request .RecordLine = common .StringPtr ("默认" )
8183 request .Value = common .StringPtr (record .Value )
82- response , err := client .CreateRecord (request )
84+ response , err := client .CreateRecordWithContext (ctx , request )
85+
8386 if err != nil {
8487 return "" , err
8588 }
@@ -92,6 +95,7 @@ func (p *Provider) modifyRecord(ctx context.Context, zone string, record libdns.
9295 if err != nil {
9396 return err
9497 }
98+
9599 recordId , _ := strconv .Atoi (record .ID )
96100 request := dnspod .NewModifyRecordRequest ()
97101 request .Domain = common .StringPtr (strings .Trim (zone , "." ))
@@ -101,7 +105,7 @@ func (p *Provider) modifyRecord(ctx context.Context, zone string, record libdns.
101105 request .Value = common .StringPtr (record .Value )
102106 request .RecordId = common .Uint64Ptr (uint64 (recordId ))
103107
104- _ , err = client .ModifyRecord ( request )
108+ _ , err = client .ModifyRecordWithContext ( ctx , request )
105109 if err != nil {
106110 return err
107111 }
@@ -114,12 +118,13 @@ func (p *Provider) deleteRecord(ctx context.Context, zone string, record libdns.
114118 if err != nil {
115119 return err
116120 }
121+
117122 recordId , _ := strconv .Atoi (record .ID )
118123 request := dnspod .NewDeleteRecordRequest ()
119124 request .Domain = common .StringPtr (strings .Trim (zone , "." ))
120125 request .RecordId = common .Uint64Ptr (uint64 (recordId ))
121126
122- _ , err = client .DeleteRecord ( request )
127+ _ , err = client .DeleteRecordWithContext ( ctx , request )
123128 if err != nil {
124129 return err
125130 }
0 commit comments