Browse Source

zones: adds ForEachMachine() iterator

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head
Alejandro Mery 1 year ago
parent
commit
be9da490ff
  1. 9
      pkg/zones/zones.go

9
pkg/zones/zones.go

@ -31,6 +31,15 @@ type Zones struct {
Zones []*Zone `toml:"zones"`
}
// ForEachMachine calls a function for each Machine in the cluster
func (m *Zones) ForEachMachine(fn func(*Machine)) {
for _, z := range m.Zones {
for _, p := range z.Machines {
fn(p)
}
}
}
// NewFS builds a [Zones] tree using the given directory
func NewFS(dir fs.FS, domain string) (*Zones, error) {
z := &Zones{

Loading…
Cancel
Save