Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: vCAC 6.1 - how to retrieve VCACCAFE item ID during MachineProvisioned step using vCenter Orchestrator extension

$
0
0

Yeah... it is a catalog resource.  The resource type just happens to be of type "Virtual Machine". (through resourceTypeRef property which has a composite object id/label)  This distinction is important...

 

So you have to get your vcacCafe:CatalogResource object and then run the .getId() method on it.  I don't think the workflow runner supplies this object when it runs the MachineProvisioned.  (if it does, then you should be able to assign it to an input and run it)  It is no matter.  It does supply the VC:VirtualMachine...

 

 

SCRIPT INPUTS

vCACCAFE:VCACHost cafeHost

VC:VirtualMachine vcVm

 

 

SCRIPT

 

 

var stringName = vcVm.name;
//Get the resource using the vRO plugin inventory method with a CAFE plugin filter on name for CatalogResource
//Would probably be an array of one.
var myResources = Server.findAllForType("VCACCAFE:CatalogResource",stringName);

for each (resource in myResources){
 //In this loop, resource is your object of VCACCafe:CatalogResource
 if (resource.getName() == stringName){
  System.log(resource.getName());  System.log(resource.getId());  // If this truly is all you need  //Operations?  var resourceOperations = resource.getOperations();  for each (operation in resourceOperations){   System.log("? " + operation.getName());  }  System.log("Nope... not going to find any, but... ");  // Differences between execution objects and source objects  System.log("When you GET the object by ID through the entities finder...");  System.log("And your Plugin Service Account has permissions in the business group to see resource operations...");  resourceTarget = vCACCAFEEntitiesFinder.getCatalogResource(cafeHost,resource.getId());  System.log(resourceTarget.getName());  for each (operation in resourceTarget.getOperations()){   System.log(operation.getName());  }
 }
}

Viewing all articles
Browse latest Browse all 168455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>