Search in sources :

Example 1 with DescribeLoadBalancersResponse

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);
    }
}
Also used : ElasticLoadBalancingV2Client(software.amazon.awssdk.services.elasticloadbalancingv2.ElasticLoadBalancingV2Client) DescribeLoadBalancersResponse(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeLoadBalancersResponse) ScrapeConfig(ai.asserts.aws.cloudwatch.config.ScrapeConfig)

Aggregations

ScrapeConfig (ai.asserts.aws.cloudwatch.config.ScrapeConfig)1 ElasticLoadBalancingV2Client (software.amazon.awssdk.services.elasticloadbalancingv2.ElasticLoadBalancingV2Client)1 DescribeLoadBalancersResponse (software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeLoadBalancersResponse)1