Orchestrator Function: vCenter VAPI Plugin Content Library Item Deploy

by Simon Sparks · 18 January 2026

To use this function add it to the class library file named vCenterVAPIService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vCenterVAPIService.ts

Function ContentLibraryItemDeployOVF

publicContentLibraryItemDeployOVF(objVAPIContentLibraryModel:com_vmware_content_library__model,strHostname:string,objVcVmFolder:VcVmFolder,objVcDatastore:VcDatastore,objVcHostSystem:VcHostSystem,objVcResourcePool:VcResourcePool):VcVirtualMachine{

letobjVAPIVCenterOVFLibraryItemDeploymentTarget:com_vmware_vcenter_ovf_library__item_deployment__target=newcom_vmware_vcenter_ovf_library__item_deployment__target();
objVAPIVCenterOVFLibraryItemDeploymentTarget.folder_id=objVcVmFolder.id;
objVAPIVCenterOVFLibraryItemDeploymentTarget.host_id=objVcHostSystem.id;
objVAPIVCenterOVFLibraryItemDeploymentTarget.resource_pool_id=objVcResourcePool.id;

letobjVAPIVCenterOVFLibraryItemResourcePoolDeploymentSpec:com_vmware_vcenter_ovf_library__item_resource__pool__deployment__spec=newcom_vmware_vcenter_ovf_library__item_resource__pool__deployment__spec();
objVAPIVCenterOVFLibraryItemResourcePoolDeploymentSpec.accept_all_EULA=true;
objVAPIVCenterOVFLibraryItemResourcePoolDeploymentSpec.name=strHostname;
objVAPIVCenterOVFLibraryItemResourcePoolDeploymentSpec.default_datastore_id=objVcDatastore.id;

letobjVAPIVCenterOvfLibraryItem:com_vmware_vcenter_ovf_library__item=newcom_vmware_vcenter_ovf_library__item(this.objVAPIClient);

letobjVAPIVCenterOVFLibraryItemDeploymentResult:com_vmware_vcenter_ovf_library__item_deployment__result=objVAPIVCenterOvfLibraryItem.deploy(null,objVAPIContentLibraryModel.id,objVAPIVCenterOVFLibraryItemDeploymentTarget,objVAPIVCenterOVFLibraryItemResourcePoolDeploymentSpec);

letobjVAPIVCenterOVFLibraryItemDeployableIdentity:com_vmware_vcenter_ovf_library__item_deployable__identity=objVAPIVCenterOVFLibraryItemDeploymentResult.resource_id;

letstrXPathQuery:string=`xpath:matches(id, '${objVAPIVCenterOVFLibraryItemDeployableIdentity.id}')`;

letarrVcVirtualMachine:VcVirtualMachine[]=VcPlugin.getAllVirtualMachines(null,strXPathQuery);

letobjVcVirtualMachine:VcVirtualMachine=arrVcVirtualMachine.find((objVcVirtualMachine:VcVirtualMachine):boolean=>{
returnobjVcVirtualMachine.id===objVAPIVCenterOVFLibraryItemDeployableIdentity.id;
});

returnobjVcVirtualMachine;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like