From 148d85eeb62f9646a62a8b51efcab34854e84924 Mon Sep 17 00:00:00 2001 From: taybinakh <51935048+jamaltebi@users.noreply.github.com> Date: Tue, 8 Dec 2020 16:54:11 +0100 Subject: [PATCH] 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 --- providers/cloudns/api.go | 2 ++ providers/cloudns/cloudnsProvider.go | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/providers/cloudns/api.go b/providers/cloudns/api.go index d1d3c0810..30d907cf6 100644 --- a/providers/cloudns/api.go +++ b/providers/cloudns/api.go @@ -15,6 +15,7 @@ type cloudnsProvider struct { creds struct { id string password string + subid string } } @@ -195,6 +196,7 @@ func (c *cloudnsProvider) get(endpoint string, params requestParams) ([]byte, er // Add auth params q.Add("auth-id", c.creds.id) q.Add("auth-password", c.creds.password) + q.Add("sub-auth-id", c.creds.subid) for pName, pValue := range params { q.Add(pName, pValue) diff --git a/providers/cloudns/cloudnsProvider.go b/providers/cloudns/cloudnsProvider.go index ca198471c..ef36ccf04 100644 --- a/providers/cloudns/cloudnsProvider.go +++ b/providers/cloudns/cloudnsProvider.go @@ -13,21 +13,19 @@ import ( ) /* - CloDNS API DNS provider: - Info required in `creds.json`: - auth-id - auth-password - */ // NewCloudns creates the provider. func NewCloudns(m map[string]string, metadata json.RawMessage) (providers.DNSServiceProvider, error) { c := &cloudnsProvider{} - c.creds.id, c.creds.password = m["auth-id"], m["auth-password"] - if c.creds.id == "" || c.creds.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.subid == "") || c.creds.password == "" { return nil, fmt.Errorf("missing ClouDNS auth-id and auth-password") }