(region string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan EnvironmentVariable)
| 333 | } |
| 334 | |
| 335 | func (m *EnvsModule) getECSEnvironmentVariablesPerRegion(region string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan EnvironmentVariable) { |
| 336 | defer func() { |
| 337 | m.CommandCounter.DecrExecuting() |
| 338 | m.CommandCounter.IncrComplete() |
| 339 | wg.Done() |
| 340 | |
| 341 | }() |
| 342 | semaphore <- struct{}{} |
| 343 | defer func() { |
| 344 | <-semaphore |
| 345 | }() |
| 346 | // m.CommandCounter.IncrTotal() |
| 347 | m.CommandCounter.DecrPending() |
| 348 | m.CommandCounter.IncrExecuting() |
| 349 | // "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages. |
| 350 | //var PaginationMarker *string |
| 351 | |
| 352 | // This new approach takes one active task from each task family and grabs the container envs from that. Ran into a case where every version |
| 353 | // of a task was listed as active and it brought cloudfox to a halt for a really long time. |
| 354 | for _, familyName := range m.getTaskDefinitionFamilies(region) { |
| 355 | |
| 356 | DescribeTaskDefinition, err := m.ECSClient.DescribeTaskDefinition( |
| 357 | context.TODO(), |
| 358 | &ecs.DescribeTaskDefinitionInput{ |
| 359 | TaskDefinition: &familyName, |
| 360 | }, |
| 361 | func(o *ecs.Options) { |
| 362 | o.Region = region |
| 363 | }, |
| 364 | ) |
| 365 | if err != nil { |
| 366 | m.modLog.Error(err.Error()) |
| 367 | m.CommandCounter.IncrError() |
| 368 | break |
| 369 | } |
| 370 | for _, containerDefinition := range DescribeTaskDefinition.TaskDefinition.ContainerDefinitions { |
| 371 | m.getECSEnvironmentVariablesPerDefinition(*DescribeTaskDefinition.TaskDefinition, containerDefinition, region, dataReceiver) |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | func (m *EnvsModule) getTaskDefinitionFamilies(region string) []string { |
| 377 | var allFamilyNames []string |
no test coverage detected