use of software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeLoadBalancersResponse in project aws-cloudwatch-exporter by asserts.
the class TargetGroupLBMapProvider method update.
public void update() {
try {
ScrapeConfig scrapeConfig = scrapeConfigProvider.getScrapeConfig();
scrapeConfig.getRegions().forEach(region -> {
try (ElasticLoadBalancingV2Client lbClient = awsClientProvider.getELBV2Client(region)) {
String api = "ElasticLoadBalancingV2Client/describeLoadBalancers";
ImmutableSortedMap<String, String> labels = ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_OPERATION_LABEL, api);
DescribeLoadBalancersResponse resp = rateLimiter.doWithRateLimit(api, labels, lbClient::describeLoadBalancers);
if (resp.hasLoadBalancers()) {
resp.loadBalancers().forEach(lb -> mapLB(lbClient, labels, lb));
}
}
});
} catch (Exception e) {
log.error("Failed to build LB Target Group map", e);
}
}
Aggregations