Skip to content

Instantly share code, notes, and snippets.

View imtrinity94's full-sized avatar
💭
Blogging

Mayank Goyal imtrinity94

💭
Blogging
View GitHub Profile
@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
@imtrinity94
imtrinity94 / getNsxTypeOfPvdc.js
Created May 15, 2023 04:32
vRO Script to find if VCD pVDC is NSXT backed or NSXV?
if (! System.getModule("actions.mayank.goyal").aValidInput(pVDCName)) {
throw "'pVDCName' input parameter either null or undefined !";
}
// Get Local VCD URL
var vcdHostUrl = System.getModule("actions.mayank.goyal").getTransientRestHostFor("VCD").url;
// Get Auth Token for VCD
var authToken = System.getModule("actions.mayank.goyal").getAPIToken();
@imtrinity94
imtrinity94 / snippet.js
Created May 11, 2023 16:39 — forked from vmwarecode/snippet.js
Find vSphere VM by Name across all vCenters in vRealize Orchestrator
//action Inputs:
// vmName - string
//
//Return Type: VC:VirtualMachine
var found = VcPlugin.getAllVirtualMachines(null, "xpath:name[matches(.,'"+vmName+"')]");
if (found.length > 1) {
throw(vmName+" matched more than one Virtual Machine");
}
if (found.length == 1) {
@imtrinity94
imtrinity94 / vRO_convertToCIDRNotation.js
Last active April 10, 2023 16:46
vRO_convertToCIDRNotation.js
/**
*
* @module com.mayank.goyal
* @version 4.0.0
*
* @param {string} gatewayIP 192.10.21.0
* @param {string} subnetmaskIP 255.255.255.192
*
* @outputType string 192.10.21.0/26
*
@imtrinity94
imtrinity94 / vro_WorkflowOps.js
Created April 4, 2023 05:52
get Workflow details inside vRO Script.js
System.log("TokenName: "+workflow.currentWorkflow.name); -> Workflow Name
System.log("TokenName: "+workflow.name); -> Token Name
System.log("WorkflowName: "+workflow.rootWorkflow.name); -> Workflow Name
var wfInstance = Server.getWorkflowWithId(workflow.currentWorkflow.id);
System.log(wfInstance.workflowCategory.path +"/"+wfInstance.name); -> Workflow Path/Workflow Name
System.log(System.currentWorkflowItem.itemName); undefined
System.log("WorkflowObject: "+wfInstance); -> Workflow type object
System.log("WorkflowFirstItem: "+wfInstance.firstitem); undefined
System.log("*** List of items in Workflow");
for (var i = 0; i < wfInstance.items.length; i++)