コード例 #1
0
ファイル: AutoScaling.java プロジェクト: rajatdt/typica
  /**
   * Describes one or more auto scaling groups
   *
   * @param autoScalingGroupNames a auto scaling group name
   * @return autoScaling group descriptions
   * @throws AutoScalingException wraps checked exceptions
   */
  public List<AutoScalingGroup> describeAutoScalingGroups(List<String> autoScalingGroupNames)
      throws AutoScalingException {
    Map<String, String> params = new HashMap<String, String>();
    if (autoScalingGroupNames != null && autoScalingGroupNames.size() > 0) {
      int i = 0;
      for (String name : autoScalingGroupNames) {
        params.put("AutoScalingGroupNames.member." + (i + 1), name);
        i++;
      }
    }
    HttpGet method = new HttpGet();
    DescribeAutoScalingGroupsResponse response =
        makeRequestInt(
            method, "DescribeAutoScalingGroups", params, DescribeAutoScalingGroupsResponse.class);

    List<com.xerox.amazonws.typica.autoscale.jaxb.AutoScalingGroup> result =
        response.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMembers();
    List<AutoScalingGroup> ret = new ArrayList<AutoScalingGroup>();
    for (com.xerox.amazonws.typica.autoscale.jaxb.AutoScalingGroup group : result) {
      List<String> zones = new ArrayList<String>();
      for (String zone : group.getAvailabilityZones().getMembers()) {
        zones.add(zone);
      }
      AutoScalingGroup newGroup =
          new AutoScalingGroup(
              group.getAutoScalingGroupName(),
              group.getLaunchConfigurationName(),
              group.getMinSize().intValue(),
              group.getMaxSize().intValue(),
              group.getDesiredCapacity().intValue(),
              group.getCooldown().intValue(),
              zones,
              group.getCreatedTime().toGregorianCalendar());
      List<com.xerox.amazonws.typica.autoscale.jaxb.Instance> instList =
          group.getInstances().getMembers();
      for (com.xerox.amazonws.typica.autoscale.jaxb.Instance inst : instList) {
        newGroup.addInstance(inst.getInstanceId(), inst.getLifecycleState());
      }
      ret.add(newGroup);
    }
    return ret;
  }
コード例 #2
0
 @Override
 protected AutoScalingGroup exampleWithName(
     final OwnerFullName ownerFullName, final String name) {
   return AutoScalingGroup.named(ownerFullName, name);
 }
コード例 #3
0
 @Override
 protected AutoScalingGroup exampleWithUuid(final String uuid) {
   return AutoScalingGroup.withUuid(uuid);
 }
コード例 #4
0
 @Override
 protected AutoScalingGroup exampleWithOwner(final OwnerFullName ownerFullName) {
   return AutoScalingGroup.withOwner(ownerFullName);
 }