Created
September 13, 2019 00:28
-
-
Save trisharia/72dcf43c7e960856fd7008b4f278dc50 to your computer and use it in GitHub Desktop.
Patch vRA/vRA Cloud Deployment
This file contains 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 | |
// | |
// Update a vRA/vRA Cloud deployment | |
// 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 - ID of the deployment | |
// updates - string - Updates in JSON string format | |
// e.g., to change the deloyment name: | |
// updates = "{ \"name\" : \"" + machineResourceName + "\" }" | |
// | |
// Return type: void | |
const opMethod = "PATCH"; | |
const opUrl = "/deployment/api/deployments/{0}"; | |
const contentType = "application/json" | |
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,contentType,updates); | |
if (opResponse.statusCode >= 400) { | |
throw "Failed to patch deployment (" + opResponse.statusCode + " Error). Details: " + opResponse.responseString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment