1 Reply Latest reply on Dec 4, 2018 3:36 PM by balawiz

    Gather vRA Deployment Data in vRO

    balawiz Novice

      Environment: vRA/vRO 7.2 and vSphere6.0

       

      The following code has been used to get the request ID from deploymentID and the related deployment data which includes VM and Load Balancer details. However, when that particular tenant(vCACCAFEHost) VMs crossed 100 it throws with "exceed limit" error.

       

      var items = vCACCAFEEntitiesFinder.getCatalogResources(vCACCAFEHost);

      for each (item in items) {

        if (item.providerBinding.bindingId == deploymentId) {

          var requestId = item.requestId;

        }

      }

       

      Error

      Request was denied due to exceeded resource size limit. The maximum number of resources allowed is 100

       

      So by following the links VMware Knowledge Base, How to get resource action request information have tried the below method but error out as "Invalid data access API use". So, checking further and any tips are appreciated.

       

      var deploymentId = "dep_id";

      function getRequestIdFromDeploymentId(deploymentId) {

           var filter = new Array();

           filter[0] = vCACCAFEFilterParam.equal("parentResourceId", vCACCAFEFilterParam.string(deploymentId));

           var query = vCACCAFEOdataQuery.query().addFilter(filter);

           var odataRequest = new vCACCAFEPageOdataRequest(1 , 200 , query);

           var service = vCACCAFEHost.createCatalogClient().getCatalogConsumerResourceService();

           System.log ('req:' + odataRequest);

           var items = service.getResourcesList(odataRequest);

           System.log('items :' + items);

                for each(item in items) {

                     if (item.resourceTypeRef.getLabel() == "Deployment") {

                          System.debug("resourceTypeRef Id: " + item.resourceTypeRef.getId());

                          return item.resourceTypeRef.getId();

                     }

                }

      throw 'Could not get request ID.';

      }