With all the new learning going on, in an effort to try to retain this information, I will be using these posts as documentation. (Also, because I am not finding a lot of this out there in blog land already.)
Today’s learning is using APIs to deploy an existing vAPP Template in vRealize Orchestrator. The last post I had, specified how I used the Instantiate vAPP workflow to deploy and then some java scripts to modify the newly created NSX network. To get closer to full automation for users, we need to figure out a way to deploy this through say a webpage or catalog of some sort. vRealize Automation has something like this already called a Service Broker. vCloud Director doesn’t have this – at least not yet. So, we need to figure out what code to use.
To know what API ID to use, we can use the Orchestrator UI itself.
This ID is what we can use in something like Postman to run a call against in order to call it. Our operation will go against executions and the address looks like this:
https://yourOrchestratorURL/vco/api/workflows/e69fd725-a1ae-4a9d-86b2-ee05146cc30e/executions/
You can see the ID right before /executions. Now you also need to add data into the body to supply the parameters it’s looking for. The question / problem is what parameters need to be passed? You can get an indication from the inputs in the workflow, but a much easier way is to do a GET against a completed workflow. You can find the ID of one if you look under Activity and then choose one that has completed.
Using that at the end of the GET code you can get the parameters that were passed.
The parameters will look like this (change for your own Cloud Director install)
{
“parameters”: [
{
“value”: {
“sdk-object”: {
“type”: “vCloud:VAppTemplate”,
“href”: “https://YourOrchestratorURL:443/vco/api/catalog/vCloud/VAppTemplate/b41d6c2cf6bb582da8fc59f61357c4fcc3a7d23c3c39b561b98eaa1743e0d81f%253A%253A%253A%253AaHR0cHM6Ly92Y2QxLnNvbHV0aW9uc2xhYi5wdXJlc3RvcmFnZS5jb20vYXBpL3ZBcHBUZW1wbGF0ZS92YXBwVGVtcGxhdGUtNWNmNTljNTgtMmYxZS00OGM5LWI3OWYtMDZhNzNlN2ZjMzhh/”,
“id”: “b41d6c2cf6bb582da8fc59f61357c4fcc3a7d23c3c39b561b98eaa1743e0d81f::::aHR0cHM6Ly92Y2QxLnNvbHV0aW9uc2xhYi5wdXJlc3RvcmFnZS5jb20vYXBpL3ZBcHBUZW1wbGF0ZS92YXBwVGVtcGxhdGUtNWNmNTljNTgtMmYxZS00OGM5LWI3OWYtMDZhNzNlN2ZjMzhh”
}
},
“type”: “vCloud:VAppTemplate”,
“name”: “vappTemplate”,
“scope”: “local”
},
{
“value”: {
“sdk-object”: {
“type”: “vCloud:Vdc”,
“href”: ” https://YourOrchestratorURL:443/vco/api/catalog/vCloud/Vdc/b41d6c2cf6bb582da8fc59f61357c4fcc3a7d23c3c39b561b98eaa1743e0d81f%253A%253A%253A%253AaHR0cHM6Ly92Y2QxLnNvbHV0aW9uc2xhYi5wdXJlc3RvcmFnZS5jb20vYXBpL3ZkYy85OWMzY2NmOS02NjU3LTQyMmUtYmQ5Mi1iMDQ1N2Y5MTY2MGM/”,
“id”: “b41d6c2cf6bb582da8fc59f61357c4fcc3a7d23c3c39b561b98eaa1743e0d81f::::aHR0cHM6Ly92Y2QxLnNvbHV0aW9uc2xhYi5wdXJlc3RvcmFnZS5jb20vYXBpL3ZkYy85OWMzY2NmOS02NjU3LTQyMmUtYmQ5Mi1iMDQ1N2Y5MTY2MGM”
}
},
“type”: “vCloud:Vdc”,
“name”: “vdc”,
“scope”: “local”
},
{
“type”: “string”,
“name”: “name”,
“value”: {
“string”: {
“value”: “TestVariable” //This is the name you want to create the new VAPP with
}
}
},
{
“type”: “string”,
“name”: “description”
},
{
“type”: “boolean”,
“name”: “deploy”,
“value”: {
“boolean”: {
“value”: “True”
}
}
},
{
“type”: “boolean”,
“name”: “powerOn”,
“value”: {
“boolean”: {
“value”: “False”
}
}
},
{
“type”: “boolean”,
“name”: “eulaAccepted”
},
{
“type”: “number”,
“name”: “runtimeLeaseHours”
},
{
“type”: “number”,
“name”: “storageLeaseHours”
},
{
“type”: “boolean”,
“name”: “linkedClone”
},
{
“type”: “boolean”,
“name”: “deleteSource”,
“value”: {
“boolean”: {
“value”: “False”
}
}
}
]
}
The “href” and “ID” will of the workflow changes if you make a changes to it and then save it. So keep that in mind. I haven’t found a way to get it without the above yet – If anyone does know, feel free to reach out to me. The “href” and “ID” of the VDC will only change if you are using a different one, etc.
The above parameters need to be added to the “body” of the POST when you run it in Postman or wherever you are running it from. The above is in JSON format so you would need to tell it that when you POST.
The Saga will continue…..