in architecture.go [118:142]
func (a *Architecture) addMgFromProcessor(libMg processor.LibArchitectureManagementGroup, az *AlzLib) error {
if _, ok := a.mgs[libMg.Id]; ok {
return fmt.Errorf("Architecture.addMg: management group %s already exists", libMg.Id)
}
mg := newArchitectureManagementGroup(libMg.Id, libMg.DisplayName, libMg.Exists, a)
// check parent exists and create parent-child relationship
if libMg.ParentId != nil {
parent, ok := a.mgs[*libMg.ParentId]
if !ok {
return fmt.Errorf("Architecture.addMg: parent management group does not exist %s", *libMg.ParentId)
}
mg.parent = parent
mg.parent.children.Add(mg)
}
mg.archetypes = mapset.NewThreadUnsafeSet[*Archetype]()
for archName := range libMg.Archetypes.Iter() {
arch, ok := az.archetypes[archName]
if !ok {
return fmt.Errorf("Architecture.addMg: archetype not found adding archetype `%s` to management group `%s`", archName, libMg.Id)
}
mg.archetypes.Add(arch)
}
a.mgs[mg.id] = mg
return nil
}