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:
29
providers/namedotcom/zones.go
Normal file
29
providers/namedotcom/zones.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user