Package org.jclouds.compute.extensions

Examples of org.jclouds.compute.extensions.SecurityGroupExtension


      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();

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


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

      SecurityGroupExtension extension = orderedRequestsSendResponses(
              ImmutableList.of(getWithRule, revokeRule, queryAsyncJobResultAuthorizeIngress, getWithRule),
              ImmutableList.of(getWithRuleResponse, revokeRuleResponse,
                      queryAsyncJobResultAuthorizeIngressResponse, getEmptyResponse)
      ).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.removeIpPermission(perm, origGroup);

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

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

      SecurityGroupExtension extension = orderedRequestsSendResponses(
              ImmutableList.of(getWithRule, revokeRule, queryAsyncJobResultAuthorizeIngress, getWithRule),
              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

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

      SecurityGroupExtension extension = orderedRequestsSendResponses(
              ImmutableList.of(getWithRule, revokeRule, queryAsyncJobResultAuthorizeIngress, getWithRule),
              ImmutableList.of(getWithRuleResponse, revokeRuleResponse,
                      queryAsyncJobResultAuthorizeIngressResponse, getEmptyResponse)
      ).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.removeIpPermission(perm, origGroup);

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

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

      SecurityGroupExtension extension = orderedRequestsSendResponses(
              ImmutableList.of(getWithRule, revokeRule, queryAsyncJobResultAuthorizeIngress, getWithRule),
              ImmutableList.of(getWithRuleResponse, revokeRuleResponse,
                      queryAsyncJobResultAuthorizeIngressResponse, getEmptyResponse)
      ).getSecurityGroupExtension().get();

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

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

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

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

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

      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
      requestResponseMap.put(createSecurityGroupRequest, createSecurityGroupResponse);

      requestResponseMap.put(authorizeSecurityGroupIngressRequestRange, authorizeSecurityGroupIngressResponse);

      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(IpProtocol.TCP,
                                                         22,
                                                         40,
                                                         emptyMultimap(),
                                                         ImmutableSet.of("0.0.0.0/0"),
                                                         emptyStringSet(),
View Full Code Here

      builder.toPort(40);
      builder.tenantIdGroupNamePair("993194456877", "sg-3c6ef654");

      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());
      groupBuilder.ownerId("993194456877");
     
      SecurityGroup origGroup = groupBuilder.build();

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

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

      IpPermission newPerm = Iterables.getOnlyElement(newGroup.getIpPermissions());
View Full Code Here

      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
      requestResponseMap.put(createSecurityGroupRequest, createSecurityGroupResponse);

      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroupTenant, authorizeSecurityGroupIngressResponse);

      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.ownerId("993194456877");
      groupBuilder.location(new LocationBuilder()
                            .scope(LocationScope.REGION)
                            .id(region)
                            .description("region")
                            .build());
     
      SecurityGroup origGroup = groupBuilder.build();

      ImmutableMultimap.Builder<String, String> permBuilder = ImmutableMultimap.builder();
      permBuilder.put(origGroup.getOwnerId(), origGroup.getId());
     
      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
                                                         22,
                                                         40,
                                                         permBuilder.build(),
                                                         emptyStringSet(),
                                                         emptyStringSet(),
View Full Code Here

      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, authorizeSecurityGroupIngressResponse);
      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);


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

      SecurityGroup group = extension.createSecurityGroup("some-group", new LocationBuilder()
              .scope(LocationScope.REGION)
              .id(region)
              .description("region")
              .build());
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.