func (m *DefaultManager) CreateSpaces() error {
	m.spaces = nil
	configSpaceList, err := m.Cfg.GetSpaceConfigs()
	if err != nil {
		return err
	}
	err = m.init()
	if err != nil {
		return err
	}
	for _, space := range configSpaceList {
		orgGUID, err := m.OrgMgr.GetOrgGUID(space.Org)
		if err != nil {
			return err
		}
		spaces, err := m.ListSpaces(orgGUID)
		if err != nil {
			continue
		}

		if m.doesSpaceExist(spaces, space.Space) {
			lo.G.Debugf("[%s] space already exists in org [%s]", space.Space, space.Org)
			continue
		} else if doesSpaceExistFromRename(space.OriginalSpace, spaces) {
			lo.G.Debugf("renamed space [%s] already exists as [%s]", space.Space, space.OriginalSpace)
			if err = m.RenameSpace(space.OriginalSpace, space.Space, space.Org); err != nil {
				return err
			}

			continue
		} else {
			lo.G.Debugf("[%s] space doesn't exist in [%v]", space.Space, spaces)
		}
		if err = m.CreateSpace(space.Space, space.Org, orgGUID); err != nil {
			lo.G.Error(err)
			return err
		}
	}
	m.spaces = nil
	return nil
}
func (m *DefaultManager) CreateSpaces() error {
	m.spaces = nil
	configSpaceList, err := m.Cfg.GetSpaceConfigs()
	if err != nil {
		return err
	}
	err = m.init()
	if err != nil {
		return err
	}
	for _, space := range configSpaceList {
		orgGUID, err := m.OrgMgr.GetOrgGUID(space.Org)
		if err != nil {
			return err
		}
		spaces, err := m.ListSpaces(orgGUID)
		if err != nil {
			continue
		}

		if m.doesSpaceExist(spaces, space.Space) {
			lo.G.Debugf("[%s] space already exists in org [%s]", space.Space, space.Org)
			continue
		} else if doesSpaceExistFromRename(space.OriginalSpace, spaces) {
			lo.G.Debugf("renamed space [%s] already exists as [%s]", space.Space, space.OriginalSpace)
			if err = m.RenameSpace(space.OriginalSpace, space.Space, space.Org); err != nil {
				return err
			}

			continue
		} else {
			lo.G.Debugf("[%s] space doesn't exist in [%v]", space.Space, spaces)
		}
		if err = m.CreateSpace(space.Space, space.Org, orgGUID); err != nil {
			lo.G.Error(err)
			return err
		}
	}
	m.spaces = nil
	return nil
}
func ( m * DefaultManager ) CreateSpaces ( ) error { m . spaces = nil configSpaceList , err := m . Cfg . GetSpaceConfigs ( ) if err != nil { return err } err = m . init ( ) if err != nil { return err } for _ , space := range configSpaceList { orgGUID , err := m . OrgMgr . GetOrgGUID ( space . Org ) if err != nil { return err } spaces , err := m . ListSpaces ( orgGUID ) if err != nil { continue } if m . doesSpaceExist ( spaces , space . Space ) { lo . G . Debugf ( " " , space . Space , space . Org ) continue } else if doesSpaceExistFromRename ( space . OriginalSpace , spaces ) { lo . G . Debugf ( " " , space . Space , space . OriginalSpace ) if err = m . RenameSpace ( space . OriginalSpace , space . Space , space . Org ) ; err != nil { return err } continue } else { lo . G . Debugf ( " " , space . Space , spaces ) } if err = m . CreateSpace ( space . Space , space . Org , orgGUID ) ; err != nil { lo . G . Error ( err ) return err } } m . spaces = nil return nil }
//CreateSpaces -
CreateSpaces -