Last active
May 15, 2023 16:11
-
-
Save imtrinity94/2dadd039eadf883071015af2b91fbc4a to your computer and use it in GitHub Desktop.
Associates a Network Pool with NSXT Provider Vdc
This file contains 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
/** | |
* | |
* Associates a Network Pool with NSXT Provider Vdc | |
* | |
* @version 1.0.0 | |
* | |
* @param {string} networkPoolName | |
* @param {vCloud:ProviderVdc} pvdc | |
* @param {vCloud:NsxTManager} nsxtManager | |
* @param {vCloud:Host} host | |
* | |
* @outputType string | |
* | |
*/ | |
function associateNetworkPoolWithPvdcNsxt(networkPoolName, pvdc, nsxtManager) { | |
//var networkPoolId = "urn:vcloud:networkpool:48047a7b-b98f-42bd-a16c-91d45d0fa572"; | |
var networkPoolId = System.getModule("com.vmware.library.vCloud.operation.admin.extensions").getNetworkPoolIdNsxTManager(nsxtManager,networkPoolName); | |
var networkPoolRef = new VclReference(); | |
networkPoolRef.href = host.href + "/cloudapi/1.0.0/networkPools/" + networkPoolId; | |
networkPoolRef.id = networkPoolId; | |
networkPoolRef.name = networkPoolName; | |
networkPoolRef.type = "GENEVE"; | |
var npRefs = System.getModule("com.vmware.library.vCloud.schema.objects").createNetworkPoolReferences([networkPoolRef]); | |
if (npRefs != null) { | |
pvdc["networkPoolReferences"] = npRefs; | |
} | |
return pvdc.toAdminExtensionObject().update(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment