当前位置: 首页>>代码示例>>Java>>正文


Java LoadBalancerDescription.getInstances方法代码示例

本文整理汇总了Java中com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription.getInstances方法的典型用法代码示例。如果您正苦于以下问题:Java LoadBalancerDescription.getInstances方法的具体用法?Java LoadBalancerDescription.getInstances怎么用?Java LoadBalancerDescription.getInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription的用法示例。


在下文中一共展示了LoadBalancerDescription.getInstances方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addInstancesThatMatchBuildAndType

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
private List<Instance> addInstancesThatMatchBuildAndType(ProjectAndEnv projAndEnv, String typeTag) throws CfnAssistException {
	if (!projAndEnv.hasBuildNumber()) {
		throw new MustHaveBuildNumber();
	}
	LoadBalancerDescription elb = findELBFor(projAndEnv, typeTag);	
	List<Instance> currentInstances = elb.getInstances();
	String lbName = elb.getLoadBalancerName();
	
	SearchCriteria criteria = new SearchCriteria(projAndEnv);
	List<Instance> allMatchingInstances = cfnRepository.getAllInstancesMatchingType(criteria, typeTag);
	List<Instance> instancesToAdd = filterBy(currentInstances, allMatchingInstances);
	if (allMatchingInstances.size()==0) {
		logger.warn(String.format("No instances matched %s and type tag %s (%s)", projAndEnv, typeTag, AwsFacade.TYPE_TAG));
	} else {	
		logger.info(String.format("Regsister matching %s instances with the LB %s ", instancesToAdd.size(),lbName));
		elbClient.registerInstances(instancesToAdd, lbName);	
	}
	return instancesToAdd;
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:20,代码来源:ELBRepository.java

示例2: removeInstancesNotMatching

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
private List<Instance> removeInstancesNotMatching(ProjectAndEnv projAndEnv, List<Instance> matchingInstances, String typeTag) throws MustHaveBuildNumber, TooManyELBException {	
	LoadBalancerDescription elb = findELBFor(projAndEnv, typeTag);
	logger.info("Checking if instances should be removed from ELB " + elb.getLoadBalancerName());
	List<Instance> currentInstances = elb.getInstances();	
			
	List<Instance> toRemove = new LinkedList<Instance>();
	for(Instance current : currentInstances) {
		String instanceId = current.getInstanceId();
		if (matchingInstances.contains(current)) {
			logger.info("Instance matched project/env/build/type, will not be removed " + instanceId);
		} else {
			logger.info("Instance did not match, will be removed from ELB " +instanceId);
			toRemove.add(new Instance(instanceId));
		}
	}
	
	if (toRemove.isEmpty()) {
		logger.info("No instances to remove from ELB " + elb.getLoadBalancerName());
		return new LinkedList<Instance>();
	}
	return removeInstances(elb,toRemove);	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:23,代码来源:ELBRepository.java

示例3: deregisterRequests

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
private List<DeregisterInstancesFromLoadBalancerRequest> deregisterRequests(BaragonGroup group, Collection<BaragonAgentMetadata> agents, List<LoadBalancerDescription> elbs) {
  List<String> agentInstanceIds = agentInstanceIds(agents);
  List<DeregisterInstancesFromLoadBalancerRequest> requests = new ArrayList<>();
  for (LoadBalancerDescription elb : elbs) {
    if (group.getTrafficSources().contains(new TrafficSource(elb.getLoadBalancerName(), TrafficSourceType.CLASSIC))) {
      for (Instance instance : elb.getInstances()) {
        if (!agentInstanceIds.contains(instance.getInstanceId()) && canDeregisterAgent(group, instance.getInstanceId())) {
          List<Instance> instanceList = new ArrayList<>(1);
          instanceList.add(instance);
          requests.add(new DeregisterInstancesFromLoadBalancerRequest(elb.getLoadBalancerName(), instanceList));
          LOG.info("Will deregister instance {} from ELB {}", instance.getInstanceId(), elb.getLoadBalancerName());
        }
      }
    }
  }
  return requests;
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:18,代码来源:ClassicLoadBalancer.java

示例4: visitELB

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
private void visitELB(VPCDiagramBuilder vpcDiagramBuilder, LoadBalancerDescription elb) throws CfnAssistException {
	logger.debug("visit elb " + elb.getLoadBalancerName()); 

	vpcDiagramBuilder.addELB(elb);
	for(com.amazonaws.services.elasticloadbalancing.model.Instance instance : elb.getInstances()) {
		vpcDiagramBuilder.associateELBToInstance(elb, instance.getInstanceId());
	}
	for(String subnetId : elb.getSubnets()) {
		vpcDiagramBuilder.associateELBToSubnet(elb, subnetId);
	}
	for(String groupId : elb.getSecurityGroups()) {
		SecurityGroup group = facade.getSecurityGroupDetailsById(groupId);
		addSecGroupToDiagram(vpcDiagramBuilder, elb.getDNSName(), group);
	}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:16,代码来源:VPCVisitor.java

示例5: findInstancesAssociatedWithLB

import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription; //导入方法依赖的package包/类
public List<Instance> findInstancesAssociatedWithLB(
		ProjectAndEnv projAndEnv, String typeTag) throws TooManyELBException {
	LoadBalancerDescription elb = findELBFor(projAndEnv, typeTag);
	return elb.getInstances();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:6,代码来源:ELBRepository.java


注:本文中的com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription.getInstances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。