Package com.amazonaws.services.ec2.model

Examples of com.amazonaws.services.ec2.model.InstanceExportDetails


      }

      // Request -> Query string marshalling for RequestSpotInstancesRequest is a little tricky since
      // the query string params follow a different form than the XML responses, so we manually set the parameters here.
      else if (originalRequest instanceof RequestSpotInstancesRequest) {
          RequestSpotInstancesRequest requestSpotInstancesRequest = (RequestSpotInstancesRequest)originalRequest;
          int count = 1;
          for (GroupIdentifier group : requestSpotInstancesRequest.getLaunchSpecification().getAllSecurityGroups()) {
              if (group.getGroupId() != null) {
                  request.addParameter("LaunchSpecification.SecurityGroupId." + count++, group.getGroupId());
              }
          }
View Full Code Here


        for (SpotInstanceRequest spotInstanceRequest : result.getSpotInstanceRequests()) {
          LaunchSpecification launchSpecification = spotInstanceRequest.getLaunchSpecification();
          populateLaunchSpecificationSecurityGroupNames(launchSpecification);
        }
      } else if (response instanceof RequestSpotInstancesResult) {
        RequestSpotInstancesResult result = (RequestSpotInstancesResult)response;
        for (SpotInstanceRequest spotInstanceRequest : result.getSpotInstanceRequests()) {
          LaunchSpecification launchSpecification = spotInstanceRequest.getLaunchSpecification();
          populateLaunchSpecificationSecurityGroupNames(launchSpecification);
        }
      } else if (response instanceof DescribeInstancesResult) {
        DescribeInstancesResult result = (DescribeInstancesResult)response;
        for (Reservation reservation : result.getReservations()) {
          populateReservationSecurityGroupNames(reservation);
        }
      } else if (response instanceof RunInstancesResult) {
        RunInstancesResult result = (RunInstancesResult)response;
        populateReservationSecurityGroupNames(result.getReservation());
      }
  }
View Full Code Here

  public static List<Instance> loadInstances() {
    List<Instance> resultList = new ArrayList<Instance>();
    DescribeInstancesResult describeInstancesResult = getEC2Client().describeInstances();
    List<Reservation> reservations = describeInstancesResult.getReservations();
    for (Iterator<Reservation> iterator = reservations.iterator(); iterator.hasNext();) {
      Reservation reservation = iterator.next();
      for (Instance instance : reservation.getInstances()) {
        resultList.add(instance);
      }
    }
    return resultList;
  }
View Full Code Here

   * @return list of newly launched instances
   */
  public static List<Instance> launchInstance(String AMI_ID, String type, Integer number) {
    List<Instance> resultList = new ArrayList<Instance>();

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

   * @return list of newly launched instances
   */
  public static List<Instance> launchInstance(String AMI_ID, String type, Integer number, String keyname) {
    List<Instance> resultList = new ArrayList<Instance>();

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);
    request.setKeyName(keyname);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

  }
 

  private List<Instance> startInstances(AmazonEC2Client ec2, String AMI_ID, String INS_TYPE, NotificationService notifier) throws AmazonServiceException {
    // start only 1 instance
    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, 1, 1);
    request.setKeyName(KEY_PAIR_NAME);
    request.setInstanceType(INS_TYPE);

    RunInstancesResult result = ec2.runInstances(request);

    List<Instance> instances = result.getReservation().getInstances();
View Full Code Here

    List<Instance> resultList = new ArrayList<Instance>();

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);
    request.setKeyName(keyname);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

    // start only 1 instance
    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, 1, 1);
    request.setKeyName(KEY_PAIR_NAME);
    request.setInstanceType(INS_TYPE);

    RunInstancesResult result = ec2.runInstances(request);

    List<Instance> instances = result.getReservation().getInstances();

    while (!allInstancesStateEqual(instances, InstanceStateName.Running)) {

      // instance status should not be Terminated
      if (anyInstancesStateEqual(instances, InstanceStateName.Terminated)) {
View Full Code Here

        DescribeInstancesResult result = (DescribeInstancesResult)response;
        for (Reservation reservation : result.getReservations()) {
          populateReservationSecurityGroupNames(reservation);
        }
      } else if (response instanceof RunInstancesResult) {
        RunInstancesResult result = (RunInstancesResult)response;
        populateReservationSecurityGroupNames(result.getReservation());
      }
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.ec2.model.InstanceExportDetails

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.