VMware Cloud Community
LokeshReddyN
Contributor
Contributor

Action item to return event list

Hello Folks,

I have  just created an action item that returns array of events as below

Inputs:

start time

end time

event type ID

Object(datastore)

Output:

VcEvent[]

However I dont see the type "VcEvent" or "VcEvent[]" in the output variable, but its there for tasks. How do I return an array of events?

vRO version: 7.6

vCenter version: 7.0

vRO vCenter plugin version : 7.0

 

 

 

Reply
0 Kudos
1 Reply
imtrinity94
Enthusiast
Enthusiast

You are right. it says no sdk type defined for class. There is no VcEvent type in vRO just the Object.

imtrinity94_0-1661335336176.png

Reference code:

/**
 *
 * @module actions.mayank.goyal
 * @version 1.0.0
 * @param {VC:VirtualMachine} vm 
 * @outputType Array/vCloud:VmwNetworkPool
 *
 */
function returnVcEvents(vm) {
    var arr = [];
    var spec = new VcEventFilterSpec();
    //spec.eventTypeId = ["DrsVmPoweredOnEvent","VmResourceReallocatedEvent"];
    spec.entity = new VcEventFilterSpecByEntity();
    spec.entity.entity = vm;
    spec.entity.recursion = VcEventFilterSpecRecursionOption.self;
    var events = vm.sdkConnection.eventManager.queryEvents(spec);
    for each (var ev in events) {
        arr.push(ev)
    }
    return arr;
}

 


Mayank Goyal
vRO Engineer
https://www.linkedin.com/in/mayankgoyal1994/
https://cloudblogger.co.in/
Reply
0 Kudos