Package com.amazonaws.services.autoscaling.model

Examples of com.amazonaws.services.autoscaling.model.AutoScalingGroup


        asgList.add(mkASG("asg2"));
        return asgList;
    }

    private AutoScalingGroup mkASG(String asgName) {
        AutoScalingGroup asg = new AutoScalingGroup().withAutoScalingGroupName(asgName);
        // set the suspended processes
        List<SuspendedProcess> sps = new ArrayList<SuspendedProcess>();
        sps.add(new SuspendedProcess().withProcessName("Launch")
                .withSuspensionReason("User suspended at 2012-12-02T23:00:03"));
        sps.add(new SuspendedProcess().withProcessName("AddToLoadBalancer")
                .withSuspensionReason("User suspended at 2012-12-03T23:00:03"));
        asg.setSuspendedProcesses(sps);
        return asg;
    }
View Full Code Here


        }
        return asgList;
    }

    private AutoScalingGroup mkASG(String asgName, String lcName) {
        return new AutoScalingGroup().withAutoScalingGroupName(asgName).withLaunchConfigurationName(lcName);
    }
View Full Code Here

    /**
     * Add the given instance to the named group.
     */
    public void addInstance(final String instanceId, final String groupName) {
        if (!map.containsKey(groupName)) {
            final AutoScalingGroup asg = new AutoScalingGroup();
            asg.setAutoScalingGroupName(groupName);
            map.put(groupName, asg);
        }

        final AutoScalingGroup asg = map.get(groupName);
        Instance instance = new Instance();
        instance.setInstanceId(instanceId);

        asg.getInstances().add(instance);
    }
View Full Code Here

        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);
            ureq.setDesiredCapacity(asg.getMinSize() + 1);
            client.updateAutoScalingGroup(ureq);
        }
        finally
        {
            if (client != null)
View Full Code Here

      // If the desiredCapacity of the Auto Scaling Group is greater than
      // the actual number of instances in the group, we should return
      // dummy Machines in REQUESTED state for the missing instances. This
      // prevents the BaseCloudAdapter from regarding the scaling group
      // too small and ordering new machines via startMachines.
      AutoScalingGroup autoScalingGroup = this.client
          .getAutoScalingGroup(getScalingGroupName());
      int desiredCapacity = autoScalingGroup.getDesiredCapacity();
      int actualCapacity = autoScalingGroup.getInstances().size();
      LOG.debug("desiredCapacity: {}, actual capacity: {}",
          desiredCapacity, actualCapacity);
      List<Machine> requestedInstances = Lists.newArrayList();
      int missingInstances = desiredCapacity - actualCapacity;
      if (missingInstances > 0) {
View Full Code Here

    checkState(isConfigured(), "attempt to use unconfigured ScalingGroup");

    List<Machine> startedMachines = Lists.newArrayList();
    try {
      // get current group membership: {G}
      AutoScalingGroup group = this.client
          .getAutoScalingGroup(getScalingGroupName());
      List<Instance> initialGroup = this.client
          .getAutoScalingGroupMembers(getScalingGroupName());
      LOG.debug("initial group: {}", initialGroup);
      // increase desiredCapacity and wait for group to reach new size
      int newDesiredSize = group.getDesiredCapacity() + count;
      LOG.info("starting {} new instance(s) in scaling group '{}': "
          + "changing desired capacity from {} to {}", count,
          getScalingGroupName(), group.getDesiredCapacity(),
          newDesiredSize);
      this.client.setDesiredSize(getScalingGroupName(), newDesiredSize);

      // get new group membership: {N}
      List<Instance> expandedGroup = this.client
View Full Code Here

     * @param asgName
     *            - The name of the ASG for which the status needs to be queried
     * @return - true if the ASG is disabled, false otherwise
     */
    private boolean isAddToLoadBalancerSuspended(String asgName) {
        AutoScalingGroup asg = retrieveAutoScalingGroup(asgName);
        if (asg == null) {
            logger.warn(
                    "The ASG information for {} could not be found. So returning false.",
                    asgName);
            return false;
View Full Code Here

TOP

Related Classes of com.amazonaws.services.autoscaling.model.AutoScalingGroup

Copyright © 2018 www.massapicom. 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.