From 979324f151923a2c4f1d74fc8249fb328e4a80e1 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 22 Aug 2023 00:37:41 +0000 Subject: [PATCH] zones: adds ForEachZone iterator Signed-off-by: Alejandro Mery --- pkg/zones/zones.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/zones/zones.go b/pkg/zones/zones.go index a6df546..e20a00d 100644 --- a/pkg/zones/zones.go +++ b/pkg/zones/zones.go @@ -40,6 +40,13 @@ func (m *Zones) ForEachMachine(fn func(*Machine)) { } } +// ForEachZone calls a function for each Zone in the cluster +func (m *Zones) ForEachZone(fn func(*Zone)) { + for _, p := range m.Zones { + fn(p) + } +} + // NewFS builds a [Zones] tree using the given directory func NewFS(dir fs.FS, domain string) (*Zones, error) { z := &Zones{