Created
December 11, 2016 23:01
-
-
Save vmwarecode/567481b5535701d9dd49614758094e8e to your computer and use it in GitHub Desktop.
Get Distributed Virtual Portgroup from Managed Object Reference Id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2016, VMware, Inc. All Rights Reserved | |
// | |
// VMware vRealize Orchestrator action sample | |
// | |
// Given a Managed Object Reference Id of a DistributedVirtualPortgroup | |
// (ex: dvportgroup-714) return the VC:DistributedVirtualPortgroup object. | |
// | |
//Action Inputs: | |
// id - string | |
// | |
//Return type: VC:DistributedVirtualPortgroup | |
var moRef = new VcManagedObjectReference(); | |
moRef.type = "DistributedVirtualPortgroup"; | |
moRef.value = id; | |
var connections = VcPlugin.allSdkConnections; | |
var dvpg = null; | |
for (var i in connections) { | |
try { | |
System.log("connection: "+connections[i]); | |
dvpg = VcPlugin.convertToVimManagedObject(connections[i], moRef); | |
System.log("dvpg: "+dvpg); | |
if(dvpg != null) { | |
//found it | |
break; | |
} | |
} catch (e) { | |
System.error(e); | |
} | |
} | |
return dvpg; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment