Table of contents
Table of Contents |
---|
Introduction
Virtual Machine Templates
...
are master copies of virtual machines that can be used to create and provision virtual machines. Templates by design, cannot be powered on or
...
edited since they offer a more secure way of preserving a virtual machine configuration that you want to deploy many times. With the RESTful API you can build your
...
own Virtual Machines
...
and then mark them
...
as templates, and vice versa. With this resource you can list
...
our publicly available Templates
...
and any you have created.
The following table shows a brief description
...
and HTTP
...
methods allowed to interact
...
with Virtual Machine Templates.
Resource | URI | Description | GET | POST | PUT | PATCH |
---|
...
VM Templates | /template | Virtual Machine Template resource. List Virtual Machine Templates. |
...
Note | |||||
---|---|---|---|---|---|
| |||||
Remember, you can also show what methods are allowed and method description, parameters, etc. by making an OPTIONS HTTP request to /v2/template.
|
Panel | ||||
---|---|---|---|---|
On this page:
|
List
In order to list available Virtual Machine Templates you should make a GET request to the endpoint /v2/template, passing your access token. As a result, you will get a reference URI /v2/vm/<moref> to get detailed information about the object.
The following examples uses HTTPie and CURL to list all templates a user have access to:
Code Block |
---|
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/template"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/template" |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{
"_links": {
"api": "https://vss-api.eis.utoronto.ca:8001/v2",
"self": "https://vss-api.eis.utoronto.ca:8001/v2/template"
},
"data": [
{
"_links": {
"self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012f4f0-443b-9cc4-1256-3d78093e7d30"
},
"cpuCount": 1,
"folder": {
"_links": {
"self": "https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v6807"
},
"moref": "group-v6807",
"name": "Templates",
"parent": "APIDemo"
},
"guestFullName": "Ubuntu Linux (64-bit)",
"ipAddress": null,
"memoryMB": 1024,
"name": "Ubuntu_64b-14.04",
"overallStatus": "green",
"powerState": "poweredOff",
"provisionedGB": 41,
"uuid": "5012f4f0-443b-9cc4-1256-3d78093e7d30"
}
...
],
"meta": {
"count": 4,
"time": "0.89966s",
"user": "jm"
}
}
|
Note |
---|
As you can see, this resource looks pretty much as the Virtual Machine resource, and in fact it uses the VM resource to provide further information about the Template. At the end a Virtual Machine template is a Virtual Machine with a different state, however you cannot edit a template until it's marked as Virtual Machine. |
Filters
This resource has one filter and one flag to narrow down the number of Networks shown in the result.
Name | Description |
---|---|
name | Virtual Machine Template name |
summary | Disables VM Template summary in results. |
The following examples show how to narrow down a VM template search first by adding name as a parameter in the request and then adding summary for only showing uuid, _links and name.
Code Block |
---|
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/template?name=ubuntu"
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/template?name=ubuntu&summary" |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{
"_links": {
"api": "https://vss-api.eis.utoronto.ca:8001/v2/",
"self": "https://vss-api.eis.utoronto.ca:8001/v2/template"
},
"data": [
{
"_links": {
"self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50122e44-9ddd-2497-7b6c-a3bc52749c52"
},
"cpuCount": 1,
"folder": {
"_links": {
"self": "https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v6807"
},
"moref": "group-v6807",
"name": "Templates",
"parent": "APIDemo"
},
"guestFullName": "CentOS 4/5/6/7 (64-bit)",
"ipAddress": null,
"memoryMB": 2048,
"name": "CentOS_64b-7",
"overallStatus": "green",
"powerState": "poweredOff",
"provisionedGB": 42,
"uuid": "50122e44-9ddd-2497-7b6c-a3bc52749c52"
}
],
"meta": {
"count": 1,
"time": "0.77485s",
"user": "jm"
}
} |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{
"_links": {
"api": "https://vss-api.eis.utoronto.ca:8001/v2/",
"self": "https://vss-api.eis.utoronto.ca:8001/v2/template"
},
"data": [
{
"_links": {
"self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50122e44-9ddd-2497-7b6c-a3bc52749c52"
},
"name": "CentOS_64b-7",
"uuid": "50122e44-9ddd-2497-7b6c-a3bc52749c52"
}
],
"meta": {
"count": 1,
"time": "0.69355s",
"user": "jm"
}
} |