Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.SecurityGroup


      String id = groupIdProvider.get() + "";
      builder.ids(id);
      builder.name(name);
      builder.location(location);

      SecurityGroup group = builder.build();

      groups.put(group.getId(), group);

      return group;
   }
View Full Code Here


   public SecurityGroup addIpPermission(IpPermission ipPermission, SecurityGroup group) {
      SecurityGroupBuilder builder = SecurityGroupBuilder.fromSecurityGroup(checkNotNull(group, "group"));

      builder.ipPermission(checkNotNull(ipPermission, "ipPermission"));

      SecurityGroup newGroup = builder.build();

      if (groups.containsKey(newGroup.getId())) {
         groups.remove(newGroup.getId());
      }

      groups.put(newGroup.getId(), newGroup);

      return newGroup;
   }
View Full Code Here

      SecurityGroupBuilder builder = SecurityGroupBuilder.fromSecurityGroup(checkNotNull(group, "group"));

      builder.ipPermission(perm);

      SecurityGroup newGroup = builder.build();

      if (groups.containsKey(newGroup.getId())) {
         groups.remove(newGroup.getId());
      }

      groups.put(newGroup.getId(), newGroup);

      return newGroup;
   }
View Full Code Here

      builder.ipPermissions();

      builder.ipPermissions(filter(group.getIpPermissions(), not(equalTo(ipPermission))));
                           
      SecurityGroup newGroup = builder.build();

      if (groups.containsKey(newGroup.getId())) {
         groups.remove(newGroup.getId());
      }

      groups.put(newGroup.getId(), newGroup);

      return newGroup;
   }
View Full Code Here

      builder.ipPermissions();

      builder.ipPermissions(filter(group.getIpPermissions(), not(equalTo(perm))));
     
      SecurityGroup newGroup = builder.build();

      if (groups.containsKey(newGroup.getId())) {
         groups.remove(newGroup.getId());
      }

      groups.put(newGroup.getId(), newGroup);

      return newGroup;
   }
View Full Code Here

         .ipPermission(authorization)
         .build();

      AWSEC2SecurityGroupToSecurityGroup parser = createGroupParser(ImmutableSet.of(provider));

      SecurityGroup group = parser.apply(origGroup);
     
      assertEquals(group.getLocation(), provider);
      assertEquals(group.getId(), provider.getId() + "/" + origGroup.getId());
      assertEquals(group.getProviderId(), origGroup.getId());
      assertEquals(group.getName(), origGroup.getName());
      assertEquals(group.getIpPermissions(), (Set<IpPermission>)origGroup);
      assertEquals(group.getOwnerId(), origGroup.getOwnerId());
   }
View Full Code Here

                            .scope(LocationScope.REGION)
                            .id(region)
                            .description("region")
                            .build());
     
      SecurityGroup origGroup = groupBuilder.build();

      SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);

      assertEquals(1, newGroup.getIpPermissions().size());

      IpPermission newPerm = Iterables.getOnlyElement(newGroup.getIpPermissions());

      assertNotNull(newPerm);
      assertEquals(IpProtocol.TCP, newPerm.getIpProtocol());
      assertEquals(22, newPerm.getFromPort());
      assertEquals(40, newPerm.getToPort());
View Full Code Here

                            .scope(LocationScope.REGION)
                            .id(region)
                            .description("region")
                            .build());
     
      SecurityGroup origGroup = groupBuilder.build();

      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
                                                         22,
                                                         40,
                                                         emptyMultimap(),
                                                         ImmutableSet.of("0.0.0.0/0"),
                                                         emptyStringSet(),
                                                         origGroup);

      assertEquals(1, newGroup.getIpPermissions().size());

      IpPermission newPerm = Iterables.getOnlyElement(newGroup.getIpPermissions());

      assertNotNull(newPerm);
      assertEquals(IpProtocol.TCP, newPerm.getIpProtocol());
      assertEquals(22, newPerm.getFromPort());
      assertEquals(40, newPerm.getToPort());
View Full Code Here

                            .id(region)
                            .description("region")
                            .build());
      groupBuilder.ownerId("993194456877");
     
      SecurityGroup origGroup = groupBuilder.build();

      SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);

      assertEquals(1, newGroup.getIpPermissions().size());

      IpPermission newPerm = Iterables.getOnlyElement(newGroup.getIpPermissions());

      assertNotNull(newPerm);
      assertEquals(IpProtocol.TCP, newPerm.getIpProtocol());
      assertEquals(22, newPerm.getFromPort());
      assertEquals(40, newPerm.getToPort());
View Full Code Here

                            .scope(LocationScope.REGION)
                            .id(region)
                            .description("region")
                            .build());
     
      SecurityGroup origGroup = groupBuilder.build();

      ImmutableMultimap.Builder<String, String> permBuilder = ImmutableMultimap.builder();
      permBuilder.put(origGroup.getOwnerId(), origGroup.getId());
     
      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
                                                         22,
                                                         40,
                                                         permBuilder.build(),
                                                         emptyStringSet(),
                                                         emptyStringSet(),
                                                         origGroup);

      assertEquals(1, newGroup.getIpPermissions().size());

      IpPermission newPerm = Iterables.getOnlyElement(newGroup.getIpPermissions());

      assertNotNull(newPerm);
      assertEquals(IpProtocol.TCP, newPerm.getIpProtocol());
      assertEquals(22, newPerm.getFromPort());
      assertEquals(40, newPerm.getToPort());
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.SecurityGroup

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.