Last active
August 7, 2018 03:41
-
-
Save trisharia/b1d3086f215810869721cc7e9324c011 to your computer and use it in GitHub Desktop.
Assign a vCenter tag to a VM via VAPI
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
// VMware vRealize Orchestrator action sample | |
// | |
// This sample assigns a vCenter Tag to a VM | |
// | |
// For vRO/VAPI 7.0+ | |
// | |
// Action Inputs: | |
// endpoint - VAPIEndpoint - VAPI Endpoint | |
// tagId - string - ID of the vCenter Tag | |
// vm - VC:VirtualMachine - VM to which tag will be assigned | |
// | |
// Return type: void | |
//Prep VM VAPI reference object | |
var vapiVm = new com_vmware_vapi_std_dynamic__ID() ; | |
vapiVm.id = vm.id; | |
vapiVm.type = "VirtualMachine"; | |
//Associate VM to tag: | |
var client = endpoint.client(); | |
var assocService = new com_vmware_cis_tagging_tag__association(client); | |
assocService.attach(tagId , vapiVm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment