4 Replies Latest reply on May 30, 2017 3:41 PM by TGrissom

    Get Deployment Data with Event Broker

    TGrissom Novice

      I've been banging my head against this one for a bit now, and am just not running across the correct way of doing this. Hopefully some of you can help. I'm trying to get all data about a vRA deployment via the event broker and pass that across to a vRO workflow.


      We are currently using the Machine Provisioning event subscription to grab all the relevant information about an individual VM during deployment for all sorts of useful tasks, but now we're needing to grab data about an entire deployment. To simplify for example sake, we have a blueprint that has two machines attached to a single load balancer. We want to kick off a workflow when this deployment is requested which can get the load balancer name, load balancer IP, and properties from the VMs so we can generate a hostname by combining this information and kick off a request to create a DNS entry for the load balancer.


      How can we get all relevant information from a deployment via the event broker in the same way we can from an individual machine deployment?

        • 1. Re: Get Deployment Data with Event Broker
          nsb24 Enthusiast
          VMware Employees

          There are other events registered that gives  deployment ID. You can subscribe to those events and once you have deployment ID, you can use deployment ID to get full deployment resource and its respective components using the following API: https://{{va-fqdn}}/catalog-service/api/consumer/resources?$filter=parentResource/id eq {{deployment-resource-guid}}'. You might have equivalent resources available to get components of a deployment within vRO.


          • 2. Re: Get Deployment Data with Event Broker
            TGrissom Novice

            Thank you for the info. I had tried listening on the other event topics and was able to get the deployment ID, but I was strictly trying to use this information with the built in actions and object methods that were available in vRO to try and get the deployment information which wasn't getting me very far.


            I'll give the API a try to see if that'll give me what I'm looking for.

            • 3. Re: Get Deployment Data with Event Broker
              filosmith Enthusiast

              If you have the deploymentId from the payload, you can get the catalog resource ID using the method provided by balatkaz in this post How to get resource action request information


              With that deployment ID, you can get the resource with vCACCAFEEntitiesFinder.getCatalogResource(host, catalogResourceId); // host = vCACCAFE:VCACHost


              and from there you can get all sorts of properties of the deployment.

              • 4. Re: Get Deployment Data with Event Broker
                TGrissom Novice

                You both got me on the right track. I ended up using the vRO catalog client to do a GET to the rest api. I couldn't directly use any of the guids from the event data from vRO, but I was able use that to get a request ID I could feed to the API.


                Here's what I ended up with:


                var items = vCACCAFEEntitiesFinder.getCatalogResources(vCACHost);

                for each (item in items) { 

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

                    var requestId = item.requestId;



                if (!requestId) {

                  throw 'Could not get request ID.'


                System.log('RequestID: ' + requestId);


                var client = vCACHost.createCatalogClient();

                var request = client.get('/consumer/requests/' + requestId);

                var requestBody = request.getBodyAsJson();

                var resources = client.get('/consumer/requests/' + requestId + '/resourceViews');

                var resourceBody = resources.getBodyAsJson();


                Thanks for the help.