List of usage examples for com.amazonaws.services.autoscaling.model DescribeLaunchConfigurationsResult getNextToken
public String getNextToken()
A string that indicates that the response contains more items than can be returned in a single response.
From source file:com.netflix.simianarmy.client.aws.AWSClient.java
License:Apache License
/** * Describe a set of specific launch configurations. * * @param names the launch configuration names * @return the launch configurations/*from w ww.j a v a 2 s . c o m*/ */ public List<LaunchConfiguration> describeLaunchConfigurations(String... names) { if (names == null || names.length == 0) { LOGGER.info(String.format("Getting all launch configurations in region %s.", region)); } else { LOGGER.info(String.format("Getting launch configurations for %d names in region %s.", names.length, region)); } List<LaunchConfiguration> lcs = new LinkedList<LaunchConfiguration>(); AmazonAutoScalingClient asgClient = asgClient(); DescribeLaunchConfigurationsRequest request = new DescribeLaunchConfigurationsRequest() .withLaunchConfigurationNames(names); DescribeLaunchConfigurationsResult result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); while (result.getNextToken() != null) { request.setNextToken(result.getNextToken()); result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); } LOGGER.info(String.format("Got %d launch configurations in region %s.", lcs.size(), region)); return lcs; }
From source file:io.macgyver.plugin.cloud.aws.scanner.LaunchConfigScanner.java
License:Apache License
private void forEachLaunchConfig(Region region, Consumer<LaunchConfiguration> consumer) { AmazonAutoScalingClient client = new AmazonAutoScalingClient(getAWSServiceClient().getCredentialsProvider()) .withRegion(region);//from w ww . j a v a2 s . com DescribeLaunchConfigurationsResult results = client .describeLaunchConfigurations(new DescribeLaunchConfigurationsRequest()); String token = results.getNextToken(); results.getLaunchConfigurations().forEach(consumer); while (!Strings.isNullOrEmpty(token) && !token.equals("null")) { results = client .describeLaunchConfigurations(new DescribeLaunchConfigurationsRequest().withNextToken(token)); token = results.getNextToken(); results.getLaunchConfigurations().forEach(consumer); } }
From source file:org.lendingclub.mercator.aws.LaunchConfigScanner.java
License:Apache License
private void forEachLaunchConfig(Region region, Consumer<LaunchConfiguration> consumer) { DescribeLaunchConfigurationsResult results = getClient() .describeLaunchConfigurations(new DescribeLaunchConfigurationsRequest()); String token = results.getNextToken(); results.getLaunchConfigurations().forEach(consumer); while (tokenHasNext(token)) { results = getClient()/*from w ww. j a v a 2 s. c o m*/ .describeLaunchConfigurations(new DescribeLaunchConfigurationsRequest().withNextToken(token)); token = results.getNextToken(); results.getLaunchConfigurations().forEach(consumer); } }