vRealize Orchestrator sdkConnection list vcenters

by Grzegorz Kulikowski
vRealize orchestrator

So i am slowly starting to work with vRO. Today i was trying to obtain my vcenter that is connected inside the vcPlugin.
Before i go further, set of tools that i am using for this moment is. vCO-CLI + something to write script (in my case its visual studio code).
Code_DerpE5nREN
So whatever i will try i can quickly test if it works inside vRO.
vCO-CLI at this moment does not work with vRO 8.x series, so i have 1 vro 7.6 for this purpose.
Also one will probably need api explorer.


I wrote myself a filter function for array, that i can reuse it lateron for other things , not just that particular sdkconnections.
I am not going into explaining how does this work, simply because i just started learning javascript myself 😉 so for me some things are not 100% clear for now.

manual
https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/filter

So our VcPlugin (btw, you have to be careful with typing, everything is case sensitive, if you have vco-cli, use tab a lot), has allSdkConnections array that hold our vcenters in the plugin. Right now i am just guessing most of the things, since i am learning, but this will be important when one will be working with more than one VC, or will be executing things against particular VC, and not just random one. So in order to start from the right vc, we can filter that array to find our correct VC. You probably checked VcPlugin, and saw method like findSdkConnectionForUUID, this would find the vc based on instannceuuid, but what if you would want to find vc by name,id, whatever property…


vco :136> VcPlugin.findSdkConnectionForUUID('31d0f5fc-069d-4d7b-b0da-7dcb71b37f67')
=> DynamicWrapper (Instance) : [VcSdkConnection]-[class com.vmware.o11n.plugin.vsphere_gen.SdkConnection_Wrapper] -- VALUE : vc001.greg.labs

vco :137> (VcPlugin.allSdkConnections.filter(check,["instanceUuid","31d0f5fc-069d-4d7b-b0da-7dcb71b37f67"]))[0]
=> DynamicWrapper (Instance) : [VcSdkConnection]-[class com.vmware.o11n.plugin.vsphere_gen.SdkConnection_Wrapper] -- VALUE : vc001.greg.labs

vco :102> VcPlugin.allSdkConnections.filter(check,["id","vc001.greg.labs"])
=> DynamicWrapper (Instance) : [VcSdkConnection]-[class com.vmware.o11n.plugin.vsphere_gen.SdkConnection_Wrapper] -- VALUE : vc001.greg.labs


So since we have now stored our vcenter connection we can move forward.

You may also like

Leave a Reply

Chinese (Simplified)EnglishFrenchGermanHindiPolishSpanish
Streaming live on Twitch right now.
CURRENTLY OFFLINE