Package org.jclouds.ec2.domain

Examples of org.jclouds.ec2.domain.Permission


   public void testApplyInputStream() {

      InputStream is = getClass().getResourceAsStream(
               "/describe_image_attribute_launchPermission.xml");

      Permission expected = new Permission(Sets.newHashSet("495219933132"), Sets.newHashSet("all"));

      Permission result = factory.create(injector.getInstance(PermissionHandler.class)).parse(is);

      assertEquals(result, expected);
   }
View Full Code Here


   private StringBuilder currentText = new StringBuilder();
   private Set<String> userIds = Sets.newHashSet();
   private Set<String> groups = Sets.newHashSet();

   public Permission getResult() {
      return new Permission(userIds, groups);
   }
View Full Code Here

   public void testApplyInputStream() {

      InputStream is = getClass().getResourceAsStream(
               "/describe_image_attribute_launchPermission.xml");

      Permission expected = new Permission(Sets.newHashSet("495219933132"), Sets.newHashSet("all"));

      Permission result = factory.create(injector.getInstance(PermissionHandler.class)).parse(is);

      assertEquals(result, expected);
   }
View Full Code Here

   private StringBuilder currentText = new StringBuilder();
   private Set<String> userIds = Sets.newHashSet();
   private Set<String> groups = Sets.newHashSet();

   public Permission getResult() {
      return new Permission(userIds, groups);
   }
View Full Code Here

   private StringBuilder currentText = new StringBuilder();
   private Set<String> userIds = Sets.newHashSet();
   private Set<String> groups = Sets.newHashSet();

   public Permission getResult() {
      return new Permission(userIds, groups);
   }
View Full Code Here

   public void testApplyInputStream() {

      InputStream is = getClass().getResourceAsStream(
               "/describe_image_attribute_launchPermission.xml");

      Permission expected = new Permission(Sets.newHashSet("495219933132"), Sets.newHashSet("all"));

      Permission result = factory.create(injector.getInstance(PermissionHandler.class)).parse(is);

      assertEquals(result, expected);
   }
View Full Code Here

      checkNotNull(id, "id");
      String[] parts = AWSUtils.parseHandle(id);
      String region = parts[0];
      String instanceId = parts[1];
      try {
         RunningInstance runningInstance = getRunningInstanceInRegion(region, instanceId);
         return runningInstanceToNodeMetadata.apply(runningInstance);
      } catch (NoSuchElementException e) {
         return null;
      }
   }
View Full Code Here

   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.getElasticIPAddressServices().allocateAddressInRegion(id.getRegion());
            // block until instance is running
            logger.debug(">> awaiting status running instance(%s)", id);
View Full Code Here

   void testDescribe() {
      for (String region : ec2Client.getConfiguredRegions()) {
         Set<SecurityGroup> allResults = client.describeSecurityGroupsInRegion(region);
         assertNotNull(allResults);
         if (allResults.size() >= 1) {
            final SecurityGroup group = getLast(allResults);
            // in case there are multiple groups with the same name, which is the case with VPC
            ImmutableSet<SecurityGroup> expected = FluentIterable.from(allResults)
                  .filter(new Predicate<SecurityGroup>() {
                     @Override
                     public boolean apply(SecurityGroup in) {
                        return group.getName().equals(in.getName());
                     }
                  }).toSet();
            ImmutableSet<SecurityGroup> result = ImmutableSet.copyOf(client.describeSecurityGroupsInRegion(region,
                  group.getName()));
            // the above command has a chance of returning less groups than the original
            assertTrue(expected.containsAll(result));
         }
      }
   }
View Full Code Here

   private void verifySecurityGroup(String groupName, String description) {
      Set<SecurityGroup> oneResult = client.describeSecurityGroupsInRegion(null, groupName);
      assertNotNull(oneResult);
      assertEquals(oneResult.size(), 1);
      SecurityGroup listPair = oneResult.iterator().next();
      assertEquals(listPair.getName(), groupName);
      assertEquals(listPair.getDescription(), description);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.ec2.domain.Permission

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.