Add The Vapp Template To A Catalog; Instantiate The Vapp Template - VMware VCLOUD SDK 1.0 - FOR NET DEVELOPERS GUIDE Manual

Vcloud sdk for .net developer’s guide
Hide thumbs Also See for VCLOUD SDK 1.0 - FOR NET DEVELOPERS GUIDE:
Table of Contents

Advertisement

vCloud SDK for .NET Developer's Guide
// periodically check the vAppTemplate URL. When status="8" upload is complete.
{
System.Threading.Thread.Sleep(5000);
vappTemplate = VappTemplate.GetVappTemplateByReference(client, vappTemplate.Reference);
}
// return the template URL
return vappTemplate.Reference;
...
}

Add the vApp Template to a Catalog

After the vAppTemplate is uploaded. the HellovCloud example uses its createNewCatalogItem method to 
create a CatalogItem object in the catalog whose name was provided on the command line. The CatalogItem 
contains the reference to the template that was returned in Example

Instantiate the vApp Template

When the template is in the catalog, you can instantiate it to create a vApp. The HellovCloud example 
implements a newvAppFromTemplate method that has two parameters:
vAppTemplateReference: a reference to the template, which is obtained from the catalog.
Vdc: a reference to the vDC in which to instantiate the template.
With these inputs, newvAppFromTemplate constructs a simple InstantiateVAppTemplateParams request 
body, makes the request to the action/instantiateVAppTemplate URL of the vDC, and returns a Vapp 
helper object that contains a reference to the vApp. 
Example 3-3. Instantiating the vApp Template
public static Vapp NewvAppFromTemplate(ReferenceType vAppTemplateReference, Vdc vdc)
{
try
{
...
// get the href of the OrgNetwork to which we can connect the vApp network, and fail if
// there is no OrgNetwork available
NetworkConfigurationType networkConfigurationType = new NetworkConfigurationType();
...
if (vdc.GetAvailableNetworkRefs().Count == 0)
{
Console.WriteLine("No Networks in vdc to instantiate the vapp");
}
// specify the NetworkConfiguration for the vApp network
networkConfigurationType.ParentNetwork = vdc.GetAvailableNetworkRefs().FirstOrDefault();
networkConfigurationType.FenceMode = FenceModeValuesType.bridged;
VAppNetworkConfigurationType vAppNetworkConfigurationType = new
vAppNetworkConfigurationType.Configuration = networkConfigurationType;
if (vdc.GetAvailableNetworkRefs() != null && vdc.GetAvailableNetworkRefs().Count > 0)
{
vAppNetworkConfigurationType.networkName =
}
// fill in the NetworkConfigSection
NetworkConfigSectionType networkConfigSectionType = new NetworkConfigSectionType();
Msg_Type networkInfo = new Msg_Type();
networkConfigSectionType.Info = networkInfo;
List<VAppNetworkConfigurationType> vAppNetworkConfigs = new
vAppNetworkConfigs.Add(vAppNetworkConfigurationType);
networkConfigSectionType.NetworkConfig = vAppNetworkConfigs.ToArray();
16
VAppNetworkConfigurationType();
vdc.GetAvailableNetworkRefs().FirstOrDefault().name;
List<VAppNetworkConfigurationType>();
3‐2.
VMware, Inc.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vcloud sdk 1.0

Table of Contents