Package org.jclouds.googlecomputeengine.options

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/v1beta15/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


      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/v1beta15/projects/myproject/global/networks/default"))
                      .addAllowedRule(Firewall.Rule.builder()
                              .IPProtocol(IPProtocol.TCP)
View Full Code Here

      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/v1beta15/projects/myproject/global/networks/default"))
                      .addAllowedRule(Firewall.Rule.builder()
                              .IPProtocol(IPProtocol.TCP)
View Full Code Here

      // 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

   }

   @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

   }

   @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

   }

   @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

      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 = new AtomicReference<Operation>(firewallApi.createInNetwork(
                    firewallOptions.getName(),
                    network.getSelfLink(),
                    firewallOptions));
            operations.add(operation);
         }
      }
View Full Code Here

      // 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

   }

   @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

TOP

Related Classes of org.jclouds.googlecomputeengine.options.FirewallOptions

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.