Package org.jclouds.googlecomputeengine.domain

Examples of org.jclouds.googlecomputeengine.domain.Network


   public void testApply() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here


   public void testApplyWithGateway() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network").gatewayIPv4("1.2.3.4")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here

      builder.description("some description");
      builder.gatewayIPv4("1.2.3.4");
      builder.IPv4Range("0.0.0.0/0");
      builder.name("jclouds-test");

      Network network = builder.build();

      NetworkToSecurityGroup netToSg = new NetworkToSecurityGroup(fwToPerm, api, projectSupplier);

      SecurityGroup group = netToSg.apply(network);
View Full Code Here

   @Test
   public void testLoadExisting() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      final Supplier<String> userProject = new Supplier<String>() {
View Full Code Here

   public void testLoadNew() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here

   }

   @Test(groups = "live", dependsOnMethods = "testInsertNetwork")
   public void testGetNetwork() {

      Network network = api().get(NETWORK_NAME);
      assertNotNull(network);
      assertNetworkEquals(network);
   }
View Full Code Here

   }


   protected void cleanUpNetworksAndFirewallsForGroup(final String groupName) {
      String resourceName = namingConvention.create().sharedNameForGroup(groupName);
      final Network network = api.getNetworkApiForProject(project.get()).get(resourceName);
      FirewallApi firewallApi = api.getFirewallApiForProject(project.get());
      Predicate<Firewall> firewallBelongsToNetwork = new Predicate<Firewall>() {
         @Override
         public boolean apply(Firewall input) {
            return input != null && input.getNetwork().equals(network.getSelfLink());
         }
      };

      Set<AtomicReference<Operation>> operations = Sets.newHashSet();
      for (Firewall firewall : firewallApi.list().concat().filter(firewallBelongsToNetwork)) {
View Full Code Here

      this.userProject = checkNotNull(userProject, "userProject");
   }

   @Override
   public Network load(NetworkAndAddressRange in) {
      Network network = api.getNetworkApiForProject(userProject.get()).get(in.getName());
      if (network != null) {
         return network;
      } else {
         return networkCreator.apply(in);
      }
View Full Code Here

      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class.cast(mutableTemplate
              .getOptions());
      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      // get or create the network and create a firewall with the users configuration
      Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
      getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
      templateOptions.network(network.getSelfLink());
      templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);

      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
   }
View Full Code Here

      ImmutableSet.Builder builder = ImmutableSet.builder();


      for (NetworkInterface nwInterface : instance.getNetworkInterfaces()) {
         String networkUrl = nwInterface.getNetwork().getPath();
         Network nw = api.getNetworkApiForProject(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));

         SecurityGroup grp = groupForTagsInNetwork(nw, instance.getTags().getItems());
         if (grp != null) {
            builder.add(grp);
         }
View Full Code Here

TOP

Related Classes of org.jclouds.googlecomputeengine.domain.Network

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.