dnscontrol/providers/powerdns/listzones.go
Jan-Philipp Benecke e5de7b5359
MAINT: Restructuring of the PowerDNS DSP based on the layout of CSCGlobal (#1549)
* Restructure PowerDNS DSP based on layout for CSCGlobal

Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>

* Rename api to dsp and make initializer function private

Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2022-06-20 12:27:05 -04:00

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
}