1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

update cloudns to support request from subuser (sub-auth-id) (#993)

* update cloudns to support request from subuser (sub-auth-id)
* formats Go source code with Gofmt

Co-authored-by: bjad <jamal@pfalzcloud.de>
This commit is contained in:
taybinakh
2020-12-08 16:54:11 +01:00
committed by GitHub
parent 99ae7b4418
commit 148d85eeb6
2 changed files with 5 additions and 5 deletions

View File

@ -15,6 +15,7 @@ type cloudnsProvider struct {
creds struct { creds struct {
id string id string
password string password string
subid string
} }
} }
@ -195,6 +196,7 @@ func (c *cloudnsProvider) get(endpoint string, params requestParams) ([]byte, er
// Add auth params // Add auth params
q.Add("auth-id", c.creds.id) q.Add("auth-id", c.creds.id)
q.Add("auth-password", c.creds.password) q.Add("auth-password", c.creds.password)
q.Add("sub-auth-id", c.creds.subid)
for pName, pValue := range params { for pName, pValue := range params {
q.Add(pName, pValue) q.Add(pName, pValue)

View File

@ -13,21 +13,19 @@ import (
) )
/* /*
CloDNS API DNS provider: CloDNS API DNS provider:
Info required in `creds.json`: Info required in `creds.json`:
- auth-id - auth-id
- auth-password - auth-password
*/ */
// NewCloudns creates the provider. // NewCloudns creates the provider.
func NewCloudns(m map[string]string, metadata json.RawMessage) (providers.DNSServiceProvider, error) { func NewCloudns(m map[string]string, metadata json.RawMessage) (providers.DNSServiceProvider, error) {
c := &cloudnsProvider{} c := &cloudnsProvider{}
c.creds.id, c.creds.password = m["auth-id"], m["auth-password"] c.creds.id, c.creds.password, c.creds.subid = m["auth-id"], m["auth-password"], m["sub-auth-id"]
if c.creds.id == "" || c.creds.password == "" {
if (c.creds.id == "" && c.creds.subid == "") || c.creds.password == "" {
return nil, fmt.Errorf("missing ClouDNS auth-id and auth-password") return nil, fmt.Errorf("missing ClouDNS auth-id and auth-password")
} }