Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.SecurityGroup


         .ingressRules(ImmutableSet.of(ruleToConvert))
         .build();

      CloudStackSecurityGroupToSecurityGroup parser = createGroupParser();

      SecurityGroup group = parser.apply(origGroup);
     
      assertEquals(group.getId(), origGroup.getId());
      assertEquals(group.getProviderId(), origGroup.getId());
      assertEquals(group.getName(), origGroup.getName());
      assertEquals(group.getOwnerId(), origGroup.getAccount());
      assertEquals(group.getIpPermissions(), ImmutableSet.copyOf(transform(origGroup.getIngressRules(), ruleConverter)));
   }
View Full Code Here


              .put(listSecurityGroups, listSecurityGroupsResponse)
              .build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap).getSecurityGroupExtension().get();

      SecurityGroup group = extension.getSecurityGroupById("13");
      assertEquals(group.getId(), "13");
      assertEquals(group.getIpPermissions().size(), 2);
   }
View Full Code Here

              .put(createSecurityGroup, createSecurityGroupResponse)
              .build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap).getSecurityGroupExtension().get();

      SecurityGroup group = extension.createSecurityGroup("test", ZoneToLocationTest.two);
      assertEquals(group.getId(), "30");
      assertEquals(group.getIpPermissions().size(), 0);
   }
View Full Code Here

              .put(createSecurityGroup, createSecurityGroupResponse)
              .build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap).getSecurityGroupExtension().get();

      SecurityGroup group = extension.createSecurityGroup("test", ZoneToLocationTest.one);
      assertEquals(group.getId(), "30");
      assertEquals(group.getIpPermissions().size(), 0);
   }
View Full Code Here

      builder.toPort(11);
      builder.cidrBlock("1.1.1.1/24");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

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

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

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

      assertNotNull(newPerm);
      assertEquals(newPerm.getIpProtocol(), IpProtocol.UDP);
      assertEquals(newPerm.getFromPort(), 11);
      assertEquals(newPerm.getToPort(), 11);
View Full Code Here

      SecurityGroupExtension extension = orderedRequestsSendResponses(
              ImmutableList.of(addRule, queryAsyncJobResultAuthorizeIngress, getWithRule),
              ImmutableList.of(addRuleResponse, queryAsyncJobResultAuthorizeIngressResponse, getWithRuleResponse)
      ).getSecurityGroupExtension().get();

      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.UDP, 11, 11, emptyMultimap(),
              ImmutableSet.of("1.1.1.1/24"), emptyStringSet(), origGroup);

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

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

      assertNotNull(newPerm);
      assertEquals(newPerm.getIpProtocol(), IpProtocol.UDP);
      assertEquals(newPerm.getFromPort(), 11);
      assertEquals(newPerm.getToPort(), 11);
View Full Code Here

      builder.toPort(22);
      builder.tenantIdGroupNamePair("adrian", "adriancole");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

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

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

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

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

      ).getSecurityGroupExtension().get();

      ImmutableMultimap.Builder<String, String> permBuilder = ImmutableMultimap.builder();
      permBuilder.put("adrian", "adriancole");

      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP, 22, 22,
              permBuilder.build(), emptyStringSet(), emptyStringSet(), origGroup);

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

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

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

      builder.toPort(11);
      builder.cidrBlock("1.1.1.1/24");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

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

      assertEquals(newGroup.getIpPermissions().size(), 0);
   }
View Full Code Here

              ImmutableList.of(getWithRuleResponse, revokeRuleResponse,
                      queryAsyncJobResultAuthorizeIngressResponse, getEmptyResponse)
      ).getSecurityGroupExtension().get();


      SecurityGroup origGroup = new SecurityGroupBuilder().id("13").build();

      SecurityGroup newGroup = extension.removeIpPermission(IpProtocol.UDP, 11, 11, emptyMultimap(),
              ImmutableSet.of("1.1.1.1/24"), emptyStringSet(), origGroup);

      assertEquals(newGroup.getIpPermissions().size(), 0);
   }
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.