Package org.jclouds.googlecomputeengine.domain

Examples of org.jclouds.googlecomputeengine.domain.Network$Builder


      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


      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

      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

   }

   @Override
   public SecurityGroup getSecurityGroupById(String id) {
      checkNotNull(id, "id");
      Network network = api.getNetworkApiForProject(userProject.get()).get(id);

      if (network == null) {
         return null;
      }
View Full Code Here

   public SecurityGroup createSecurityGroup(String name) {
      checkNotNull(name, "name");

      NetworkAndAddressRange nAr = new NetworkAndAddressRange(name, DEFAULT_INTERNAL_NETWORK_RANGE, null);

      Network nw = networkCreator.apply(nAr);

      return groupConverter.apply(nw);
   }
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);
      getOrCreateFirewall(templateOptions, network, sharedResourceName);
      templateOptions.network(network.getSelfLink());

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

   private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) {

      String networkName = templateOptions.getNetworkName().or(sharedResourceName);

      // check if the network was previously created (cache???)
      Network network = api.getNetworkApiForProject(userProject.get()).get(networkName);

      if (network != null) {
         return network;
      } else if (templateOptions.getNetwork().isPresent()) {
         throw new IllegalArgumentException("requested network " + networkName + " does not exist");
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

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

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

   private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) {

      String networkName = templateOptions.getNetworkName().or(sharedResourceName);

      // check if the network was previously created (cache???)
      Network network = api.getNetworkApiForProject(userProject.get()).get(networkName);

      if (network != null) {
         return network;
      } else if (templateOptions.getNetwork().isPresent()) {
         throw new IllegalArgumentException("requested network " + networkName + " does not exist");
View Full Code Here

TOP

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

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.