Last active
September 12, 2019 23:58
-
-
Save trisharia/f0efbbf4217ccbfff29d8f0e39f28b33 to your computer and use it in GitHub Desktop.
Get a vRA/vRA Cloud Deployment by ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // VMware vRealize Orchestrator action sample | |
| // | |
| // Get vRA/vRA Cloud deployment details in JSON format, given its ID | |
| // Assumes the presence of action System.getModule("com.vmware.pso.rest").executeTransientRESTOperation | |
| // Obtain the action here: https://gist.github.com/trisharia/7b62fcdf12600511b3d7e9b635981b2c | |
| // | |
| // For vRA Cloud 7.0+ and vRA 8.0+ | |
| // | |
| // Action Inputs: | |
| // cspBaseUrl - string - Base URL for connecting to VMware Cloud Services RESTful API | |
| // e.g., https://api.mgmt.cloud.vmware.com | |
| // cspAuthToken - string - VMware Cloud Services bearer token | |
| // Get this token by running the following action first: https://gist.github.com/trisharia/4262427728b9ca2f22f76c39a5521768 | |
| // id - string - Deployment ID | |
| // | |
| // Return type: Any - JSON object of vRA/vRA Cloud deployment details | |
| const opMethod = "GET"; | |
| const opUrl = "/deployment/api/deployments/{0}"; | |
| var urlParamValues = [id]; | |
| var headers = new Properties(); | |
| headers.put("Authorization", "Bearer " + cspAuthToken); | |
| var opResponse = System.getModule("com.vmware.pso.rest").executeTransientRESTOperation( | |
| cspBaseUrl,null,null,opMethod,opUrl,urlParamValues,headers,null,null); | |
| if (opResponse.statusCode >= 400) { | |
| throw "Failed to get deployment (" + opResponse.statusCode + " Error). Details: " + opResponse.responseString; | |
| } | |
| var responseJson = JSON.parse(opResponse.responseString); | |
| return responseJson; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment