mirror of
https://github.com/jbowdre/vRealize.git
synced 2024-10-31 19:02:17 +00:00
Create vcLogout.js
This commit is contained in:
parent
97e3d47f43
commit
970154e24d
1 changed files with 12 additions and 0 deletions
12
Orchestrator/Actions/com.virtuallypotato.utility/vcLogout.js
Normal file
12
Orchestrator/Actions/com.virtuallypotato.utility/vcLogout.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* JavaScript: vcLogout action
|
||||||
|
Logs out of a connected vCenter REST endpoint.
|
||||||
|
Inputs: token (string), vCenterName (string)
|
||||||
|
Return type: string
|
||||||
|
*/
|
||||||
|
var host = System.getModule("com.virtuallypotato.utility").getConfigValue("vPotato", "Endpoints", vCenterName).host;
|
||||||
|
System.debug("Closing vCenter API session: " + token);
|
||||||
|
var request = host.createRequest("DELETE", "/api/session");
|
||||||
|
request.setHeader("Content-Type", "application/json");
|
||||||
|
request.setHeader("vmware-api-session-id", token);
|
||||||
|
var result = request.execute().statusCode;
|
||||||
|
System.debug("Result status code: " + result);
|
Loading…
Reference in a new issue