Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.SecurityGroup


      builder.toPort(22);
      builder.groupId("admin/11111");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

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

      assertNotNull(newGroup);
   }
View Full Code Here


      SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
              extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
              ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
                      createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

      assertNotNull(origGroup);
      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
              22,
              22,
              emptyMultimap(),
              emptyStringSet(),
              ImmutableSet.of("admin/11111"),
View Full Code Here

    try {
      if (computeServiceContext.getComputeService().getSecurityGroupExtension().isPresent()) {
        SecurityGroupExtension securityGroupExtension = computeServiceContext.getComputeService().getSecurityGroupExtension().get();
        Instance instance = Iterables.getFirst(instances, null);
        if (instance != null) {
          SecurityGroup group = Iterables.find(securityGroupExtension.listSecurityGroupsForNode(instance.getNodeMetadata().getId()),
              new Predicate<SecurityGroup>() {
                @Override
                public boolean apply(SecurityGroup input) {
                  if (input.getName().contains(clusterSpec.getClusterName()) ||
                      input.getId().contains(clusterSpec.getClusterName())) {
View Full Code Here

      Network network = builder.build();

      NetworkToSecurityGroup netToSg = new NetworkToSecurityGroup(fwToPerm, api, projectSupplier);

      SecurityGroup group = netToSg.apply(network);

      assertEquals(group.getId(), "jclouds-test");
      assertEquals(group.getUri(), URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test"));
      assertEquals(group.getIpPermissions().size(), 3);
      assertTrue(Iterables.any(group.getIpPermissions(), Predicates.and(hasProtocol(IpProtocol.TCP),
              hasStartAndEndPort(1, 10))), "No permission found for TCP, ports 1-10");
      assertTrue(Iterables.any(group.getIpPermissions(), Predicates.and(hasProtocol(IpProtocol.TCP),
              hasStartAndEndPort(33, 33))), "No permission found for TCP, port 33");
      assertTrue(Iterables.any(group.getIpPermissions(), hasProtocol(IpProtocol.ICMP)),
              "No permission found for ICMP");
   }
View Full Code Here

      for (NetworkInterface nwInterface : instance.getNetworkInterfaces()) {
         String networkUrl = nwInterface.getNetwork().getPath();
         Network nw = api.getNetworkApiForProject(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));

         SecurityGroup grp = groupForTagsInNetwork(nw, instance.getTags().getItems());
         if (grp != null) {
            builder.add(grp);
         }
      }
View Full Code Here

      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

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.