#!/bin/bash #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Setup #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ comp_id="<your comp-id>" comp_name="<comp name>" env_id="<env-id>" comp_proc_id="comp_process id” # D version_id="comp version id" ucd_url="https://ucd.jupiter.com" payload_filename="payload.json" top_level_resource='/my reourse - /UTIL' host="nuptune" agent_level_resource=${host} resource_parent="${top_level_resource}/${agent_level_resource}" user="bob" #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Functions #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function create_payload(){ echo "RUNNING: java -jar ~/udclient/udclient.jar -username $user -weburl $ucd_url getResources -parent \"${resource_parent}\"" resource_id=$(java -jar ~/udclient/udclient.jar -username $user -weburl $ucd_url getResources -parent "${resource_parent}" | \ grep $comp_name -B 2 | grep id | sed -e s/'"id": "'// | sed -e s/'",'// | xargs) echo "{\"environmentId\":\"${env_id}\",\"resourceId\":\"${resource_id}\",\"componentProcessId\":\"${comp_proc_id}\",\"versionId\":\ \"${version_id}\",\"properties\":{}}" > $payload_filename } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Main #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ create_payload curl -v -k ${ucd_url}/rest/deploy/component/${comp_id}/runProcess -u "${user}:${DS_PASSWORD}" -X PUT --data @${payload_filename}
Saturday, 13 January 2018
Run a UCD component process programatically
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment