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

NAMEDOTCOM: Implement get-zones (#645)

* NAMEDOTCOM: Implement get-zones
This commit is contained in:
Tom Limoncelli
2020-02-21 15:03:27 -05:00
committed by GitHub
parent 3c507d6b77
commit b360ddd1e9
3 changed files with 44 additions and 11 deletions

View File

@@ -0,0 +1,29 @@
package namedotcom
import (
"github.com/namedotcom/go/namecom"
)
// ListZones returns all the zones in an account
func (c *NameCom) ListZones() ([]string, error) {
var names []string
var page int32
for true {
n, err := c.client.ListDomains(&namecom.ListDomainsRequest{Page: page})
if err != nil {
return nil, err
}
page = n.NextPage
for _, j := range n.Domains {
names = append(names, j.DomainName)
}
if page == 0 {
break
}
}
return names, nil
}