# VMs

> A VM is a Linux computer of its own. It sleeps when it is quiet, and it wakes on the next SSH login, request or cron job.

## Endpoints

| Method | Path | Returns |
|---|---|---|
| `POST` | [`/v1/tenants/{tenant}/vms`](https://shako.dev/api/vms/create.md) | 201 with the VM object. |
| `GET` | [`/v1/tenants/{tenant}/vms`](https://shako.dev/api/vms/list.md) | 200 with {"data": [...]}: a list of the VM object or the unreachable VM object. |
| `GET` | [`/v1/tenants/{tenant}/vms/{name}`](https://shako.dev/api/vms/get.md) | 200 with the VM info object. |
| `PATCH` | [`/v1/tenants/{tenant}/vms/{name}`](https://shako.dev/api/vms/update.md) | 200 with the VM object. |
| `DELETE` | [`/v1/tenants/{tenant}/vms/{name}`](https://shako.dev/api/vms/delete.md) | 200 with the names of the path and "deleted": true. |
| `POST` | [`/v1/tenants/{tenant}/vms/{name}/sleep`](https://shako.dev/api/vms/sleep.md) | 200 with the VM object. |
| `POST` | [`/v1/tenants/{tenant}/vms/{name}/wake`](https://shako.dev/api/vms/wake.md) | 200 with the wake object. |
| `POST` | [`/v1/tenants/{tenant}/vms/{name}/restart`](https://shako.dev/api/vms/restart.md) | 200 with the VM object. |
| `POST` | [`/v1/tenants/{tenant}/vms/{name}/resize`](https://shako.dev/api/vms/resize.md) | 200 with the VM object. |
| `POST` | [`/v1/tenants/{tenant}/vms/{name}/rename`](https://shako.dev/api/vms/rename.md) | 200 with the VM object. |
| `POST` | [`/v1/tenants/{tenant}/vms/{source}/copy`](https://shako.dev/api/vms/copy.md) | 201 with the VM object. |
| `GET` | [`/v1/tenants/{tenant}/vms/{name}/logs`](https://shako.dev/api/vms/logs.md) | 200 with a string. |
| `GET` | [`/v1/tenants/{tenant}/vms/{name}/crons`](https://shako.dev/api/vms/crons.md) | 200 with the crons object. |

## Objects

- [The VM object](https://shako.dev/api/objects/vm-view.md): A VM. Create, get, update, the actions and copy answer with it; list answers with a list of it.
- [The VM info object](https://shako.dev/api/objects/vm-info.md): Get answers with the VM object and these fields.
- [The wake object](https://shako.dev/api/objects/wake-view.md): Wake answers with the VM object and these fields.
- [The unreachable VM object](https://shako.dev/api/objects/unreachable-vm.md): A VM in the list whose host does not answer now. Try again later.
- [The crons object](https://shako.dev/api/objects/vm-crons.md): The crons of a VM and its next wake.
