(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Lambda)
| 305 | } |
| 306 | |
| 307 | func (m *LambdasModule) getLambdasPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Lambda) { |
| 308 | defer func() { |
| 309 | m.CommandCounter.DecrExecuting() |
| 310 | m.CommandCounter.IncrComplete() |
| 311 | wg.Done() |
| 312 | |
| 313 | }() |
| 314 | semaphore <- struct{}{} |
| 315 | defer func() { |
| 316 | <-semaphore |
| 317 | }() |
| 318 | |
| 319 | functions, err := m.listFunctions(r) |
| 320 | if err != nil { |
| 321 | m.modLog.Error(err.Error()) |
| 322 | m.CommandCounter.IncrError() |
| 323 | } |
| 324 | |
| 325 | for _, function := range functions { |
| 326 | arn := aws.ToString(function.FunctionArn) |
| 327 | name := aws.ToString(function.FunctionName) |
| 328 | role := aws.ToString(function.Role) |
| 329 | |
| 330 | dataReceiver <- Lambda{ |
| 331 | AWSService: "Lambda", |
| 332 | Name: name, |
| 333 | Arn: arn, |
| 334 | Region: r, |
| 335 | Type: "", |
| 336 | Role: role, |
| 337 | Admin: "", |
| 338 | CanPrivEsc: "", |
| 339 | Public: "", |
| 340 | } |
| 341 | |
| 342 | } |
| 343 | |
| 344 | } |
| 345 | |
| 346 | func (m *LambdasModule) listFunctions(r string) ([]types.FunctionConfiguration, error) { |
| 347 | // "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages. |
no test coverage detected