(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint)
| 544 | } |
| 545 | |
| 546 | func (m *EndpointsModule) getMqBrokersPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) { |
| 547 | defer func() { |
| 548 | m.CommandCounter.DecrExecuting() |
| 549 | m.CommandCounter.IncrComplete() |
| 550 | wg.Done() |
| 551 | |
| 552 | }() |
| 553 | semaphore <- struct{}{} |
| 554 | defer func() { |
| 555 | <-semaphore |
| 556 | }() |
| 557 | // m.CommandCounter.IncrTotal() |
| 558 | m.CommandCounter.DecrPending() |
| 559 | m.CommandCounter.IncrExecuting() |
| 560 | |
| 561 | BrokerSummaries, err := sdk.CachedMQListBrokers(m.MQClient, aws.ToString(m.Caller.Account), r) |
| 562 | if err != nil { |
| 563 | m.modLog.Error(err.Error()) |
| 564 | m.CommandCounter.IncrError() |
| 565 | return |
| 566 | } |
| 567 | |
| 568 | var public string |
| 569 | for _, broker := range BrokerSummaries { |
| 570 | name := aws.ToString(broker.BrokerName) |
| 571 | id := broker.BrokerId |
| 572 | |
| 573 | BrokerDetails, err := m.MQClient.DescribeBroker( |
| 574 | context.TODO(), |
| 575 | &(mq.DescribeBrokerInput{ |
| 576 | BrokerId: id, |
| 577 | }), |
| 578 | func(o *mq.Options) { |
| 579 | o.Region = r |
| 580 | }, |
| 581 | ) |
| 582 | if err != nil { |
| 583 | if errors.As(err, &oe) { |
| 584 | m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation())) |
| 585 | } |
| 586 | m.modLog.Error(err.Error()) |
| 587 | m.CommandCounter.IncrError() |
| 588 | continue |
| 589 | } |
| 590 | if aws.ToBool(BrokerDetails.PubliclyAccessible) { |
| 591 | public = "True" |
| 592 | } else { |
| 593 | public = "False" |
| 594 | } |
| 595 | |
| 596 | endpoint := aws.ToString(BrokerDetails.BrokerInstances[0].ConsoleURL) |
| 597 | |
| 598 | dataReceiver <- Endpoint{ |
| 599 | AWSService: "Amazon MQ", |
| 600 | Region: r, |
| 601 | Name: name, |
| 602 | Endpoint: endpoint, |
| 603 | Port: 443, |
no test coverage detected