With the vRealize Automation event broker you can subscribe to event topics, that automatically start vRO workflows as part of a deployment or configuration process. In a subscription you set one or more conditions. A condition specifies wether vRO workflows should be run for all events or based on one or more conditions. Conditions are filters that are based on general properties that are part of each request, or on one (or more) of the properties that are part of the payload.
For example if you look at the Machine Provisioning event topic, you have the default properties such as Description, Event topic ID, Event type, Event type name etc. (See the picture on the right for the list). These properties are available for each event topic.
For the payload the available properties depend on the event topic, for Machine Provisioning we have the following properties available:
{ machine : { id : STRING, /* IaaS machine ID */ name : STRING, /* machine name */ externalReference : STRING, /* machine ID on the hypervisor */ owner : STRING, /* machine owner */ type : INTEGER, /* machine type: 0 - virtual machine; 1 - physical machine; 2 - cloud machine */ properties : Properties /* machine properties, see notes below how to expose virtual machine properties */ }, blueprintName : STRING, /* blueprint name */ componentId : STRING, /* component id */ componentTypeId : STRING, /* component type id */ endpointId : STRING, /* endpoint id */ requestId : STRING, /* request id */ lifecycleState : { /* see Life Cycle State Definitions*/ state : STRING, phase : STRING, event : STRING }, virtualMachineEvent : STRING, /* fire an event on that machine - only processed by Manager Service as consumer */ workflowNextState : STRING, /* force the workflow to a specific state - only processed by Manager Service as consumer */ virtualMachineAddOrUpdateProperties : Properties, /* properties on the machine to add/update - only processed by Manager Service as consumer */ virtualMachineDeleteProperties : Properties /* properties to remove from the machine - only processed by Manager Service as consumer */ }
To determine valid values for these properties so that you can use them in a valid condition in the event broker you can use vRealize Orchestrator and read out the payload properties values. The following code will present you the values for the different properties in tree like structure:
getPropertiesText (eventPayloadProperties, "", 1);
You need the following two functions to get the results:
function getPropertiesText(properties, text, level) { for each (var key in properties.keys) { var value = properties.get(key); if (System.getObjectType(value) == "Properties") { text += getPropertiesText(value, padLeft(key + " : \n", "\t", level), level+1); } else { text += padLeft(key + " : " + value + "\n", "\t", level); } } return text; }
function padLeft(string, character, numberOfCharacters) { //System.log(numberOfCharacters); var pre = ""; for (var i=0; i<numberOfCharacters; i++) { pre += character; } //System.log(pre + string); return pre + string; }
(Code snippet taken originally taken from this blog).
Some of the properties (unfortunately not all of them) can also be retrieved using the cloud client. I’ve included some examples below.
Blueprint name
Quickly find the blueprint name using
vra blueprint list
Component id and component type id.
The component id can be found in two steps. First use:
vra blueprint list
to get the list of available blueprints. Now copy the id of the blueprint to look for the id of available components in the blueprint:
vra blueprint detail --id centOS70
The component id is included in the displayed YAML file:
Note: in this example the component ID is the same as the blueprint id.
The component typeid is also provided, in this case this is Infrastructure.Catalogitem.Machine.Virtual.vSphere.
Endpoint id
The endpoint id is easy to find, just use:
vra endpoint list
Note that this query only works if you’re an infrastructure administrator and logged on to the (resource) tenant that has the available endpoints configured.
Tenant id
The tenant id can be found by using
vra tenant list
Note that you have to be logged on to the vsphere.local tenant with the administrator@vsphere.local account.
Hope this was helpful.
1 Comments
Pingback: Exploring available filter properties in the vRA event broker - techunplugged.io