Examples of RunningInstance


Examples of org.jclouds.ec2.domain.RunningInstance


      EC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse,
              filter, filterResponse);

      RunningInstance instance = getOnlyElement(getOnlyElement(apiWhenExist.getInstanceApi().get().describeInstancesInRegionWithFilter("us-east-1",
              ImmutableMultimap.<String, String>builder()
                      .put("key-name", "adriancole.ec21")
                      .build())));
      assertNotNull(instance, "Instance should not be null");

      Assert.assertEquals(instance.getId(), "i-0799056f");
   }
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

      Set<? extends Reservation<? extends RunningInstance>> response = client.describeInstancesInRegion("nova");
     
      assertEquals(response.size(), 3);

      Reservation<? extends RunningInstance> target = Iterables.get(response, 2);
      RunningInstance runningInstance = Iterables.getOnlyElement(target);
      BlockDevice bd = Iterables.getOnlyElement(runningInstance.getEbsBlockDevices().values());
     
      // this is a '-' in the nova_ec2_describe_instances.xml
      assertNull(bd.getAttachTime());

      // double-check the other fields
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

   // terminates the instance.
   private Snapshot createSnapshot() throws RunNodesException {

      String instanceId = null;
      try {
         RunningInstance instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().runInstancesInRegion(
               regionId, null, imageId, 1, 1)));
         instanceId = instance.getId();
        
         assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!");

         instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().describeInstancesInRegion(regionId,
               instanceId)));
         BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
         assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
         Snapshot snapshot = ec2Api.getElasticBlockStoreApi().get().createSnapshotInRegion(regionId,
               device.getVolumeId());
         snapshotsToDelete.add(snapshot.getId());
         return snapshot;
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

   private void blockUntilRunningAndAssignElasticIpsToInstancesOrPutIntoBadMap(Set<RunningInstance> input,
         Map<NodeMetadata, Exception> badNodes) {
      Map<RegionAndName, RunningInstance> instancesById = Maps.uniqueIndex(input, instanceToRegionAndName);
      for (Map.Entry<RegionAndName, RunningInstance> entry : instancesById.entrySet()) {
         RegionAndName id = entry.getKey();
         RunningInstance instance = entry.getValue();
         try {
            logger.debug("<< allocating elastic IP instance(%s)", id);
            String ip = client.getElasticIPAddressApi().get().allocateAddressInRegion(id.getRegion());
            // block until instance is running
            logger.debug(">> awaiting status running instance(%s)", id);
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

      checkNotNull(id, "id");
      String[] parts = AWSUtils.parseHandle(id);
      String region = parts[0];
      String instanceId = parts[1];
     
      RunningInstance instance = getOnlyElement(Iterables.concat(client.getInstanceApi().get().describeInstancesInRegion(region, instanceId)));

      if (instance == null) {
         return ImmutableSet.of();
      }
     
      Set<String> groupNames = instance.getGroupNames();
      Set<? extends org.jclouds.ec2.domain.SecurityGroup> rawGroups =
         client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, Iterables.toArray(groupNames, String.class));
     
      return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
   }
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

  private Map<String, String> getPrivateIpToPublicIP(List<RunningInstance> riList) {
    Map<String, String> privateIPMap = new HashMap<String, String>();
    Iterator<RunningInstance> runningInstanceIter = riList.iterator();
    while (runningInstanceIter.hasNext()) {
      RunningInstance ri = runningInstanceIter.next();
      privateIPMap.put(ri.getPrivateDnsName(), ri.getDnsName());
    }
    return privateIPMap;
  }
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

      try {
         if (command.equals("create")) {

            KeyPair pair = createKeyPair(client, name);

            RunningInstance instance = createSecurityGroupKeyPairAndInstance(client, name);

            System.out.printf("instance %s ready%n", instance.getId());
            System.out.printf("ip address: %s%n", instance.getIpAddress());
            System.out.printf("dns name: %s%n", instance.getDnsName());
            System.out.printf("login identity:%n%s%n", pair.getKeyMaterial());

         } else if (command.equals("destroy")) {
            destroySecurityGroupKeyPairAndInstance(client, name);
         } else {
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

            throws TimeoutException {
      // create a new security group
      createSecurityGroupAndAuthorizePorts(client, name);

      // create a new instance
      RunningInstance instance = runInstance(client, name, name);

      // await for the instance to start
      return blockUntilInstanceRunning(client, instance);
   }
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

   }

   @Test
   public void testPrivateIpAddressIncorrectlyInPublicAddressFieldGoesToPrivateAddressCollection() {
      RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
               .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").ipAddress("10.1.1.1").build();

      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
               .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
View Full Code Here

Examples of org.jclouds.ec2.domain.RunningInstance

               "us-east-1/image").providerId("id").build().toString());
   }

   @Test
   public void testPublicIpAddressIncorrectlyInPrivateAddressFieldGoesToPublicAddressCollection() {
      RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
               .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").privateIpAddress("1.1.1.1").build();

      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
               .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());
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.