Examples of describeAutoScalingGroups()


Examples of com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()

        AmazonAutoScaling client = null;
        try
        {
            client = getAutoScalingClient();
            DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(config.getASGName());
            DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);

            List<String> instanceIds = Lists.newArrayList();
            for (AutoScalingGroup asg : res.getAutoScalingGroups())
            {
                for (Instance ins : asg.getInstances())
View Full Code Here

Examples of com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()

        AmazonAutoScaling client = null;
        try
        {
            client = getAutoScalingClient();
            DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(config.getASGName());
            DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
            int size = 0;
            for (AutoScalingGroup asg : res.getAutoScalingGroups())
            {
                size += asg.getMaxSize();
            }
View Full Code Here

Examples of com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()

        AmazonAutoScaling client = null;
        try
        {
            client = getAutoScalingClient();
            DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(config.getASGName());
            DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
            AutoScalingGroup asg = res.getAutoScalingGroups().get(0);
            UpdateAutoScalingGroupRequest ureq = new UpdateAutoScalingGroupRequest();
            ureq.setAutoScalingGroupName(asg.getAutoScalingGroupName());
            ureq.setMinSize(asg.getMinSize() + 1);
            ureq.setMaxSize(asg.getMinSize() + 1);
View Full Code Here

Examples of com.amazonaws.services.autoscaling.AmazonAutoScalingClient.describeAutoScalingGroups()

        AmazonAutoScalingClient asgClient = asgClient();
        DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest();
        if (names != null) {
            request.setAutoScalingGroupNames(Arrays.asList(names));
        }
        DescribeAutoScalingGroupsResult result = asgClient.describeAutoScalingGroups(request);

        asgs.addAll(result.getAutoScalingGroups());
        while (result.getNextToken() != null) {
            request.setNextToken(result.getNextToken());
            result = asgClient.describeAutoScalingGroups(request);
View Full Code Here

Examples of com.amazonaws.services.autoscaling.AmazonAutoScalingClient.describeAutoScalingGroups()

        DescribeAutoScalingGroupsResult result = asgClient.describeAutoScalingGroups(request);

        asgs.addAll(result.getAutoScalingGroups());
        while (result.getNextToken() != null) {
            request.setNextToken(result.getNextToken());
            result = asgClient.describeAutoScalingGroups(request);
            asgs.addAll(result.getAutoScalingGroups());
        }

        LOGGER.info(String.format("Got %d auto-scaling groups in region %s.", asgs.size(), region));
        return asgs;
View Full Code Here

Examples of com.netflix.simianarmy.client.aws.AWSClient.describeAutoScalingGroups()

                "2012-12-03T23:00:03");
    }

    private AWSClient createMockAWSClient(List<AutoScalingGroup> asgList, String... asgNames) {
        AWSClient awsMock = mock(AWSClient.class);
        when(awsMock.describeAutoScalingGroups(asgNames)).thenReturn(asgList);
        when(awsMock.region()).thenReturn("us-east-1");
        return awsMock;
    }

    private List<AutoScalingGroup> createASGList() {
View Full Code Here

Examples of com.netflix.simianarmy.client.aws.AWSClient.describeAutoScalingGroups()

    }

    private AWSClient createMockAWSClient(List<AutoScalingGroup> asgList,
                                          List<LaunchConfiguration> lcList, String... lcNames) {
        AWSClient awsMock = mock(AWSClient.class);
        when(awsMock.describeAutoScalingGroups()).thenReturn(asgList);
        when(awsMock.describeLaunchConfigurations(lcNames)).thenReturn(lcList);
        when(awsMock.region()).thenReturn("us-east-1");
        return awsMock;
    }
View Full Code Here

Examples of com.netflix.simianarmy.client.aws.AWSClient.describeAutoScalingGroups()

        List<Resource> resources = Lists.newArrayList();

        AWSClient awsClient = getAWSClient();

        Set<String> usedLCs = Sets.newHashSet();
        for (AutoScalingGroup asg : awsClient.describeAutoScalingGroups()) {
            usedLCs.add(asg.getLaunchConfigurationName());
        }

        for (LaunchConfiguration launchConfiguration : awsClient.describeLaunchConfigurations(launchConfigNames)) {
            String lcName = launchConfiguration.getLaunchConfigurationName();
View Full Code Here

Examples of com.netflix.simianarmy.client.aws.AWSClient.describeAutoScalingGroups()

        for (LaunchConfiguration lc : launchConfigurations) {
            nameToLaunchConfig.put(lc.getLaunchConfigurationName(), lc);
        }

        List<Resource> resources = new LinkedList<Resource>();
        for (AutoScalingGroup asg : awsClient.describeAutoScalingGroups(asgNames)) {
            Resource asgResource = new AWSResource().withId(asg.getAutoScalingGroupName())
                    .withResourceType(AWSResourceType.ASG).withRegion(awsClient.region())
                    .withLaunchTime(asg.getCreatedTime());
            for (TagDescription tag : asg.getTags()) {
                asgResource.setTag(tag.getKey(), tag.getValue());
View Full Code Here

Examples of com.netflix.simianarmy.client.aws.AWSClient.describeAutoScalingGroups()

        for (Map.Entry<String, AWSClient> entry : regionToAwsClient.entrySet()) {
            String region = entry.getKey();
            AWSClient awsClient = entry.getValue();
            Set<String> asgInstances = Sets.newHashSet();
            LOGGER.info(String.format("Crawling clusters in region %s", region));
            for (AutoScalingGroup asg : awsClient.describeAutoScalingGroups(clusterNames)) {
                List<String> instances = Lists.newArrayList();
                for (Instance instance : asg.getInstances()) {
                    instances.add(instance.getInstanceId());
                    asgInstances.add(instance.getInstanceId());
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.