(r string, wg *sync.WaitGroup, semaphore chan struct{})
| 2604 | } |
| 2605 | |
| 2606 | func (m *Inventory2Module) getCodeBuildProjectsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}) { |
| 2607 | defer func() { |
| 2608 | wg.Done() |
| 2609 | m.CommandCounter.DecrExecuting() |
| 2610 | m.CommandCounter.IncrComplete() |
| 2611 | }() |
| 2612 | semaphore <- struct{}{} |
| 2613 | defer func() { |
| 2614 | <-semaphore |
| 2615 | }() |
| 2616 | // m.CommandCounter.IncrTotal() |
| 2617 | m.CommandCounter.DecrPending() |
| 2618 | m.CommandCounter.IncrExecuting() |
| 2619 | var totalCountThisServiceThisRegion = 0 |
| 2620 | var service = "CodeBuild Projects" |
| 2621 | var resourceNames []string |
| 2622 | |
| 2623 | projects, err := sdk.CachedCodeBuildListProjects(m.CodeBuildClient, aws.ToString(m.Caller.Account), r) |
| 2624 | if err != nil { |
| 2625 | m.modLog.Error(err.Error()) |
| 2626 | m.CommandCounter.IncrError() |
| 2627 | return |
| 2628 | } |
| 2629 | |
| 2630 | // Add this page of resources to the total count |
| 2631 | totalCountThisServiceThisRegion = totalCountThisServiceThisRegion + len(projects) |
| 2632 | |
| 2633 | // Add this page of resources to the module's resource list |
| 2634 | for _, project := range projects { |
| 2635 | arn := "arn:aws:codebuild:" + r + ":" + aws.ToString(m.Caller.Account) + ":project/" + project |
| 2636 | resourceNames = append(resourceNames, arn) |
| 2637 | } |
| 2638 | |
| 2639 | // No more pages, update the module's service map |
| 2640 | m.mu.Lock() |
| 2641 | m.resources = append(m.resources, resourceNames...) |
| 2642 | m.serviceMap[service][r] = totalCountThisServiceThisRegion |
| 2643 | m.totalRegionCounts[r] = m.totalRegionCounts[r] + totalCountThisServiceThisRegion |
| 2644 | m.serviceMap["total"][r] = m.serviceMap["total"][r] + totalCountThisServiceThisRegion |
| 2645 | |
| 2646 | m.mu.Unlock() |
| 2647 | } |
| 2648 | |
| 2649 | func (m *Inventory2Module) getCodeCommitRepositoriesPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}) { |
| 2650 | defer func() { |
no test coverage detected