How to get vcaccafe host using vro



get cafeHost

var cafeHost = Server.findAllForType("VCACCAFE:VCACHost")[0];
System.log("cafeHost found by type: "+cafeHost.displayName);
// cafeHost = null;

var cafeHost = vCACCAFEEntitiesFinder.getHostForEntity(catalogItem);
System.log("cafeHost found by catalogItem: "+cafeHost.displayName);
// cafeHost = null;

var tenantName = "lab";
var cafeHosts = Server.findAllForType("VCACCAFE:VCACHost");
if (!cafeHosts[0]){throw "ERROR - Unable to find an IaaS Host";}
for each (var cafeHost in cafeHosts){
  if(cafeHost.tenant == tenantName){
     var tenantCafeHost = cafeHost;
     break;
  }
}
if (!tenantCafeHost){
              throw "ERROR - Unable to find a CAFE Host for: " + tenantName;
}else{
              System.log("found cafeHost for tenant \""+tenantName+"\" : "+tenantCafeHost.displayName);
}

// cafeHost = null;

Comments

Popular posts from this blog

Creating Snapshots for Unmanaged VMs in Aria Automation (vRealize Automation)

Bulk import security policies into Palo Alto Networks firewalls

Automating Tag Creation & Assignment to VMs with vRA + vRO