Create getSdkConnectionForVC.js

This commit is contained in:
John Bowdre 2022-06-15 10:32:41 -05:00 committed by GitHub
parent 59d052193d
commit c071bd5cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
/* JavaScript: getSdkConnectionForVC
Returns the VC:sdkConnection object for a given vCenter name (FQDN)
Inputs: vCenterName (string)
Return Type: VC:SdkConnection
*/
var vcSdkConnection = null;
var sdkConnections = VcPlugin.allSdkConnections;
for each (sdkConnection in sdkConnections) {
if (sdkConnection.sdkId === vCenterName) {
System.debug("Found matching vCenter SDK endpoint: " + sdkConnection.name);
vcSdkConnection = sdkConnection;
}
if (vcSdkConnection != null) { break; };
}
return vcSdkConnection;