Skip to content

Instantly share code, notes, and snippets.

@YagmurOzden
YagmurOzden / getClustersHost.js
Created April 5, 2022 08:22
returns a random host belonging to that cluster , vRO, vRO action, workflow, cluster, host
// VMware vRealize Orchestrator action sample
// vRA 8.4
//workflow return type: (VC:HostSystem),
// input type: cluster(string, Enter the cluster entry so that the host can be selected)
// this code below gets all clusters
var clusters =VcPlugin.getAllClusterComputeResources();
var hosts = VcPlugin.getAllHostSystems();
@YagmurOzden
YagmurOzden / PowerONVM.js
Created July 29, 2022 09:25
Powering on the VM with vim3WaitTaskEnd. VMware vRealize Orchestrator vRO 8.5.0, JavaScprit
// VMware vRealize Orchestrator action sample
// vRA 8.5.0
//action input type: vm : VC:VirtualMachine
//action return type: void
var poweronTask = vm.powerOnVM_Task();
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(
@YagmurOzden
YagmurOzden / PowerOFFVM.js
Created July 29, 2022 09:26
Powering off the VM with vim3WaitTaskEnd. VMware vRealize Orchestrator vRO 8.5.0, JavaScprit
// VMware vRealize Orchestrator action sample
// vRA 8.5.0
//action input type: vm : VC:VirtualMachine
//action return type: void
var poweroffTask = vm.powerOffVM_Task();
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(
@YagmurOzden
YagmurOzden / RestTemplate.js
Created August 29, 2022 09:14
Rest Template for using rest operations.
// VMware vRealize Orchestrator action sample
// vRA 8.7.0
// input type: restHost [REST:RESTHost]
// return type: Any
function createRestOperation(method, urlTemplate) {
var op = new RESTOperation(urlTemplate);
op.name = urlTemplate;
op.method = method;
@YagmurOzden
YagmurOzden / getConfigurationElements.js
Created August 29, 2022 09:29
Returns the configuration element
// VMware vRealize Orchestrator action sample
// vRA 8.7.0
// input types: categoryPath [string]
configName [string]
// return type: ConfigurationElement
var category = Server.getConfigurationElementCategoryWithPath(categoryPath);
for each (var c in category.configurationElements){
if (c.name == configName){
return c;
@YagmurOzden
YagmurOzden / mailContent.js
Created January 6, 2022 07:34
content of the mail about catalog item informations. | VMware vRO workflow, vSphere, GuestOS, VM, Virtual Machine, vRO action, mail content with html css
// VMware vRealize Orchestrator action sample
// vRA 8.4
//workflow input type: time (number),
// date (string)
//workflow return type: string
@YagmurOzden
YagmurOzden / json_marshal_unmarshal.go
Created November 24, 2022 09:00 — forked from miguelmota/json_marshal_unmarshal.go
Golang JSON Marshal (struct to string) (M for "Make json") and Unmarshal (string to struct) (U for "Unmake json") example
package main
import (
"encoding/json"
"fmt"
)
func main() {
type MyStruct struct {
Message string `json:"message"`
package main
import (
"Github/controller"
"Github/routes"
"log"
"github.com/gofiber/fiber/v2"
)
package routes
import (
controller "Github/controller"
"github.com/gofiber/fiber/v2"
)
func VMRoute(app *fiber.App) {
package model
type VMs struct {
Provider string `json:"provider,omitempty" ` //AWS , Azure:
ProjectID string `json:"projectId,omitempty"` //AWS: Account, Azure: Subscription
Location string `json:"location,omitempty"` //AWS: Region, Azure: Resporce Group
VMName string `json:"vmName,omitempty"` //Virtual Machine Name
VMStartAt string `json:"startsAt,omitempty"` //Virtual Machine start time
VMStopAt string `json:"stopsAt,omitempty"` //Virtual Machine stop time
Credential interface{} `json:"credential,omitempty"` //VirtualMachine's credential information