Examples of FirewallOptions


Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      // need to create the network first
      assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
              (FIREWALL_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);

      FirewallOptions firewall = new FirewallOptions()
              .addAllowedRule(
                      Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
                              .addPort(22).build())
              .addSourceRange("10.0.0.0/8")
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

   }

   @Test(groups = "live", dependsOnMethods = "testInsertFirewall")
   public void testUpdateFirewall() {

      FirewallOptions firewall = new FirewallOptions()
              .name(FIREWALL_NAME)
              .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME))
              .addSourceRange("10.0.0.0/8")
              .addSourceTag("tag1")
              .addTargetTag("tag2")
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

   }

   @Test(groups = "live", dependsOnMethods = "testUpdateFirewall")
   public void testPatchFirewall() {

      FirewallOptions firewall = new FirewallOptions()
              .name(FIREWALL_NAME)
              .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME))
              .allowedRules(ImmutableSet.of(
                      Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

   }

   @Test(groups = "live", dependsOnMethods = "testPatchFirewall")
   public void testGetFirewall() {

      FirewallOptions patchedFirewall = new FirewallOptions()
              .name(FIREWALL_NAME)
              .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME))
              .allowedRules(ImmutableSet.of(
                      Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
              TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApiForProject("myproject");

      assertEquals(api.createInNetwork("myfw", URI.create("https://www.googleapis" +
              ".com/compute/v1/projects/myproject/global/networks/default"),
              new FirewallOptions()
                      .addAllowedRule(Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
                              .addPort(22)
                              .addPortRange(23, 24).build())
                      .addSourceTag("tag1")
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
              TOKEN_RESPONSE, update,
              updateFirewallResponse).getFirewallApiForProject("myproject");

      assertEquals(api.update("myfw",
              new FirewallOptions()
                      .name("myfw")
                      .network(URI.create("https://www.googleapis" +
                              ".com/compute/v1/projects/myproject/global/networks/default"))
                      .addAllowedRule(Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
              TOKEN_RESPONSE, update,
              updateFirewallResponse).getFirewallApiForProject("myproject");

      assertEquals(api.patch("myfw",
              new FirewallOptions()
                      .name("myfw")
                      .network(URI.create("https://www.googleapis" +
                              ".com/compute/v1/projects/myproject/global/networks/default"))
                      .addAllowedRule(Firewall.Rule.builder()
                              .IpProtocol(IpProtocol.TCP)
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      for (Integer port : templateOptions.getInboundPorts()) {
         String name = naming.name(port);
         Firewall firewall = firewallApi.get(name);
         if (firewall == null) {
            ImmutableSet<Firewall.Rule> rules = ImmutableSet.of(Firewall.Rule.permitTcpRule(port), Firewall.Rule.permitUdpRule(port));
            FirewallOptions firewallOptions = new FirewallOptions()
                    .name(name)
                    .network(network.getSelfLink())
                    .allowedRules(rules)
                    .sourceTags(templateOptions.getTags())
                    .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE))
                    .targetTags(ImmutableSet.of(name));
            AtomicReference<Operation> operation = Atomics.newReference(firewallApi.createInNetwork(
                    firewallOptions.getName(),
                    network.getSelfLink(),
                    firewallOptions));
            operations.add(operation);
         }
      }
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      if (api.getFirewallApiForProject(userProject.get()).list(options).concat().anyMatch(providesIpPermission(ipPermission))) {
         // Permission already exists.
         return group;
      }

      FirewallOptions fwOptions = new FirewallOptions();
      String uniqueFwName = namingConvention.createWithoutPrefix().uniqueNameForGroup(group.getName());
      fwOptions.name(uniqueFwName);
      fwOptions.network(group.getUri());
      if (!ipPermission.getGroupIds().isEmpty()) {
         fwOptions.sourceTags(ipPermission.getGroupIds());
      }
      if (!ipPermission.getCidrBlocks().isEmpty()) {
         fwOptions.sourceRanges(ipPermission.getCidrBlocks());
      }
      Firewall.Rule.Builder ruleBuilder = Firewall.Rule.builder();
      ruleBuilder.IpProtocol(ipPermission.getIpProtocol());
      if (ipPermission.getToPort() > 0) {
         ruleBuilder.addPortRange(ipPermission.getFromPort(), ipPermission.getToPort());
      }
      fwOptions.addAllowedRule(ruleBuilder.build());

      AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject
              .get()).createInNetwork(
              uniqueFwName,
              group.getUri(),
View Full Code Here

Examples of org.jclouds.googlecomputeengine.options.FirewallOptions

      }
      rules.add(tcpRule.build());
      rules.add(udpRule.build());


      FirewallOptions options = new FirewallOptions()
              .name(sharedResourceName)
              .network(network.getSelfLink())
              .sourceTags(templateOptions.getTags())
              .allowedRules(rules.build())
              .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE));
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.