Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
Created December 11, 2016 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmwarecode/567481b5535701d9dd49614758094e8e to your computer and use it in GitHub Desktop.
Save vmwarecode/567481b5535701d9dd49614758094e8e to your computer and use it in GitHub Desktop.
Get Distributed Virtual Portgroup from Managed Object Reference Id
// 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