From 9be7f61b8cb74a54d45ab1108cb60b4c8baab462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 7 May 2022 21:00:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=BF=E9=87=8C=E4=BA=91DNS=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8C=BA=E5=9F=9FID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dnsclients/provider_alidns.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/dnsclients/provider_alidns.go b/internal/dnsclients/provider_alidns.go index a85916be..18d96929 100644 --- a/internal/dnsclients/provider_alidns.go +++ b/internal/dnsclients/provider_alidns.go @@ -17,18 +17,26 @@ type AliDNSProvider struct { accessKeyId string accessKeySecret string + regionId string } // Auth 认证 func (this *AliDNSProvider) Auth(params maps.Map) error { this.accessKeyId = params.GetString("accessKeyId") this.accessKeySecret = params.GetString("accessKeySecret") + this.regionId = params.GetString("regionId") + if len(this.accessKeyId) == 0 { return errors.New("'accessKeyId' should not be empty") } if len(this.accessKeySecret) == 0 { return errors.New("'accessKeySecret' should not be empty") } + + if len(this.regionId) == 0 { + this.regionId = "cn-hangzhou" + } + return nil } @@ -196,7 +204,7 @@ func (this *AliDNSProvider) DefaultRoute() string { func (this *AliDNSProvider) doAPI(req requests.AcsRequest, resp responses.AcsResponse) error { req.SetScheme("https") - client, err := alidns.NewClientWithAccessKey("cn-hangzhou", this.accessKeyId, this.accessKeySecret) + client, err := alidns.NewClientWithAccessKey(this.regionId, this.accessKeyId, this.accessKeySecret) if err != nil { return err }