VMware Cloud Community
stmichel
Contributor
Contributor

How to delete orphan XaaS VMs in vRA 's inventory using vRO's plugin ?

Hi all,

I have an orphan VM in my XaaS inventory (vRA7.4).

The VM was build in XaaS with vRO (7.4), and a custom resource was created in my inventory, mapped to VC:VirtualMachine.

There was a problem in a Day 2 operation. The vsphere VM has been deleted, but the  inventory Item not.

My goal is to delete this element, without using database requests in vRA Appliance (vRealize Automation : Delete Orphaned Catalog Item vRA 6.x - vINCEPTION ).

I have tried to do that with vRO.

This is my strating code :

var vraItems =  vCACCAFEEntitiesFinder.getCatalogResources(vRaEndpoint);

for (var i = 0; i< vraItems.length; i++)
{
   if(vraItems[i].name.toLowerCase() == itemName.toLowerCase())
   {
       System.log("Found : " + vraItems[i].name);
        System.log("ID : " + vraItems[i].id);
        System.log("Status : " + vraItems[i].status.value());
     }
}

My element is found.

The status is VCACCAFEResourceStatus type.

I have seen the setStatus method on catalog resource object, but I need a VCACCAFEResourceStatus in parameter.

My goal is to replace ACTIVE by DELETED Status, like in sql solution.

I have tried to create a new VCACCAFEResourceStatus, but it failed.

     var xxx = new VCACCAFEResourceStatus();

     ReferenceError: "VCACCAFEResourceStatus" is not defined

I have tried to collecte actual status, and modify it, but I failed to give a new value.

Have someone a tip for me ?

- creating a VCACCAFEResourceStatus

- or parameter actual VCACCAFEResourceStatus

- or another solution

Thanks by advance

Stéphane

Reply
0 Kudos
1 Reply
xian_
Expert
Expert

Reply
0 Kudos