mirror of
https://github.com/jbowdre/vRealize.git
synced 2024-10-31 19:02:17 +00:00
Delete vraGetVcenter.js
This commit is contained in:
parent
b47a046227
commit
59d052193d
1 changed files with 0 additions and 20 deletions
|
@ -1,20 +0,0 @@
|
||||||
/* JavaScript: vraGetVcenter action
|
|
||||||
Returns the vCenter hostname associated with a given site.
|
|
||||||
Inputs: zoneName (string)
|
|
||||||
Return type: string
|
|
||||||
*/
|
|
||||||
var cloudAccountId = null;
|
|
||||||
var token = System.getModule("com.virtuallypotato.utility").vraLogin();
|
|
||||||
var zones = JSON.parse(System.getModule("com.virtuallypotato.utility").vraExecute(token, "GET", "/iaas/api/zones", null)).content;
|
|
||||||
System.debug("Zones: " + JSON.stringify(zones));
|
|
||||||
for each (zone in zones) {
|
|
||||||
if (zone.name === zoneName) {
|
|
||||||
cloudAccountId = (zone._links["cloud-account"].href).split('/').pop();
|
|
||||||
}
|
|
||||||
if (cloudAccountId != null) { break; };
|
|
||||||
}
|
|
||||||
System.debug("Cloud Account ID: " + cloudAccountId);
|
|
||||||
var vCenterName = JSON.parse(System.getModule("com.virtuallypotato.utility").vraExecute(token, "GET", "/iaas/api/cloud-accounts-vsphere/" + cloudAccountId, null)).hostName.split('.')[0];
|
|
||||||
System.getModule("com.virtuallypotato.utility").vraLogout(token);
|
|
||||||
|
|
||||||
return vCenterName;
|
|
Loading…
Reference in a new issue