mirror of
https://github.com/jbowdre/vRealize.git
synced 2024-11-23 10:12:18 +00:00
Create vcLogin.js
This commit is contained in:
parent
6d81f69b9a
commit
97e3d47f43
1 changed files with 13 additions and 0 deletions
13
Orchestrator/Actions/com.virtuallypotato.utility/vcLogin.js
Normal file
13
Orchestrator/Actions/com.virtuallypotato.utility/vcLogin.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* JavaScript: vcLogin action
|
||||
Retrieves a login token to a vCenter REST endpoint.
|
||||
Inputs: vCenterName (string)
|
||||
Return type: string
|
||||
*/
|
||||
var host = System.getModule("com.virtuallypotato.utility").getConfigValue("vPotato", "Endpoints", vCenterName).host;
|
||||
var request = host.createRequest("POST", "/api/session");
|
||||
request.setHeader("Content-Type", "application/json");
|
||||
var response = request.execute();
|
||||
var token = JSON.parse(response.contentAsString);
|
||||
System.debug("Created vCenter API session: " + token);
|
||||
|
||||
return token;
|
Loading…
Reference in a new issue