可以设置集群的DNS记录TTL

This commit is contained in:
GoEdgeLab
2021-09-20 20:01:21 +08:00
parent d1351f63d6
commit c0dc9da023
14 changed files with 113 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/aliyun/alibaba-cloud-sdk-go/services/alidns"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
"strings"
)
@@ -87,6 +88,7 @@ func (this *AliDNSProvider) GetRecords(domain string) (records []*dnstypes.Recor
Type: record.Type,
Value: record.Value,
Route: record.Line,
TTL: types.Int32(record.TTL),
})
}
@@ -141,6 +143,10 @@ func (this *AliDNSProvider) AddRecord(domain string, newRecord *dnstypes.Record)
req.DomainName = domain
req.Line = newRecord.Route
if newRecord.TTL > 0 {
req.TTL = requests.NewInteger(types.Int(newRecord.TTL))
}
resp := alidns.CreateAddDomainRecordResponse()
err := this.doAPI(req, resp)
if err != nil {
@@ -162,6 +168,10 @@ func (this *AliDNSProvider) UpdateRecord(domain string, record *dnstypes.Record,
req.Value = newRecord.Value
req.Line = newRecord.Route
if newRecord.TTL > 0 {
req.TTL = requests.NewInteger(types.Int(newRecord.TTL))
}
resp := alidns.CreateUpdateDomainRecordResponse()
err := this.doAPI(req, resp)
return err