zones: adds ForEachMachine() iterator
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -31,6 +31,15 @@ type Zones struct {
|
|||||||
Zones []*Zone `toml:"zones"`
|
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
|
// NewFS builds a [Zones] tree using the given directory
|
||||||
func NewFS(dir fs.FS, domain string) (*Zones, error) {
|
func NewFS(dir fs.FS, domain string) (*Zones, error) {
|
||||||
z := &Zones{
|
z := &Zones{
|
||||||
|
|||||||
Reference in New Issue
Block a user