Package org.jclouds.compute.extensions

Examples of org.jclouds.compute.extensions.SecurityGroupExtension


              .put(listNetworks, listNetworksResponse)
              .put(getZone, getZoneResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .build();

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

      Set<SecurityGroup> groups = extension.listSecurityGroups();
      assertEquals(groups.size(), 5);
   }
View Full Code Here


              .put(listNetworks, listNetworksResponse)
              .put(getZone, getZoneResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .build();

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

      Set<SecurityGroup> groups = extension.listSecurityGroupsForNode("some-node");
      assertEquals(groups.size(), 5);
   }
View Full Code Here

              .put(listNetworks, listNetworksResponse)
              .put(getZone, getZoneResponse)
              .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(getZoneWithSecurityGroups, getZoneWithSecurityGroupsResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .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(getZone, getZoneResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .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

              .put(listNetworks, listNetworksResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .put(deleteSecurityGroup, deleteSecurityGroupResponse)
              .build();

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

      assertTrue(extension.removeSecurityGroup("13"), "Did not remove security group");
   }
View Full Code Here

              .put(listAccounts, listAccountsResponse)
              .put(listNetworks, listNetworksResponse)
              .put(listSecurityGroups, listSecurityGroupsResponse)
              .build();

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

      assertFalse(extension.removeSecurityGroup("14"), "Should not have found security group to remove");
   }
View Full Code Here

      HttpResponse getWithRuleResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/getsecuritygroupresponse_extension_byid_with_cidr.json"))
              .build();

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

      IpPermission.Builder builder = IpPermission.builder();

      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());
View Full Code Here

      HttpResponse getWithRuleResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/getsecuritygroupresponse_extension_byid_with_cidr.json"))
              .build();

      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());
View Full Code Here

      HttpResponse getWithRuleResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/getsecuritygroupresponse_extension_byid_with_group.json"))
              .build();

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

      IpPermission.Builder builder = IpPermission.builder();

      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());
View Full Code Here

TOP

Related Classes of org.jclouds.compute.extensions.SecurityGroupExtension

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.