Java 类com.amazonaws.services.autoscaling.model.TerminateInstanceInAutoScalingGroupRequest 实例源码

项目:cmn-project    文件:AutoScaling.java   
public void terminateInstancesInASGroup(List<String> instanceIds, boolean decrementDesiredCapacity) {
    logger.info("terminate instances in auto scaling group, instanceIds={}, decrementDesiredCapacity={}", instanceIds, decrementDesiredCapacity);
    for (String instanceId : instanceIds) {
        try {
            autoScaling.terminateInstanceInAutoScalingGroup(new TerminateInstanceInAutoScalingGroupRequest()
                .withInstanceId(instanceId)
                .withShouldDecrementDesiredCapacity(decrementDesiredCapacity));
        } catch (AmazonClientException e) {
            logger.warn("failed to terminate instance in auto scaling group, it could be already terminated by auto scaling group, instanceId={}", instanceId, e);
        }
    }
}
项目:scale.cloudpool    文件:TerminateAutoScalingGroupInstance.java   
@Override
public Void call() {
    TerminateInstanceInAutoScalingGroupRequest request = new TerminateInstanceInAutoScalingGroupRequest()
            .withInstanceId(this.instanceId).withShouldDecrementDesiredCapacity(true);
    getClient().getApi().terminateInstanceInAutoScalingGroup(request);

    awaitTermination(this.instanceId);
    return null;
}