mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-04-19 07:05:17 +08:00
阿里云DNS增加区域ID
This commit is contained in:
@@ -17,18 +17,26 @@ type AliDNSProvider struct {
|
|||||||
|
|
||||||
accessKeyId string
|
accessKeyId string
|
||||||
accessKeySecret string
|
accessKeySecret string
|
||||||
|
regionId string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auth 认证
|
// Auth 认证
|
||||||
func (this *AliDNSProvider) Auth(params maps.Map) error {
|
func (this *AliDNSProvider) Auth(params maps.Map) error {
|
||||||
this.accessKeyId = params.GetString("accessKeyId")
|
this.accessKeyId = params.GetString("accessKeyId")
|
||||||
this.accessKeySecret = params.GetString("accessKeySecret")
|
this.accessKeySecret = params.GetString("accessKeySecret")
|
||||||
|
this.regionId = params.GetString("regionId")
|
||||||
|
|
||||||
if len(this.accessKeyId) == 0 {
|
if len(this.accessKeyId) == 0 {
|
||||||
return errors.New("'accessKeyId' should not be empty")
|
return errors.New("'accessKeyId' should not be empty")
|
||||||
}
|
}
|
||||||
if len(this.accessKeySecret) == 0 {
|
if len(this.accessKeySecret) == 0 {
|
||||||
return errors.New("'accessKeySecret' should not be empty")
|
return errors.New("'accessKeySecret' should not be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(this.regionId) == 0 {
|
||||||
|
this.regionId = "cn-hangzhou"
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +204,7 @@ func (this *AliDNSProvider) DefaultRoute() string {
|
|||||||
func (this *AliDNSProvider) doAPI(req requests.AcsRequest, resp responses.AcsResponse) error {
|
func (this *AliDNSProvider) doAPI(req requests.AcsRequest, resp responses.AcsResponse) error {
|
||||||
req.SetScheme("https")
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user