Examples of InstantiateVAppTemplateOptions


Examples of org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions

      this.credentialStore = checkNotNull(credentialStore, "credentialStore");
      this.prioritizeCredentialsFromTemplate = checkNotNull(prioritizeCredentialsFromTemplate, "prioritizeCredentialsFromTemplate");
   }
   @Override
   public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
      InstantiateVAppTemplateOptions options = getOptions.apply(template);
      NodeAndInitialCredentials<VApp> from = computeClient.startAndReturnCredentials(URI.create(template.getLocation().getId()), URI.create(template
               .getImage().getId()), name, options, template.getOptions().getInboundPorts());
      LoginCredentials fromNode = from.getCredentials();
      if (credentialStore.containsKey("group#" + group)) {
         fromNode = fromNode == null ? LoginCredentials.fromCredentials(credentialStore.get("group#" + group))
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions

@Singleton
public class TemplateToInstantiateOptions implements Function<Template, InstantiateVAppTemplateOptions> {

   @Override
   public InstantiateVAppTemplateOptions apply(Template from) {
      InstantiateVAppTemplateOptions options = processorCount(Double.valueOf(getCores(from.getHardware())).intValue())
            .memory(from.getHardware().getRam());
      if (!from.getOptions().shouldBlockUntilRunning())
         options.block(false);
      String sshKeyFingerprint = TerremarkVCloudTemplateOptions.class.cast(from.getOptions()).getSshKeyFingerprint();
      if (sshKeyFingerprint != null)
         options.sshKeyFingerprint(sshKeyFingerprint);
      return options;
   }
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

     
      NetworkConfig config = networkConfigurationForNetworkAndOptions.apply(networkToConnect, vOptions);

      // note that in VCD 1.5, the network name after instantiation will be the same as the parent
      InstantiateVAppTemplateOptions options = addNetworkConfig(config);

      // TODO make disk size specifiable
      // disk((long) ((template.getHardware().getVolumes().get(0).getSize()) *
      // 1024 * 1024l));



      String description = VCloudTemplateOptions.class.cast(template.getOptions()).getDescription();
      if (description == null) {
         Map<String, String> md = metadataAndTagsAsCommaDelimitedValue(template.getOptions());
         description = Joiner.on('\n').withKeyValueSeparator("=").join(md);
      }

      options.description(description);
      options.deploy(false);
      options.powerOn(false);

      URI VDC = URI.create(template.getLocation().getId());

      logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);

View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

      Set<NetworkConfig> networkConfig = null;

      NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
            defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);

      InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);

      if (options != null) {
         if (options.getNetworkConfig().size() > 0)
            networkConfig = ImmutableSet
                     .copyOf(transform(options.getNetworkConfig(), networkConfigDecorator));
      } else {
         options = new InstantiateVAppTemplateOptions();
      }

      if (networkConfig == null)
         networkConfig = ImmutableSet.of(networkConfigDecorator.apply(null));

      try {
         return stringBinder.bindToRequest(request, generateXml(name, options.getDescription(), options.shouldDeploy(),
                  options.shouldPowerOn(), template, networkConfig));
      } catch (ParserConfigurationException e) {
         throw new RuntimeException(e);
      } catch (FactoryConfigurationError e) {
         throw new RuntimeException(e);
      } catch (TransformerException e) {
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
      VAppTemplate template = createMock(VAppTemplate.class);
      replay(template);

      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions()));

      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
               BindInstantiateVAppTemplateParamsToXmlPayload.class);

      Map<String, Object> map = Maps.newHashMap();
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

      VAppTemplate template = createMock(VAppTemplate.class);
      replay(template);

      String expected = Strings2.toStringAndClose(getClass()
               .getResourceAsStream("/instantiationparams-description.xml"));
      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions().description("my foo")));

      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
               BindInstantiateVAppTemplateParamsToXmlPayload.class);

      Map<String, Object> map = Maps.newHashMap();
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

   public void testWithNetworkNameFenceMode() throws IOException {
      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
      VAppTemplate template = createMock(VAppTemplate.class);
      replay(template);

      InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("aloha", URI
               .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED));

      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams-network.xml"));
      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

     
      NetworkConfig config = networkConfigurationForNetworkAndOptions.apply(networkToConnect, vOptions);

      // note that in VCD 1.5, the network name after instantiation will be the same as the parent
      InstantiateVAppTemplateOptions options = addNetworkConfig(config);

      // TODO make disk size specifiable
      // disk((long) ((template.getHardware().getVolumes().get(0).getSize()) *
      // 1024 * 1024l));



      String description = VCloudTemplateOptions.class.cast(template.getOptions()).getDescription();
      if (description == null) {
         Map<String, String> md = metadataAndTagsAsCommaDelimitedValue(template.getOptions());
         description = Joiner.on('\n').withKeyValueSeparator("=").join(md);
      }

      options.description(description);
      options.deploy(false);
      options.powerOn(false);

      URI VDC = URI.create(template.getLocation().getId());

      logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);

View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

      Set<NetworkConfig> networkConfig = null;

      NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
            defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);

      InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);

      if (options != null) {
         if (options.getNetworkConfig().size() > 0)
            networkConfig = ImmutableSet
                     .copyOf(transform(options.getNetworkConfig(), networkConfigDecorator));
      } else {
         options = new InstantiateVAppTemplateOptions();
      }

      if (networkConfig == null)
         networkConfig = ImmutableSet.of(networkConfigDecorator.apply(null));

      try {
         return stringBinder.bindToRequest(request, generateXml(name, options.getDescription(), options.shouldDeploy(),
                  options.shouldPowerOn(), template, networkConfig));
      } catch (ParserConfigurationException e) {
         throw new RuntimeException(e);
      } catch (FactoryConfigurationError e) {
         throw new RuntimeException(e);
      } catch (TransformerException e) {
View Full Code Here

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions

     
      NetworkConfig config = networkConfigurationForNetworkAndOptions.apply(networkToConnect, vOptions);

      // note that in VCD 1.5, the network name after instantiation will be the same as the parent
      InstantiateVAppTemplateOptions options = addNetworkConfig(config);

      // TODO make disk size specifiable
      // disk((long) ((template.getHardware().getVolumes().get(0).getSize()) *
      // 1024 * 1024l));



      String description = VCloudTemplateOptions.class.cast(template.getOptions()).getDescription();
      if (description == null) {
         Map<String, String> md = metadataAndTagsAsCommaDelimitedValue(template.getOptions());
         description = Joiner.on('\n').withKeyValueSeparator("=").join(md);
      }

      options.description(description);
      options.deploy(false);
      options.powerOn(false);

      URI VDC = URI.create(template.getLocation().getId());

      logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);

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.