From 16163480397fd4152e44e83ac049eeb6597e81c9 Mon Sep 17 00:00:00 2001 From: Amogh Lele Date: Fri, 3 May 2024 23:20:45 +0530 Subject: [PATCH] NETLIFY: add support for listing all zones (#2933) Signed-off-by: SphericalKat --- providers/netlify/netlifyProvider.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/providers/netlify/netlifyProvider.go b/providers/netlify/netlifyProvider.go index 02af5e517..fe83a5cfe 100644 --- a/providers/netlify/netlifyProvider.go +++ b/providers/netlify/netlifyProvider.go @@ -141,6 +141,21 @@ func (n *netlifyProvider) GetZoneRecords(domain string, meta map[string]string) return cleanRecords, nil } +// ListZones returns all DNS zones managed by this provider. +func (n *netlifyProvider) ListZones() ([]string, error) { + zones, err := n.getDNSZones() + if err != nil { + return nil, err + } + + zoneNames := make([]string, len(zones)) + for i, z := range zones { + zoneNames[i] = z.Name + } + + return zoneNames, nil +} + // GetZoneRecordsCorrections returns a list of corrections that will turn existing records into dc.Records. func (n *netlifyProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, records models.Records) ([]*models.Correction, error) { toReport, create, del, modify, err := diff.NewCompat(dc).IncrementalDiff(records)