use of com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription in project SimianArmy by Netflix.
the class TestELBJanitorCrawler method testElbsWithNoInstances.
@Test
public void testElbsWithNoInstances() {
boolean includeInstances = false;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
addELBsToMock(client, elbs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs);
}
use of com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription in project SimianArmy by Netflix.
the class TestELBJanitorCrawler method testElbsWithMultipleReferencedASGs.
@Test
public void testElbsWithMultipleReferencedASGs() {
boolean includeInstances = true;
boolean includeELbs = false;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
List<AutoScalingGroup> asgs = createASGList(includeELbs);
asgs.get(0).setLoadBalancerNames(Arrays.asList("elb1", "elb2"));
addELBsToMock(client, elbs);
addASGsToMock(client, asgs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs, 1);
}
use of com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription in project chassis by Kixeye.
the class ZookeeperElbFilterTest method foundCloudformationZookeeper.
@Test
public void foundCloudformationZookeeper() {
LoadBalancerDescription loadBalancer = new LoadBalancerDescription();
List<ListenerDescription> listenerDescriptions = new ArrayList<>();
listenerDescriptions.add(new ListenerDescription());
loadBalancer.setListenerDescriptions(listenerDescriptions);
loadBalancer.setLoadBalancerName(ENVIRONMENT + "-Zookeeper-whatever");
Assert.assertTrue(filter.accept(loadBalancer));
}
use of com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription in project chassis by Kixeye.
the class AwsUtils method findLoadBalancers.
/**
* Fetches and filters a Region's ELBs
* @param amazonElasticLoadBalancing
* @param filter
* @return
*/
public static List<LoadBalancerDescription> findLoadBalancers(AmazonElasticLoadBalancing amazonElasticLoadBalancing, ELBFilter filter) {
List<LoadBalancerDescription> loadBalancers = amazonElasticLoadBalancing.describeLoadBalancers().getLoadBalancerDescriptions();
List<LoadBalancerDescription> result = new ArrayList<>(loadBalancers.size());
for (LoadBalancerDescription loadBalancer : loadBalancers) {
if (filter.accept(loadBalancer)) {
result.add(loadBalancer);
}
}
return result;
}
use of com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription in project chassis by Kixeye.
the class ServerInstanceContext method initExhibitor.
private void initExhibitor() {
LOGGER.info("Initializing exhibitor info...");
List<LoadBalancerDescription> loadBalancers = AwsUtils.findLoadBalancers(amazonElasticLoadBalancing, new ZookeeperElbFilter(environment));
if (loadBalancers.size() == 0) {
LOGGER.info("No Zookeeper ELBs for environment " + environment);
return;
} else if (loadBalancers.size() != 1) {
throw new BootstrapException("Found multiple Zookeeper ELBs for environment " + environment);
}
LoadBalancerDescription loadBalancer = loadBalancers.get(0);
ListenerDescription exhibitorListenerDescription = getExhibitorListenerDescription(loadBalancer);
this.exhibitorHost = loadBalancer.getDNSName();
this.exhibitorPort = exhibitorListenerDescription.getListener().getLoadBalancerPort();
LOGGER.info("Initialized exhibitor info with: exhibitorHost: {}, exhibitorPort: {}", exhibitorHost, exhibitorPort);
}
Aggregations