@@ -8,10 +8,10 @@ import (
8
8
"time"
9
9
10
10
"github.com/libdns/libdns"
11
-
12
11
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
13
12
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"
15
15
)
16
16
17
17
// getClient gets the client for Tencent Cloud DNS
@@ -38,15 +38,16 @@ func (p *Provider) describeRecordList(ctx context.Context, zone string) ([]libdn
38
38
if err != nil {
39
39
return nil , err
40
40
}
41
- list := []libdns.Record {}
41
+
42
+ var list []libdns.Record
42
43
request := dnspod .NewDescribeRecordListRequest ()
43
44
request .Domain = common .StringPtr (strings .Trim (zone , "." ))
44
45
request .Offset = common .Uint64Ptr (0 )
45
46
request .Limit = common .Uint64Ptr (3000 )
46
47
47
48
totalCount := uint64 (100 )
48
49
for * request .Offset < totalCount {
49
- response , err := client .DescribeRecordList ( request )
50
+ response , err := client .DescribeRecordListWithContext ( ctx , request )
50
51
if err != nil {
51
52
return nil , err
52
53
}
@@ -73,13 +74,15 @@ func (p *Provider) createRecord(ctx context.Context, zone string, record libdns.
73
74
if err != nil {
74
75
return "" , err
75
76
}
77
+
76
78
request := dnspod .NewCreateRecordRequest ()
77
79
request .Domain = common .StringPtr (strings .Trim (zone , "." ))
78
80
request .SubDomain = common .StringPtr (record .Name )
79
81
request .RecordType = common .StringPtr (record .Type )
80
82
request .RecordLine = common .StringPtr ("默认" )
81
83
request .Value = common .StringPtr (record .Value )
82
- response , err := client .CreateRecord (request )
84
+ response , err := client .CreateRecordWithContext (ctx , request )
85
+
83
86
if err != nil {
84
87
return "" , err
85
88
}
@@ -92,6 +95,7 @@ func (p *Provider) modifyRecord(ctx context.Context, zone string, record libdns.
92
95
if err != nil {
93
96
return err
94
97
}
98
+
95
99
recordId , _ := strconv .Atoi (record .ID )
96
100
request := dnspod .NewModifyRecordRequest ()
97
101
request .Domain = common .StringPtr (strings .Trim (zone , "." ))
@@ -101,7 +105,7 @@ func (p *Provider) modifyRecord(ctx context.Context, zone string, record libdns.
101
105
request .Value = common .StringPtr (record .Value )
102
106
request .RecordId = common .Uint64Ptr (uint64 (recordId ))
103
107
104
- _ , err = client .ModifyRecord ( request )
108
+ _ , err = client .ModifyRecordWithContext ( ctx , request )
105
109
if err != nil {
106
110
return err
107
111
}
@@ -114,12 +118,13 @@ func (p *Provider) deleteRecord(ctx context.Context, zone string, record libdns.
114
118
if err != nil {
115
119
return err
116
120
}
121
+
117
122
recordId , _ := strconv .Atoi (record .ID )
118
123
request := dnspod .NewDeleteRecordRequest ()
119
124
request .Domain = common .StringPtr (strings .Trim (zone , "." ))
120
125
request .RecordId = common .Uint64Ptr (uint64 (recordId ))
121
126
122
- _ , err = client .DeleteRecord ( request )
127
+ _ , err = client .DeleteRecordWithContext ( ctx , request )
123
128
if err != nil {
124
129
return err
125
130
}
0 commit comments