func CrawlResources(ctx context.Context, subs armclient.SubResponse) error {
	wait := &sync.WaitGroup{}

	err := storage.ClearResources()
	if err != nil {
		return err
	}

	for _, sub := range subs.Subs {
		wait.Add(1)
		subID := sub.ID
		go func() {
			ctx, cancel := context.WithTimeout(ctx, time.Duration(30*time.Minute))
			defer cancel()
			rgList := subID + "/resourceGroups?api-version=2014-04-01"
			err := fetchAndStoreGroups(ctx, rgList)
			if err != nil {
				panic(err)
			}

			resourcesListURL := subID + "/resources?api-version=2014-04-01"
			err = fetchAndStoreResourceURL(ctx, resourcesListURL)
			if err != nil {
				panic(err)
			}
			wait.Done()
		}()
	}

	wait.Wait()
	return nil
}
// CrawlResources grabs all the resources in all subs and stores their name/id in the boltdb for searching over
CrawlResources grabs all the resources in all subs and stores their name/id in the boltdb for searching over
// CrawlResources grabs all the resources in all subs and stores their name / id in the boltdb for searching over
func CrawlResources(ctx context.Context, subs armclient.SubResponse) error {
	wait := &sync.WaitGroup{}
	err := storage.ClearResources()
	if err != nil {
		return err
	}
	for _, sub := range subs.Subs {
		wait.Add(1)
		subID := sub.ID
		go func() {
			ctx, cancel := context.WithTimeout(ctx, time.Duration(30*time.Minute))
			defer cancel()
			rgList := subID + "/resourceGroups?api-version=2014-04-01"
			err := fetchAndStoreGroups(ctx, rgList)
			if err != nil {
				panic(err)
			}
			resourcesListURL := subID + "/resources?api-version=2014-04-01"
			err = fetchAndStoreResourceURL(ctx, resourcesListURL)
			if err != nil {
				panic(err)
			}
			wait.Done()
		}()
	}
	wait.Wait()
	return nil
}
func CrawlResources ( ctx context . Context , subs armclient . SubResponse ) error { wait := & sync . WaitGroup { } err := storage . ClearResources ( ) if err != nil { return err } for _ , sub := range subs . Subs { wait . Add ( 1 ) subID := sub . ID go func ( ) { ctx , cancel := context . WithTimeout ( ctx , time . Duration ( 30 * time . Minute ) ) defer cancel ( ) rgList := subID + " " err := fetchAndStoreGroups ( ctx , rgList ) if err != nil { panic ( err ) } resourcesListURL := subID + " " err = fetchAndStoreResourceURL ( ctx , resourcesListURL ) if err != nil { panic ( err ) } wait . Done ( ) } ( ) } wait . Wait ( ) return nil }
CrawlResources grabs all the resources in all subs and stores their name/id in the boltdb for searching over
CrawlResources grabs all the resources in all subs and stores their name / id in the boltdb for searching over