Package com.amazonaws.services.ec2.model.transform

Examples of com.amazonaws.services.ec2.model.transform.InstanceStaxUnmarshaller


  @Provides
  @Singleton
  @Named("beanstalk.env.id")
  public String getEnvId(@Named("aws.instance.id") String instanceId, AmazonEC2 ec2) {
    DescribeInstancesRequest request = new DescribeInstancesRequest()
        .withInstanceIds(instanceId)
        .withFilters(
            new Filter("instance-state-name").withValues("running"));

    for (Reservation r : ec2.describeInstances(request).getReservations()) {
View Full Code Here


  @Provides
  @Singleton
  @Named("beanstalk.env.name")
  public String getEnvName(@Named("aws.instance.id") String instanceId, AmazonEC2 ec2) {
    DescribeInstancesRequest request = new DescribeInstancesRequest()
        .withInstanceIds(instanceId)
        .withFilters(
            new Filter("instance-state-name").withValues("running"));

    for (Reservation r : ec2.describeInstances(request).getReservations()) {
View Full Code Here

    updateInstanceState(instanceId, "running");
  }

  private void getInstancesState()
  {
    DescribeInstancesResult describeInstancesResult = ec2Client.describeInstances();
    List<Reservation> reservations = describeInstancesResult.getReservations();
    for (Reservation reservation : reservations)
    {
      List<Instance> instances = reservation.getInstances();
      for (Instance instance : instances)
      {
View Full Code Here

    getInstancesState();
  }

  private List<String> initInstancesIds()
  {
    DescribeInstancesResult describeInstancesResult = ec2Client.describeInstances();
    List<Reservation> reservations = describeInstancesResult.getReservations();
    List<String> instancesIds = new ArrayList<String>();
    for (Reservation reservation : reservations)
    {
      List<Instance> instances = reservation.getInstances();
      for (Instance instance : instances)
View Full Code Here

   *
   * @return list of instances
   */
  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);
      }
View Full Code Here

        this.instance = startInstances(ec2client, ami_id, ins_type, invocationContext.getExecutionContext().getNotificationService()).get(0);
      else {

        // already running instance
        DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest();
        DescribeInstancesResult describeInstancesResult = ec2client.describeInstances(describeInstancesRequest.withInstanceIds(ins_id));

        if (describeInstancesResult.getReservations().size() == 0 || describeInstancesResult.getReservations().get(0).getInstances().size() == 0) {
          throw new GfacException("Instance not found:" + ins_id, FaultCode.InvalidRequest);
        }

        this.instance = describeInstancesResult.getReservations().get(0).getInstances().get(0);

        // check instance keypair
        if (this.instance.getKeyName() == null || !this.instance.getKeyName().equals(KEY_PAIR_NAME))
          throw new GfacException("Keypair for instance:" + ins_id + " is not valid", FaultCode.InvalidRequest);
      }
View Full Code Here

      }

      DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest();
      describeInstancesRequest.setInstanceIds(getInstanceIDs(instances));

      DescribeInstancesResult describeInstancesResult = ec2.describeInstances(describeInstancesRequest);
      instances = describeInstancesResult.getReservations().get(0).getInstances();
    }

    log.info("All instances is running");
    return instances;
  }
View Full Code Here

    }

    @Override public List<DiscoveryNode> buildDynamicNodes() {
        List<DiscoveryNode> discoNodes = Lists.newArrayList();

        DescribeInstancesResult descInstances = client.describeInstances(new DescribeInstancesRequest());

        logger.trace("building dynamic unicast discovery nodes...");
        for (Reservation reservation : descInstances.getReservations()) {
            if (!groups.isEmpty()) {
                // lets see if we can filter based on groups
                List<String> groupNames = reservation.getGroupNames();
                if (bindAnyGroup) {
                    if (Collections.disjoint(groups, groupNames)) {
View Full Code Here

    private Instance describeInstance(AmazonEC2Client ec2, String ec2InstanceId) {
        Instance ec2Instance = null;
        {
            DescribeInstancesRequest request = new DescribeInstancesRequest();
            request.setInstanceIds(Collections.singletonList(ec2InstanceId));
            DescribeInstancesResult response = ec2.describeInstances(request);

            List<Reservation> reservations = response.getReservations();
            for (Reservation reservation : reservations) {
                for (Instance i : reservation.getInstances()) {
                    if (ec2Instance != null) {
                        throw new IllegalStateException();
                    }
View Full Code Here

            System.out.println("You have access to " + availabilityZones.size() + " availability zones:");
            for (AvailabilityZone zone : availabilityZones) {
                System.out.println(" - " + zone.getZoneName() + " (" + zone.getRegionName() + ")");
            }

            DescribeInstancesResult describeInstancesResult = ec2.describeInstances();
            Set<Instance> instances = new HashSet<Instance>();
            for (Reservation reservation : describeInstancesResult.getReservations()) {
                instances.addAll(reservation.getInstances());
            }

            System.out.println("You have " + instances.size() + " Amazon EC2 instance(s) running.");
View Full Code Here

TOP

Related Classes of com.amazonaws.services.ec2.model.transform.InstanceStaxUnmarshaller

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.