Package org.jclouds.vcloud.options

Examples of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions$Builder


     
      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


      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

      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

      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

   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

     
      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

      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

     
      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

      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

      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

TOP

Related Classes of org.jclouds.vcloud.options.InstantiateVAppTemplateOptions$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.