Virtual Machine - Attributes
Summary
Resource | URI | Description | GET | POST | PUT | DELETE | PATCH |
---|---|---|---|---|---|---|---|
CPU | /vm/<vm-id>/cpu | CPU resource. Get CPU count, quick stats and update cpu count | |||||
CPU settings | /vm/<vm-id>/cpu/config | CPU settings. Get and update CPU Hot add/remove setting | |||||
Memory | /vm/<vm-id>/memory | Memory resource. Get Memory count, quick stats and update memory size | |||||
Firmware | /vm/<vm-id>/firmware | Get or update firmware type. | |||||
Disk | /vm/<vm-id>/disk | Disk resource. List, create and delete virtual disks. | |||||
Disk Unit | /vm/<vm-id>/disk/<disk_number> | Get specific disk information such as size, controller, provisioning. List update and delete virtual Disk. | |||||
Disk Unit Backing | /vm/<vm-id>/disk/<disk_number>/backing | Get physical VMDK file backing and more information. | |||||
Disk Unit SCSI controller | /vm/<vm-id>/disk/<disk_number>/scsi | Get and update SCSI adapter of a given disk unit | |||||
Disk Unit Sharing | /vm/<vm-id>/disk/<disk_number>/sharing | Get and update Disk Sharing | |||||
Controllers | /vm/<vm-id>/controller | IO Controllers including SCSI and IDE | |||||
SCSI Controllers | /vm/<vm-id>/controller/scsi | Available SCSI controllers in the VM. Create, list and delete SCSI controllers | |||||
SCSI Controller | /vm/<vm-id>/controller/scsi/<bus> | Get a specific SCSI controller info. Update controller type or delete given controller | |||||
Floppy | /vm/<vm-id>/floppy | Floppy resource. List available floppy units. | |||||
Floppy Number | /vm/<vm-id>/floppy/<unit> | List current Floppy unit and update backend configuration. | |||||
CD/DVD | /vm/<vm-id>/cd | CD/DVD resource. List VM cd/dvd units. | |||||
CD/DVD Number | /vm/<vm-id>/cd/<unit> | CD/DVD unit resource. List current CD/DVD unit and update backend configuration. | |||||
Boot Options | /vm/<vm-id>/boot | Boot resource. Get and update boot configuration options. | |||||
Logical Folder | /vm/<vm-id>/folder | Logical Folder resource. Get and update containing folder. | |||||
Name | /vm/<vm-id>/name | Instance name. List and update assigned name without VSS prefix | |||||
Network Interface Card | /vm/<vm-id>/nic | Network interface list. | |||||
Network Interface Card Number | /vm/<vm-id>/nic/<unit> | Network interface unit. List, create, update or delete NIC. | |||||
Template | /vm/<vm_uuid/template | Template state. Mark VM as template or template as VM. | |||||
Operating System | /vm/<vm_uuid/os | Configured Operating System | |||||
Guest | /vm/<vm-id>/guest | Running Guest related configuration | |||||
Guest Operating System | /vm/<vm-id>/guest/os | Running Operating System configuration | |||||
Guest VMware Tools | /vm/<vm-id>/guest/tools | Guest VMware Tools configuration. | |||||
Guest Network | /vm/<vm-id>/guest/net | Guest network configuration. | |||||
Guest Network IP | /vm/<vm-id>/guest/net/ip | Guest network Ip address configuration. | |||||
Guest Process | /vm/<vm-id>/guest/cmd | Guest running processes or execute program | |||||
Guest Process ID | /vm/<vm-id>/guest/cmd/<pid> | Guest process management | |||||
State | /vm/<vm-id>/state | Power state. | |||||
Domain | /vm/<vm-id>/domain | Fault domain. | |||||
Triggered Alarms | /vm/<vm-id>/alarm /vm/<vm-id>/alarm/<moref> | Triggered Alarms. Shows list of triggered alarms. Specific Triggered Alarms. Lists, clears and acknowledges alarm. | |||||
Events | /vm/<vm-id>/event /vm/<vm-id>/alarm/<hour_window> | Instance related vCenter events within 1 hour by default. | |||||
Note | /vm/<vm-id>/note | Instance Annotation. List raw virtual Machine annotation. | |||||
Client Notes | /vm/<vm-id>/note/client | Metadata Client custom notes if any. | |||||
Snapshots | /vm/<vm-id>/snapshot /vm/<vm-id>/snapshot/<snapshot_id> | Virtual Machine Snapshot resource. List or create VM snapshots. List, delete and restore from <snapshot_id> | |||||
Disk Consolidation | /vm/<vm-id>/snapshot/consolidate | Disk consolidation status. List if disk consolidation is required and execute consolidation | |||||
Performance | /vm/<vm-id>/performance | Performance statistics, including datastore IO, memory, CPU and network. | |||||
Console | /vm/<vm-id>/console | HTML5 one-time console link. | |||||
Export | /vm/<vm-id>/export | OVF export action to vskey-stor. | |||||
VMX Version | /vm/<vm-id>/version | Virtual hardware version and upgrade policy. | |||||
Extra Configuration | /vm/<vm-id>/extra-config | Manage VMware **guestinfo** interface options, which are available to the VM guest operating system via VMware Tools. | |||||
VSS | /vm/<vm-id>/vss | VSS related metadata. | |||||
VSS Admin | /vm/<vm-id>/vss/admin | Administrator. List or update VM admin name and contact info. | |||||
VSS Inform | /vm/<vm-id>/vss/inform | Informational contacts. List or update VM informational contacts. | |||||
VSS Usage | /vm/<vm-id>/vss/usage | Instance designated usage. | |||||
VSS HA Group | /vm/<vm-id>/vss/ha-group | HA group metadata. | |||||
VSS Client | /vm/<vm-id>/vss/client | Client Department | |||||
VSS Description | /vm/<vm-id>/vss/description | Description | |||||
VSS Options | /vm/<vm-id>/vss/option | VSS Options | |||||
VSS Service | /vm/<vm-id>/vss/service | VSS Service. | |||||
Configuration specification | /vm/<vm-id>/spec | Instance spec. Will dump VM specifications (shell). | |||||
Guest OS Customization Specification | /vm/<vm-id>/custom-spec | Guest os customization specification. |
<vm-id> is either Managed Object Reference Id or UUID.
TK stores the Cloud API Token generated as a result of the following POST request to the /auth/request-token resource:
curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username>
For example, extracting the token with the jq command:
TK=$(curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username> | jq '.token')
CPU
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
CPU | /vm/<vm-id>/cpu | Virtual Machine CPU resource. Get CPU count, quick stats and update cpu count |
Info
Requesting cpu info can be as easy as making a GET request to /vm/<vm-id>/cpu as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu"
Respose from the API would look something like:
HTTP/1.0 200 OK Allow: PUT, HEAD, OPTIONS, GET Content-Length: 385 Content-Type: application/json Date: Wed, 27 Apr 2016 17:47:28 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7179 X-RateLimit-Reset: 1461780000
Update
Increasing or decreasing CPU and Cores Per Socket can be done by making a PUT request to /vm/<vm-id>/cpu as shown below:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" value:=3 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" -d '{"value": 3}' curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" -d '{"value": {"count": 4, "cores_per_socket": 2}}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 18:15:08 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/827f4a45-db84-4799-b2f8-a02c85e003be X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7197 X-RateLimit-Reset: 1461783600
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Memory
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
Memory | /vm/<vm-id>/memory | Virtual Machine Memory resource. Get Memory count, quick stats and update memory size |
Info
Requesting memory info can be as easy as making a GET request to /vm/<vm-id>/memory as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: PUT, HEAD, OPTIONS, GET Content-Length: 555 Content-Type: application/json Date: Wed, 27 Apr 2016 18:21:25 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7193 X-RateLimit-Reset: 1461783600
Update
Increasing or decreasing CPU can be done by making a PUT request to /vm/<vm-id>/memory as shown below:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" value:=3 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" -d '{"value": 3}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 18:15:08 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/0f39fa9f-4f35-426a-8ebb-8f1b34588fef X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7197 X-RateLimit-Reset: 1461783600
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Virtual Disk
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
Disk | /vm/<vm-id>/disk | Virtual Machine disk resource. Get VM disks, and capacity. | |||||
Disk Number | /vm/<vm-id>/disk/<disk_number> | Virtual Machine disk resource. Get specific disk information such as size, controller, provisioning. Update size or delete. |
List
Virtual Disks can be listed by a GET request to /v2/<vm-id>/disk resource. You will get the list of disks and the Hypermedia reference to the every disk available in the VM:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, OPTIONS, GET Content-Length: 652 Content-Type: application/json Date: Wed, 27 Apr 2016 18:26:42 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7188 X-RateLimit-Reset: 1461783600
Info
Displaying specific information of a disk such as controller, backing file, provisioning, capacity, etc. can be done by a GET request to /v2/vm/<vm-id>/disk/<disk_number> as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 688 Content-Type: application/json Date: Wed, 27 Apr 2016 18:37:30 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7186 X-RateLimit-Reset: 1461783600
If requested disk does not exist, you'll get a 404 response status as follows:
Update
PUT request to /vm/<vm-id>/disk/<disk_number> will submit a change request to update capacity. The following JSON object is expected as request body:
{"attribute": "capacity", "value": 200}
The value of the key value is the new size of the Disk in GB.
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" attribute=capacity value=200 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" -d '{"attribute": "capacity", "value": 200}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 18:58:10 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/2f2b7baf-3abf-48f1-8d16-9dc63641a800 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7178 X-RateLimit-Reset: 1461783600
Create
A POST request should be made to /vm/<vm-id>/disk in order to create a disk or multiple with the following JSON object as request body:
{"value": [80, 100, 100]}
The value of the key value is either the new size of the Disk in GB or for advanced setup, the following object structure:
[{"capacity_gb": 80, "backing_mode": "persistent", "backing_sharing": "sharingnone" "backing_vmdk": "<vssUsers_path>"}]
http POST "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" value:='[80, 100, 100]' "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X POST "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" -d '{"value": [80, 100, 100]}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 18:52:23 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/4ecfa88d-1d1a-44fa-bb9b-d0ab04c17691 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7180 X-RateLimit-Reset: 1461783600
Delete
To delete a disk or multiple disks you must submit a DELETE request to /vm/<vm-id>/disk/<disk_number> with no request body as follows:
# Just one disk http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" # Disk labels in array http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" value:='[2,3]' "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" -d '{"value": [2,3]}'
This action cannot be undone.
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 18:52:23 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/4ecfa88d-1d1a-44fa-bb9b-d0ab04c17691 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7180 X-RateLimit-Reset: 1461783600
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Floppy
List
Virtual Floppy units are listed by making a GET request to /v2/<vm_uuid/floppy which will return a list of available units to display further information from:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy"
Response from the API would look something like:
HTTP/1.1 200 OK Allow: HEAD, OPTIONS, GET Connection: keep-alive Content-Length: 521 Content-Type: application/json Date: Mon, 27 Jun 2016 15:14:16 GMT Server: nginx Strict-Transport-Security: max-age=63072000 X-Content-Type-Options: nosniff X-Frame-Options: DENY X-RateLimit-Limit: 3000 X-RateLimit-Remaining: 2999 X-RateLimit-Reset: 1467043200
In this particular case, the floppy unit has no image as backend device.
Info
Displaying specific information of a disk such as controller, backing file, etc. can be done by a GET request to /v2/vm/<vm-id>/floppy/<floppy_number> as shown below:
Response from the API would look something like:
HTTP/1.1 200 OK Allow: PUT, HEAD, OPTIONS, GET Connection: keep-alive Content-Length: 620 Content-Type: application/json Date: Mon, 27 Jun 2016 15:16:38 GMT Server: nginx Strict-Transport-Security: max-age=63072000 X-Content-Type-Options: nosniff X-Frame-Options: DENY X-RateLimit-Limit: 3000 X-RateLimit-Remaining: 2998 X-RateLimit-Reset: 1467043200
Update
Virtual Floppy units are not quite used as CD/DVDs, however, when the operating system is Windows and the VM has been configured with Paravirtual SCSI (PVSCSI) controllers, the installer requires to load VMwrare drivers to successfully see all virtual disks attached to PVSCSI controller. The drivers are available to mount from all ESXi hosts in [] /vmimages/floppies.
A PUT request to /vm/<vm-id>/floppy/<floppy_number> will submit a change request to update device backing, meaning client or floppy image. The following JSON object is expected as request body:
# floppy image {"attribute": "img", "value": "[] /vmimages/floppies/pvscsi-Windows2008.flp"} # client {"attribute": "client", "value": ""}
Making the HTTP request would look like:
httpPUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1" attribute=img value='[] /vmimages/floppies/pvscsi-Windows2008.flp' "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1" -d '{"attribute": "img", "value": "[] /vmimages/floppies/pvscsi-Windows2008.flp"}'
Response from the API would look something like:
HTTP/1.1 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Connection: keep-alive Content-Length: 431 Content-Type: application/json Date: Mon, 27 Jun 2016 15:20:10 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/6e52bcc5-0abf-4f12-89ab-5f1e4f17b896 Server: nginx X-RateLimit-Limit: 3000 X-RateLimit-Remaining: 2997 X-RateLimit-Reset: 1467043200
CD/DVD
List
Virtual CD/DVD units can be listed by a GET request to /v2/<vm-id>/cd resource. You will get the list of cd/dvd and the Hypermedia reference to the every unit available in the VM:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, OPTIONS, GET Content-Length: 652 Content-Type: application/json Date: Wed, 27 Apr 2016 18:26:42 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7188 X-RateLimit-Reset: 1461783600
Info
Displaying specific information of a disk such as controller, backing file, etc. can be done by a GET request to /v2/vm/<vm-id>/cd/<cd_number> as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 688 Content-Type: application/json Date: Wed, 27 Apr 2016 18:37:30 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7186 X-RateLimit-Reset: 1461783600
If requested a non existent CD/DVD unit, you'll get a 404 response status as follows:
Update
A PUT request to /vm/<vm-id>/cd/<cd_number> will submit a change request to update device backing, meaning client or iso image. The following JSON object is expected as request body:
# iso image {"attribute": "iso", "value": "[vss-ISOs] Windows/W10/Win10_English_x32.iso"} # client {"attribute": "client", "value": ""}
The ISO API resource provides a list of available ISOs to mount to the VM.
Making the HTTP request would look like:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" attribute=iso value='[vss-ISOs] Windows/W10/Win10_English_x32.iso' "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" -d '{"attribute": "iso", "value": "[vss-ISOs] Windows/W10/Win10_English_x32.iso"}'
Response from the API would look something like:
HTTP/1.1 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Connection: keep-alive Content-Length: 428 Content-Type: application/json Date: Fri, 20 May 2016 18:04:41 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/9b815488-e0d9-4b60-a94f-fe9b0fe46ec7 Server: nginx X-RateLimit-Limit: 3000 X-RateLimit-Remaining: 2993 X-RateLimit-Reset: 1463770800
Boot Options
The time when you power on the virtual machine, shows up the BIOS and launches the guest operating system software can be unnoticeable, because by default VMware sets up 0ms as boot delay. However, you can edit boot delay options to change that amount of time or to force the virtual machine to enter the BIOS setup screen after power on. This is done using the Boot resource in the RESTful API /vm/<vm-id>/boot.
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
Boot Options | /vm/<vm-id>/boot | Virtual Machine Boot resource. Get and update boot configuration options. |
Info
Showing what's currently configured as boot options is done by making a GET request to /vm/<vm-id>/boot as follows:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: PUT, HEAD, OPTIONS, GET Content-Length: 366 Content-Type: application/json Date: Wed, 27 Apr 2016 19:07:54 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7199 X-RateLimit-Reset: 1461787200
Update
Submitting a HTTP request using PUT to /vm/<vm-id>/boot is used to update two boot options: bootdelay, to change that amount of time from powering on to boot into the main device in milliseconds and bootbios, which will force to boot directly to the BIOS setup, boolean. The request body expected is a JSON object as follows:
# boot delay data {"attribute": "bootdelay", "value": 10000} # boot to bios data {"attribute": "bootbios", "value": true}
Updating VMs boot delay can be done as shown below:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" attribute=bootdelay value=10000 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" -d '{"attribute": "bootdelay", "value": 10000}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Content-Length: 397 Content-Type: application/json Date: Wed, 27 Apr 2016 19:33:47 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/f5de4b0d-6f00-44ae-870a-e2858134b6d0 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7197 X-RateLimit-Reset: 1461787200
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Logical Folder
This sub resource provides access to containing logical folder object in vCenter.
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
Folder | /vm/<vm-id>/folder | Virtual Machine containing Folder resource. Get and update containing folder. |
Info
Querying which folder is this VM on is done by doing a GET request to /v2/vm/<vm-id>/folder.
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: PUT, HEAD, OPTIONS, GET Content-Length: 508 Content-Type: application/json Date: Wed, 27 Apr 2016 19:42:16 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7196 X-RateLimit-Reset: 1461787200
The result will provide basic info about the folder such as name, parent and full path. Also, it provides a Hypermedia resource to the main /v2/folder/<moref> resource.
Update
Moving a VM to a specific logical folder is done by making a PUT request to /v2/vm/<vm-id>/folder with the moref (Managed object Reference) of the target folder, which can be obtained from the /v2/folder/ resource. The request body expected is a JSON object as shown below:
{"value": "group-v6736"}
Submitting a change request to update VMs logical folder can be done as follows:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" value=group-v6736 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" -d '{"value": "group-v6736"}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Content-Length: 398 Content-Type: application/json Date: Wed, 27 Apr 2016 19:57:45 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/b3a2c488-ebdb-4d27-9ceb-a5c1d3085672 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7192 X-RateLimit-Reset: 1461787200
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Name
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
Name | /vm/<vm-id>/name | Virtual Machine human readable name. List and update assigned name without VSS prefix |
Info
Requesting Name info can be as easy as making a GET request to /vm/<vm-id>/name as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name"
Respose from the API would look something like:
HTTP/1.0 200 OK Allow: PUT, HEAD, OPTIONS, GET Content-Length: 309 Content-Type: application/json Date: Thu, 28 Apr 2016 19:34:48 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7199 X-RateLimit-Reset: 1461873600
Update
Renaming a Virtual Machine can be done by making a PUT request to /vm/<vm-id>/name as shown below:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" value=Ubuntu4 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" -d '{"value": "Ubuntu4"}'
VSS prefix must not be included, if included the API will return a 400 error:
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: PUT, HEAD, OPTIONS, GET Content-Length: 398 Content-Type: application/json Date: Thu, 28 Apr 2016 17:46:12 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/e84558b9-4d18-41d2-9f4f-3ec873d37441 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7194 X-RateLimit-Reset: 1461866400
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Network Interface Card
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* |
---|---|---|---|---|---|---|---|
NIC | /vm/<vm-id>/nic | Virtual Machine nic resource. Get VM nic list. | |||||
NIC Number | /vm/<vm-id>/nic/<nic_number> | Virtual Machine specific network interface. List, create, update or delete NIC. |
List
Virtual machine nics can be listed making a GET request to /v2/<vm-id>/nic resource. You will get the list of nics and the Hypermedia reference to the actual nic for further actions and properties.
http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/nic" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/nic"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, OPTIONS, GET Content-Length: 820 Content-Type: application/json Date: Thu, 28 Apr 2016 20:42:39 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7184 X-RateLimit-Reset: 1461877200
Info
Displaying NIC specific information such as connection state, network, type, etc. can be done by making a GET request to /v2/vm/<vm-id>/nic/<nic_number> as shown below:
http GET "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1"
Response from the API would look something like:
HTTP/1.0 200 OK Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 534 Content-Type: application/json Date: Thu, 28 Apr 2016 20:47:35 GMT X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7181 X-RateLimit-Reset: 1461877200
If requested nic does not exist, you'll get a 404 response status as follows:
Update
There are two updates available to Network Interface Cards: network, state, type. Backend network updates require the Network Managed Object Reference which can be got from /v2/network/ resource, such as dvportgroup-00. NIC state on the other hand, has two options connect and disconnect given NIC. Finally, NIC type means which network adapter should be used between vmxnet3, vmxnet3, e1000, e1000e. Updates to NICs should be made by making a PUT request to /vm/<vm-id>/nic/<nic_number> with the following JSON object as request body:
# update network backend {"attribute": "network", "value": "dvportgroup-00"} # update state {"attribute": "state", "value": "connect"} # update nic adapter {"attribute": "type", "value": "vmxnet2"}
For instance, updating NIC 1 type to VMXNET2 is done as follows:
http PUT "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" attribute=type value=VMXNET2 "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" -d '{"attribute": "type", "value": "vmxnet2"}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 398 Content-Type: application/json Date: Thu, 28 Apr 2016 20:59:23 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/e6f4313c-5ffa-4e8c-8c52-b368cd08aa62 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7173 X-RateLimit-Reset: 1461877200
Create
A POST request should be submitted to /vm/<vm-id>/nic in order to create Network Interface Controllers with the Network MOREFs and Network Type in an array as value of the value key in JSON object sent as request body:
{"value": [{"network": "dvportgroup-00"}, {"network": "dvportgroup-01", "type": "vmxnet2"}]}
The value attribute is the Network MOREF.
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X POST "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" -d '{"value": [{"network": "dvportgroup-00"}, {"network": "dvportgroup-01", "type": "vmxnet2"}]}'
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 398 Content-Type: application/json Date: Fri, 29 Apr 2016 02:07:51 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/20e01be9-b91e-4db2-9e0d-66dbe602b536 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7194 X-RateLimit-Reset: 1461898800
Delete
To delete a NIC you must submit a DELETE request to /vm/<vm-id>/nic/<nic_number> with no request body as follows:
http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" # multiple nic deletion delting network adapter 2 and 3 http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" value:='[2, 3]' "Authorization: Bearer $TK" curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" -d '{2, 3}'
This action cannot be undone.
Response from the API would look something like:
HTTP/1.0 202 ACCEPTED Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE Content-Length: 398 Content-Type: application/json Date: Fri, 29 Apr 2016 02:05:36 GMT Location: https://vss-api.eis.utoronto.ca/v2/request/task/372da560-bc66-4ffa-a97e-f0b160a1e26f X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7195 X-RateLimit-Reset: 1461898800
Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.
Template
Virtual Machine Templates are useful If you create a virtual machine that you want to clone frequently, offering a more secure way of preserving a virtual machine configuration, since they are more difficult to alter than ordinary virtual machine. Templates are commonly referred as Master Copy of certain virtual machine, thus any virtual machine can be marked as template.
Resource | URI | Description | GET | POST | PUT | DELETE | OPTIONS* | |
---|---|---|---|---|---|---|---|---|
Template | /vm/<vm_uuid/template | Virtual Machine Template state. Mark VM as template or template as VM. |