Package org.jclouds.net.domain

Examples of org.jclouds.net.domain.IpPermission$Builder


      }
      if (Iterables.size(groupIds) > 0) {
         ipBuilder.groupIds(groupIds);
      }

      IpPermission perm = ipBuilder.build();

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

      builder.ipPermissions();
View Full Code Here


      builder.ipProtocol(IpProtocol.UDP);
      builder.fromPort(11);
      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);
      assertEquals(newPerm.getCidrBlocks().size(), 1);
      assertTrue(newPerm.getCidrBlocks().contains("1.1.1.1/24"));
   }
View Full Code Here

      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);
      assertEquals(newPerm.getCidrBlocks().size(), 1);
      assertTrue(newPerm.getCidrBlocks().contains("1.1.1.1/24"));
   }
View Full Code Here

      builder.ipProtocol(IpProtocol.TCP);
      builder.fromPort(22);
      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);
      assertEquals(newPerm.getCidrBlocks().size(), 0);
      assertEquals(newPerm.getTenantIdGroupNamePairs().size(), 1);
      assertTrue(newPerm.getTenantIdGroupNamePairs().containsEntry("adrian", "adriancole"));
   }
View Full Code Here

      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);
      assertEquals(newPerm.getCidrBlocks().size(), 0);
      assertEquals(newPerm.getTenantIdGroupNamePairs().size(), 1);
      assertTrue(newPerm.getTenantIdGroupNamePairs().containsEntry("adrian", "adriancole"));
   }
View Full Code Here

      builder.ipProtocol(IpProtocol.UDP);
      builder.fromPort(11);
      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);
View Full Code Here

      builder.ipProtocol(IpProtocol.TCP);
      builder.fromPort(22);
      builder.toPort(22);
      builder.tenantIdGroupNamePair("adrian", "adriancole");

      IpPermission perm = builder.build();

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

      SecurityGroup newGroup = extension.removeIpPermission(perm, origGroup);
View Full Code Here

         .CIDR("0.0.0.0/0")
         .build();

      IngressRuleToIpPermission converter = new IngressRuleToIpPermission();

      IpPermission convertedPerm = converter.apply(ruleToConvert);

      assertEquals(convertedPerm.getIpProtocol(), IpProtocol.fromValue(ruleToConvert.getProtocol()));
      assertEquals(convertedPerm.getFromPort(), ruleToConvert.getStartPort());
      assertEquals(convertedPerm.getToPort(), ruleToConvert.getEndPort());
      assertEquals(convertedPerm.getCidrBlocks(), ImmutableSet.of("0.0.0.0/0"));
      assertEquals(convertedPerm.getTenantIdGroupNamePairs().size(), 1);
      assertEquals(convertedPerm.getGroupIds().size(), 0);
   }
View Full Code Here

      builder.ipProtocol(IpProtocol.TCP);
      builder.fromPort(22);
      builder.toPort(40);
      builder.cidrBlock("0.0.0.0/0");

      IpPermission perm = builder.build();

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

      SecurityGroupBuilder groupBuilder = new SecurityGroupBuilder();
      groupBuilder.id("us-east-1/sg-3c6ef654");
      groupBuilder.providerId("sg-3c6ef654");
      groupBuilder.name("jclouds#some-group");
      groupBuilder.location(new LocationBuilder()
                            .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());
      assertEquals(1, newPerm.getCidrBlocks().size());
      assertTrue(newPerm.getCidrBlocks().contains("0.0.0.0/0"));
   }
View Full Code Here

                                                         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());
      assertEquals(1, newPerm.getCidrBlocks().size());
      assertTrue(newPerm.getCidrBlocks().contains("0.0.0.0/0"));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.net.domain.IpPermission$Builder

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.