// findZoneID finds a zone id for the given dns record
findZoneID finds a zone id for the given dns record
// findZoneID finds a zone id for the given dns record
func findZoneID(ctx context.Context, api interface {
	ListZones(ctx context.Context, z ...string) ([]cloudflare.Zone, error)
}, dnsName string) (string, error) {
	zones, err := api.ListZones(ctx)
	if err != nil {
		return "", err
	}
	for _, zone := range zones {
		if zone.Name == dnsName || strings.HasSuffix(dnsName, "."+zone.Name) {
			return zone.ID, nil
		}
	}
	return "", errors.New("zone id not found")
}
func findZoneID ( ctx context . Context , api interface { ListZones ( ctx context . Context , z ... string ) ( [ ] cloudflare . Zone , error ) } , dnsName string ) ( string , error ) { zones , err := api . ListZones ( ctx ) if err != nil { return " " , err } for _ , zone := range zones { if zone . Name == dnsName || strings . HasSuffix ( dnsName , " " + zone . Name ) { return zone . ID , nil } } return " " , errors . New ( " " ) }
findZoneID finds a zone id for the given dns record
findZoneID finds a zone id for the given dns record