本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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();
}