本文整理汇总了Java中com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest类的典型用法代码示例。如果您正苦于以下问题:Java DeregisterInstancesFromLoadBalancerRequest类的具体用法?Java DeregisterInstancesFromLoadBalancerRequest怎么用?Java DeregisterInstancesFromLoadBalancerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeregisterInstancesFromLoadBalancerRequest类属于com.amazonaws.services.elasticloadbalancing.model包,在下文中一共展示了DeregisterInstancesFromLoadBalancerRequest类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deregisterInstance
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
/**
* Requests deregistration of the ec2 instance from the ELB.
* <p/>
* After calling here, you need to call DescribeLoadBalancers to see if registration is complete.
*/
public void deregisterInstance(String elbName, String ec2InstanceId)
{
LOGGER.debug("deregisterInstancesFromLoadBalancer(elbName: " + elbName + ", ec2InstanceId: " + ec2InstanceId + ")");
assertNonBlankArgs(elbName, ec2InstanceId);
StopWatch stopWatch = new StopWatch();
try
{
stopWatch.start();
DeregisterInstancesFromLoadBalancerRequest request = new DeregisterInstancesFromLoadBalancerRequest();
request.setLoadBalancerName(elbName);
request.setInstances(Arrays.asList(new Instance(ec2InstanceId)));
awsElbClient.deregisterInstancesFromLoadBalancer(request);
//Currently not doing anything with the DeregisterInstancesFromLoadBalancerResult
}
finally
{
stopWatch.stop();
LOGGER.debug("deregisterInstancesFromLoadBalancer time elapsed " + stopWatch);
}
}
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:26,代码来源:ElbClient.java
示例2: deregisterInstances
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
private DeferredResult<AWSLoadBalancerContext> deregisterInstances(
AWSLoadBalancerContext context) {
// Do not try to deregister instances if there aren't any
if (context.instanceIdsToDeregister.isEmpty()) {
return DeferredResult.completed(context);
}
DeregisterInstancesFromLoadBalancerRequest request = buildInstanceDeregistrationRequest(
context);
String message = "Deregistering instances to AWS Load Balancer with name ["
+ context.loadBalancerStateExpanded.name + "]";
AWSDeferredResultAsyncHandler<DeregisterInstancesFromLoadBalancerRequest, DeregisterInstancesFromLoadBalancerResult> handler =
new AWSDeferredResultAsyncHandler<>(this, message);
context.client.deregisterInstancesFromLoadBalancerAsync(request, handler);
return handler.toDeferredResult().thenApply(ignore -> context);
}
开发者ID:vmware,项目名称:photon-model,代码行数:21,代码来源:AWSLoadBalancerService.java
示例3: removeInstancesFromLoadBalancer
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
public static void removeInstancesFromLoadBalancer(String name,
String... instanceIds) {
if (name == null || name.trim().length() == 0)
throw new RuntimeException(
"The name of the load balancer cannot be empty!");
if (instanceIds == null || instanceIds.length == 0)
throw new RuntimeException(
"You need to specify at least one instance id!");
connect();
ArrayList<com.amazonaws.services.elasticloadbalancing.model.Instance> instances = new ArrayList<com.amazonaws.services.elasticloadbalancing.model.Instance>();
for (String instanceId : instanceIds)
instances
.add(new com.amazonaws.services.elasticloadbalancing.model.Instance(
instanceId));
DeregisterInstancesFromLoadBalancerRequest req = new DeregisterInstancesFromLoadBalancerRequest(
name, instances);
client.deregisterInstancesFromLoadBalancer(req);
}
开发者ID:rickdesantis,项目名称:cloud-runner,代码行数:23,代码来源:ElasticLoadBalancing.java
示例4: deregisterRequests
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的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
示例5: testDeregisterInstance
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
/**
* Proves the client method is called.
*/
@Test
public void testDeregisterInstance()
{
elbClient.deregisterInstance(ELB_NAME, EC2_INSTANCE_ID);
verify(mockELBClient).deregisterInstancesFromLoadBalancer(any(DeregisterInstancesFromLoadBalancerRequest.class));
}
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:10,代码来源:ElbClientTest.java
示例6: buildInstanceDeregistrationRequest
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
private DeregisterInstancesFromLoadBalancerRequest buildInstanceDeregistrationRequest(
AWSLoadBalancerContext context) {
return new DeregisterInstancesFromLoadBalancerRequest()
.withLoadBalancerName(context.loadBalancerStateExpanded.name)
.withInstances(context.instanceIdsToDeregister.stream()
.map(Instance::new)
.collect(Collectors.toList())
);
}
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:AWSLoadBalancerService.java
示例7: detachInstances
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
public void detachInstances(String elbName, List<String> instanceIds) {
logger.info("detach instances from elb, elb={}, instances={}", elbName, instanceIds);
List<Instance> instances = instanceIds.stream().map(Instance::new).collect(Collectors.toList());
elb.deregisterInstancesFromLoadBalancer(new DeregisterInstancesFromLoadBalancerRequest()
.withLoadBalancerName(elbName)
.withInstances(instances));
}
开发者ID:neowu,项目名称:cmn-project,代码行数:10,代码来源:ElasticLoadBalancing.java
示例8: degisterInstancesFromLB
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
public List<Instance> degisterInstancesFromLB(List<Instance> toRemove,
String loadBalancerName) {
DeregisterInstancesFromLoadBalancerRequest request= new DeregisterInstancesFromLoadBalancerRequest();
request.setInstances(toRemove);
request.setLoadBalancerName(loadBalancerName);
DeregisterInstancesFromLoadBalancerResult result = elbClient.deregisterInstancesFromLoadBalancer(request);
List<Instance> remaining = result.getInstances();
logger.info(String.format("ELB %s now has %s instances registered", loadBalancerName, remaining.size()));
return remaining;
}
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:13,代码来源:LoadBalancerClient.java
示例9: removeFromElb
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
@DELETE
@Path("/{elbName}/update")
public DeregisterInstancesFromLoadBalancerResult removeFromElb(@PathParam("elbName") String elbName, @QueryParam("instanceId") String instanceId) {
if (config.isPresent()) {
DeregisterInstancesFromLoadBalancerRequest request = new DeregisterInstancesFromLoadBalancerRequest(elbName, Arrays.asList(new Instance(instanceId)));
return elbClient.deregisterInstancesFromLoadBalancer(request);
} else {
throw new BaragonWebException("ElbSync and related actions are not currently enabled");
}
}
开发者ID:HubSpot,项目名称:Baragon,代码行数:11,代码来源:ElbResource.java
示例10: removeInstance
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
public AgentCheckInResponse removeInstance(Instance instance, String elbName, String agentId) {
Optional<LoadBalancerDescription> elb = getElb(elbName);
if (elb.isPresent()) {
if (elb.get().getInstances().contains(instance)) {
DeregisterInstancesFromLoadBalancerRequest request = new DeregisterInstancesFromLoadBalancerRequest(elbName, Arrays.asList(instance));
elbClient.deregisterInstancesFromLoadBalancer(request);
LOG.info("Deregistered instance {} from ELB {}", request.getInstances(), request.getLoadBalancerName());
} else {
LOG.debug("Agent {} already de-registered from ELB {}", agentId, elbName);
}
}
return new AgentCheckInResponse(TrafficSourceState.DONE, Optional.absent(), 0L);
}
开发者ID:HubSpot,项目名称:Baragon,代码行数:14,代码来源:ClassicLoadBalancer.java
示例11: isLastHealthyInstance
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest; //导入依赖的package包/类
private boolean isLastHealthyInstance(DeregisterInstancesFromLoadBalancerRequest request) throws AmazonClientException {
DescribeInstanceHealthRequest describeRequest = new DescribeInstanceHealthRequest(request.getLoadBalancerName());
DescribeInstanceHealthResult result = elbClient.describeInstanceHealth(describeRequest);
boolean instanceIsHealthy = false;
int healthyCount = 0;
for (InstanceState instanceState : result.getInstanceStates()) {
if (instanceState.getState().equals("InService")) {
healthyCount++;
if (instanceState.getInstanceId().equals(request.getInstances().get(0).getInstanceId())) { //Will only ever be one instance per request
instanceIsHealthy = true;
}
}
}
return (instanceIsHealthy && healthyCount == 1);
}
开发者ID:HubSpot,项目名称:Baragon,代码行数:16,代码来源:ClassicLoadBalancer.java
注:本文中的com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论