mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 18:08:57 +08:00
20 lines
427 B
Go
20 lines
427 B
Go
|
package powerdns
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// ListZones returns all the zones in an account
|
||
|
func (dsp *powerdnsProvider) ListZones() ([]string, error) {
|
||
|
var result []string
|
||
|
myZones, err := dsp.client.Zones().ListZones(context.Background(), dsp.ServerName)
|
||
|
if err != nil {
|
||
|
return result, err
|
||
|
}
|
||
|
for _, zone := range myZones {
|
||
|
result = append(result, strings.TrimSuffix(zone.Name, "."))
|
||
|
}
|
||
|
return result, nil
|
||
|
}
|