Skip to content

Instantly share code, notes, and snippets.

View imtrinity94's full-sized avatar

Mayank Goyal imtrinity94

View GitHub Profile
// Param-in:
// ruleName (string)
// vms (Array/VC:VirtualMachine)
//
// Param-out:
// result (Any)
// get VC:ClusterComputeResource
var parent = vms[0].resourcePool;
@imtrinity94
imtrinity94 / makeRestCall.js
Created December 27, 2024 07:01
Function to make a REST call using vRO's REST host - Generated via Cursor AI
//This code is generated by Cursor.com AI tool
// Function to make a REST call using vRO's REST host
function makeRestCall(method, url, headers, body) {
try {
// Create REST host object
var restHost = new RESTHost(url);
restHost.setHostVerification(false); // Disable SSL verification if needed
// Create REST operation
@imtrinity94
imtrinity94 / vRO_Add a new machien to exisitng vRA deployment.js
Created December 23, 2024 07:46
vRO_Add a new machien to exisitng vRA deployment.js
System.log("Requesting " + addNodeCount + " machines.")
// COPY FROM MACHINE
//var copyMachineProperties = deploymentMachines[0].properties;
var copyMachineProperties = deploymentMachines[deploymentMachines.length - 1].properties;
var osImage = (os) ? os : copyMachineProperties.image;
System.log("Copy Machine Properties: " + JSON.stringify(copyMachineProperties));
// DERIVE NEW MACHINE INFO
var countIndex = -1;
@imtrinity94
imtrinity94 / vRO - Use REST Host for SOAP Operations.js
Created November 14, 2024 14:42
vRO - Use REST Host for SOAP Operations
/**
*
* @module com.vmware.pso.spbm
*
* @version 2.2.0
*
* @param {REST:RESTHost} host
* @param {string} userName
* @param {SecureString} password
*
@imtrinity94
imtrinity94 / vro_deployment_script.sh
Created August 17, 2023 08:17
vro_deployment_script.sh
```
#!/bin/bash
## Variables ##
VROname=${VROserver}
VROuser=${VROuser}
VROpass=${VROpass}
@imtrinity94
imtrinity94 / vro_polyglot_context.py
Created July 24, 2023 14:21
If you go with the API route then I suggest to use a polyglot action in the language of your choice. The context object in the polyglot containers hold an API and a token to make callbacks to itself. Then you can use the appropriate REST libs for the given language to do what you want. I have a simple action that just returns the url and token t…
def handler(context, inputs):
outputs = {
"vcoUrl": context['vcoUrl'],
"token": context['getToken']()
}
return outputs
@imtrinity94
imtrinity94 / vcofrmn.py
Created June 6, 2023 12:55 — forked from VLogin/vcofrmn.py
[vcofrmn.py] #python #vro #vco
#!/bin/env python
"""
Python wrapper for calling vCO workflows.
Author: AV
Date: 2018-06-14
Version: 0.6
History:
@imtrinity94
imtrinity94 / getAllVcVMswithNoTags.js
Created May 17, 2023 17:26
vRO JavaScript script to Get All vCenter Virtual Machines with No Tags
var arrAllVMs = VcPlugin.getAllVirtualMachines(null, "");
System.log("Total VMs in vCenter: "+arrAllVMs.length);
var client = endpoint.client();
// Set up a dynamic ID for querying
var objId = new com_vmware_vapi_std_dynamic__ID();
var arrVMsWithNoTags = [];
// set up connections for tag associations, tags, and tag categories
var tagging = new com_vmware_cis_tagging_tag__association(client);
var tagMgr = new com_vmware_cis_tagging_tag(client);
/*
Author: Burke Azbill
Purpose: Display various properties of a vCloud:Gateway object in vRealize Orchestrator (vRO)
Usage:
1) Create a new workflow with a single scriptable task in it
2) Add an input named "gateway" of type "vCloud:Gateway" and be sure the input is bound to the scriptable task
3) Paste this code into the scriptable task
4) Save and Close
5) Run the workflow, providing a valid vCloud:Gateway object as input
6) Review the Logs tab of your vRealize Orchestrator client
@imtrinity94
imtrinity94 / associateNetworkPoolWithPvdcNsxt.js
Last active May 15, 2023 16:11
Associates a Network Pool with NSXT Provider Vdc
/**
*
* 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