2020-02-22 04:03:27 +08:00
|
|
|
package namedotcom
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/namedotcom/go/namecom"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ListZones returns all the zones in an account
|
2022-02-12 03:30:45 +08:00
|
|
|
func (n *namedotcomProvider) ListZones() ([]string, error) {
|
2020-02-22 04:03:27 +08:00
|
|
|
var names []string
|
|
|
|
var page int32
|
|
|
|
|
2020-08-31 08:38:08 +08:00
|
|
|
for {
|
2022-02-12 03:30:45 +08:00
|
|
|
response, err := n.client.ListDomains(&namecom.ListDomainsRequest{Page: page})
|
2020-02-22 04:03:27 +08:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2022-02-12 03:30:45 +08:00
|
|
|
page = response.NextPage
|
2020-02-22 04:03:27 +08:00
|
|
|
|
2022-02-12 03:30:45 +08:00
|
|
|
for _, j := range response.Domains {
|
2020-02-22 04:03:27 +08:00
|
|
|
names = append(names, j.DomainName)
|
|
|
|
}
|
|
|
|
|
|
|
|
if page == 0 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return names, nil
|
|
|
|
}
|