Skip to content

Instantly share code, notes, and snippets.

View trisharia's full-sized avatar

Trisha Navarro trisharia

View GitHub Profile
@trisharia
trisharia / removeDuplicatesFromArray.js
Last active September 22, 2017 02:44
Remove duplicates from an array
// VMware vRealize Orchestrator action sample
//
// Removes duplicates from an array, with the option to also sort the array
//
// For vRO 6.0+
//
// Action Inputs:
// a - Array/Any - Array with potential duplicates
// doSort - boolean - Sort the array also? Potentially better performance than unsorted algorithm
//
@trisharia
trisharia / getClusterComputeResourceOfVm.js
Last active August 25, 2017 18:09
Get the Cluster of a vCenter VM
// VMware vRealize Orchestrator action sample
//
// Returns the cluster of a given vCenter VM
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// vm - VC:VirtualMachine - vCenter VM
//
// Return type: VC:ClusterComputeResoure - the cluster to which the VM belongs
@trisharia
trisharia / getVmFolderOfVm.js
Last active August 25, 2017 18:08
Get folder of a vCenter VM
// VMware vRealize Orchestrator action sample
//
// Returns the VM folder of a given vCenter VM
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// vm - VC:VirtualMachine - vCenter VM
//
// Return type: VC:VmFolder - the folder to which the VM belongs
// VMware vRealize Orchestrator action sample
//
// Returns the vCenter ClusterComputeResource with the given name
// Assumes there is only 1
// Does a case-insensitive search
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// clustername - string - Name of the cluster to find
@trisharia
trisharia / isHostCompatibleForVm.js
Last active November 20, 2017 22:24
Is HostSystem Compatible for a vCenter VM?
// VMware vRealize Orchestrator action sample
//
// Use VM-host compatibility checker, which is native to the vCenter plugin,
// to determine if a host is compatible with a given VM and resource pool
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// host - VC:HostSystem - vCenter host
// vm - VC:VirtualMachine - vCenter VM
@trisharia
trisharia / getAllCompatibleDatastoresForHostAndVm.js
Created August 25, 2017 18:32
Get all compatible Datastores for a vCenter Host and VM
// VMware vRealize Orchestrator action sample
//
// Get all compatible datastores for a given host, resource pool, and virtual machine.
// The datstore must have enough free storage space necessary for the VM, and must be
// accessible and not in an overall status of "Red".
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// host - VC:HostSystem - vCenter host
@trisharia
trisharia / getValueFromvCACCAFELiteralMap.js
Last active November 6, 2018 20:18
Get the value from vCACCAFELiteralMap
// VMware vRealize Orchestrator action sample
//
// Returns the value of a given key defined in a vCACCAFE:vCACCAFELiteralMap
// Performs depth-first search
//
// For vRA 7.0+/vRO 7.0+
//
// Action Inputs:
// map - Any - the vCACCAFE:vCACCAFELiteralMap to parse
// key - string - Key for searching in the literal map
@trisharia
trisharia / getParentCatalogResource.js
Created August 25, 2017 19:10
Get parent Catalog Resource in vRA
// VMware vRealize Orchestrator action sample
//
// Returns the parent of a given vCACCAFE:CatalogResource
// For example, find the Deployment resource of a Machine
//
// For vRA 7.0+/vRO 7.0+
//
// Action Inputs:
// childCatalogResource - vCACCAFE:CatalogResource - catalog resource for which to get the parent
// cafeHost - vCACCAFE:VCACHost - vRA CAFE host
@trisharia
trisharia / getCatalogResourceActionRequests.js
Last active October 23, 2018 16:25
Get day-2 or resource action requests of a vRA catalog resource
// VMware vRealize Orchestrator action sample
//
// Returns day-2 or resource action request(s) that have been submitted for a vRA catalog resource
//
// For vRA 7.0+/vRO 7.0+
//
// Action Inputs:
// cafeHost - vCACCAFE:VCACHost - vRA CAFE host
// resource - vCACCAFE:CatalogResource - catalog resource for which to get day-2 requests
// actionLabel - string - optional action label to filter by
@trisharia
trisharia / isVmATemplate.js
Created August 25, 2017 20:08
Is the vCenter VM a template?
// VMware vRealize Orchestrator action sample
//
// Determine whether the given vCenter VM is a template
//
// For vRO 7.0+/vCenter 6.0+
//
// Action Inputs:
// vm - VC:VirtualMachine - vCenter VM
//
// Return type: boolean - true if the VM is a template