organization/orgs.go
func (m *DefaultManager) CreateOrgs() error {
	m.orgs = nil
	desiredOrgs, err := m.Cfg.GetOrgConfigs()
	if err != nil {
		return err
	}

	currentOrgs, err := m.ListOrgs()
	if err != nil {
		return err
	}

	for _, org := range desiredOrgs {
		if doesOrgExist(org.Org, currentOrgs) {
			lo.G.Debugf("[%s] org already exists", org.Org)
			continue
		} else if doesOrgExistFromRename(org.OriginalOrg, currentOrgs) {
			lo.G.Debugf("renamed org [%s] already exists as [%s]", org.Org, org.OriginalOrg)
			if err := m.RenameOrg(org.OriginalOrg, org.Org); err != nil {
				return err
			}
			continue
		} else {
			lo.G.Debugf("[%s] org doesn't exist in list [%v]", org.Org, desiredOrgs)
		}
		if err := m.CreateOrg(org.Org, m.orgNames(currentOrgs)); err != nil {
			return err
		}
	}
	m.orgs = nil
	return nil
}
func (m *DefaultManager) CreateOrgs() error {
	m.orgs = nil
	desiredOrgs, err := m.Cfg.GetOrgConfigs()
	if err != nil {
		return err
	}

	currentOrgs, err := m.ListOrgs()
	if err != nil {
		return err
	}

	for _, org := range desiredOrgs {
		if doesOrgExist(org.Org, currentOrgs) {
			lo.G.Debugf("[%s] org already exists", org.Org)
			continue
		} else if doesOrgExistFromRename(org.OriginalOrg, currentOrgs) {
			lo.G.Debugf("renamed org [%s] already exists as [%s]", org.Org, org.OriginalOrg)
			if err := m.RenameOrg(org.OriginalOrg, org.Org); err != nil {
				return err
			}
			continue
		} else {
			lo.G.Debugf("[%s] org doesn't exist in list [%v]", org.Org, desiredOrgs)
		}
		if err := m.CreateOrg(org.Org, m.orgNames(currentOrgs)); err != nil {
			return err
		}
	}
	m.orgs = nil
	return nil
}
func ( m * DefaultManager ) CreateOrgs ( ) error { m . orgs = nil desiredOrgs , err := m . Cfg . GetOrgConfigs ( ) if err != nil { return err } currentOrgs , err := m . ListOrgs ( ) if err != nil { return err } for _ , org := range desiredOrgs { if doesOrgExist ( org . Org , currentOrgs ) { lo . G . Debugf ( " " , org . Org ) continue } else if doesOrgExistFromRename ( org . OriginalOrg , currentOrgs ) { lo . G . Debugf ( " " , org . Org , org . OriginalOrg ) if err := m . RenameOrg ( org . OriginalOrg , org . Org ) ; err != nil { return err } continue } else { lo . G . Debugf ( " " , org . Org , desiredOrgs ) } if err := m . CreateOrg ( org . Org , m . orgNames ( currentOrgs ) ) ; err != nil { return err } } m . orgs = nil return nil }
//CreateOrgs -
CreateOrgs -