Skip to content

Instantly share code, notes, and snippets.

View imtrinity94's full-sized avatar
🎯
Focusing on VMware VCF

Mayank Goyal imtrinity94

🎯
Focusing on VMware VCF
View GitHub Profile
@imtrinity94
imtrinity94 / LoggerClass.js
Created June 27, 2025 08:24
Aria Automation Orchestrator Enhanced Logger Module.js
/**
* Enhanced Logger Module by Mayank Goyal (https://cloudblogger.co.in)
*
* This logging module is an enhanced version of Gavin Stephen's Logger implementation.
* It provides additional features such as emoji support and improved error handling.
*
* Original Source:
* https://github.com/simplygeekuk/vcf-automation-maven/blob/main/source/vro-actions/src/main/resources/com/simplygeek/vcf/orchestrator/logging/Logger.js
*
* To toggle emojis in log messages:
@imtrinity94
imtrinity94 / getvROHostName.js
Created May 2, 2025 06:51
Get vRealize Orchestrator FQDN inside vRO itself using Command class
var com = new Command(["printenv", "|", "fgrep", "JVM_OPTS"]);
var res = com.execute(true); // makes the call blocking
var output = com.output;
System.debug(com.output);
var nodeName = output.match(/-Dvco.app.hostname=([^\s]+)/)[1];
System.log('vRO Hostname: ' + nodeName);
@imtrinity94
imtrinity94 / vrohelper.py
Created May 2, 2025 06:33 — forked from prydin/vrohelper.py
Simplified vRO API
from functools import lru_cache
import requests
import time
class AutomationClient:
"""
Low level Aria Automation/Orchestration client.
"""
@imtrinity94
imtrinity94 / Fastest way to get a vCenter VM.js
Created April 20, 2025 14:36
Fastest way to get a vCenter VM.js
var vmName = "gsg_133-107";
var vmID = "500eb5b0-e0e2-5583-65b8-a3471136cbc7";
System.log("Virtual Machine name: '" + vmName + "'");
System.log("Virtaul Machine ID: '" + vmID + "'");
System.log("\n");
System.log("Get VM from SearchIndex service. Fastest solution!");
duration_decorator(get_vm_via_search_index_service)();
// 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