I’ve been working on some more automation lately for vCloud Director using vRealize Orchestrator. One of my use cases was to retrieve the SDK Connection scripting object for the linked vCenter Server. My starting point was an Org vDC, and from there I wanted to get the backing vCenter Server.
Let’s start by getting the Provider vDC vCloud Reference object from the Org vDC scripting object (orgVDC):
|
|
The providerRef variable will now contain a VclReference that we can use query vCloud for the actual VclProviderVdc scripting object:
|
|
Cool, now the providerVdc variable contains the VclProviderVdc scripting object.
Let’s now get the VclObject and enumerate it. You’ll also see the ‘[0]’ at the end of the enumerate() method which grabs the first entry in the enumerated array (this is called the array index). I only bother grabbing the first one as my environment only has one vCenter Server linked to vCloud.
|
|
The returned object will be another VclReference that we need to again do a lookup for:
|
|
Nice, our obj var now holds the VclVimServer scripting object. But that’s not enough, we need the SdkConnection. Let’s grab the UUID of the vCenter Server from the VclVimServer object:
|
|
Finally, let’s use VcPlugin to get the SdkConnection object from a UUID:
|
|
Done! Our vCenter variable now contains the VC:SdkConnection scripting object.
Altogther for those that want the code in block:
|
|