Examples of SecurityGroup


Examples of com.amazonaws.services.ec2.model.SecurityGroup

    public void assertSecurityGroupExistsWithRules(String groupName, final Set<Rule> ingressRules) {
        DescribeSecurityGroupsResult result = client.describeSecurityGroups(
            new DescribeSecurityGroupsRequest().withGroupNames(groupName));

        assertThat(result.getSecurityGroups()).hasSize(1);
        SecurityGroup group = getOnlyElement(result.getSecurityGroups());

        assertThat(group.getIpPermissions()).hasSize(ingressRules.size());
        assertThat(ingressRules).containsAll(transform(group.getIpPermissions(),
            ConvertIpPermissionToRule.FUNCTION));
    }
View Full Code Here

Examples of com.cloud.network.security.SecurityGroup

        return response;
    }

    @Override
    public Long getSecurityGroupId(String groupName, long accountId) {
        SecurityGroup sg = ApiDBUtils.getSecurityGroup(groupName, accountId);
        if (sg == null) {
            return null;
        } else {
            return sg.getId();
        }
    }
View Full Code Here

Examples of com.getperka.flatpack.security.SecurityGroup

              .entrySet()) {
            // If no actions are granted, ignore the group
            if (entry.getValue().isEmpty()) {
              continue;
            }
            SecurityGroup group = entry.getKey();
            if (securityGroups.getGroupAll().equals(group)
              || securityGroups.getGroupReflexive().equals(group)
              || limitGroupNames.contains(group.getName())) {
              return true;
            }
          }
          return false;
        }
View Full Code Here

Examples of io.fathom.cloud.compute.api.os.model.SecurityGroup

    public SecurityGroupList list() throws CloudException {
        SecurityGroupList response = new SecurityGroupList();
        response.securityGroups = Lists.newArrayList();

        for (SecurityGroupData data : securityGroups.list(getProject())) {
            SecurityGroup model = toModel(data, true);
            response.securityGroups.add(model);
        }

        return response;
    }
View Full Code Here

Examples of org.jclouds.cloudstack.domain.SecurityGroup

      final CloudStackClient client = createMock(CloudStackClient.class);
      SecurityGroupClient secClient = createMock(SecurityGroupClient.class);
      ZoneClient zoneClient = createMock(ZoneClient.class);
      AsyncJobClient jobClient = createMock(AsyncJobClient.class);
     
      SecurityGroup group = createMock(SecurityGroup.class);
     
      Zone zone = createMock(Zone.class);

      expect(group.getIngressRules()).andReturn(ImmutableSet.<IngressRule> of());
      expect(group.getId()).andReturn("sec-1234").anyTimes();
      expect(zone.isSecurityGroupsEnabled()).andReturn(true);
     
      expect(client.getSecurityGroupClient()).andReturn(secClient)
         .anyTimes();
      expect(client.getZoneClient()).andReturn(zoneClient);
View Full Code Here

Examples of org.jclouds.compute.domain.SecurityGroup

      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

Examples of org.jclouds.ec2.domain.SecurityGroup

   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

Examples of org.jclouds.openstack.nova.v2_0.domain.SecurityGroup

   }

   public void createGetAndDeleteSecurityGroup() throws Exception {
      for (String zoneId : api.getConfiguredZones()) {
         SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
         SecurityGroup securityGroup = null;
         String id;
         try {
            securityGroup = securityGroupApi
                     .createWithDescription(SECURITY_GROUP_NAME, "test security group");
            assertNotNull(securityGroup);
            id = securityGroup.getId();
            SecurityGroup theGroup = securityGroupApi.get(id);
            assertNotNull(theGroup);
         } finally {
            if (securityGroup != null) {
               securityGroupApi.delete(securityGroup.getId());
            }
View Full Code Here

Examples of org.jclouds.rds.domain.SecurityGroup

public class GetSecurityGroupResponseTest extends BaseHandlerTest {

   public void test() {
      InputStream is = getClass().getResourceAsStream("/get_securitygroup.xml");

      SecurityGroup expected = expected();

      SecurityGroupHandler handler = injector.getInstance(SecurityGroupHandler.class);
      SecurityGroup result = factory.create(handler).parse(is);

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

Examples of org.olat.basesecurity.SecurityGroup

   * @param login
   * @return
   */
  public static final Identity createAndPersistIdentityAsUser(String login) {
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
    if (group == null) group = securityManager.createAndPersistNamedSecurityGroup(Constants.GROUP_OLATUSERS);
    User user = UserManager.getInstance().createUser("first" + login, "last" + login, login + "@" + maildomain);
    Identity identity = securityManager.createAndPersistIdentityAndUser(login, user, OLATAuthenticationController.PROVIDER_OLAT, login,
        Encoder.encrypt("A6B7C8"));
    securityManager.addIdentityToSecurityGroup(identity, group);
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.