Skip to content
Snippets Groups Projects
Commit 19410ebf authored by Florent Gluck's avatar Florent Gluck
Browse files

Completed adding links to REST API

parent b64e2784
Branches
No related tags found
No related merge requests found
......@@ -2,69 +2,69 @@
### Login and version management
| Route | Description | Method | Input | Output |
|--- |--- |--- |--- |--- |
| `/login` | login (return access token) | POST | [common.params.Login](../src/common/params/login.go) | [common.params.Token](../src/common/params/login.go) |
| `/token/refresh` | obtain a new access token | GET | - | common.params.Token |
| `/version` | obtain version number | GET | - | common.params.Version |
| Route | Description | Method | Input | Output |
|--- |--- |--- |--- |--- |
| `/login` | login (return access token) | POST | [common.params.Login](../src/common/params/login.go) | [common.params.Token](../src/common/params/login.go) |
| `/token/refresh` | obtain a new access token | GET | - | [common.params.Token](../src/common/params/login.go) |
| `/version` | obtain version number | GET | - | [common.params.Version](../src/common/params/version.go) |
### User management
| Route | Description | Method | Input | Req. user cap. | Output |
|--- |--- |--- |--- |--- |--- |
| `/users` | create a user | POST | common.params.UserWithPwd | `USER_CREATE` | - |
| `/users/{email}` | delete a user | DELETE | - | `USER_DESTROY` | - |
| `/users/{email}/caps` | set caps for a user | PUT | common.params.UserSetCaps | `USER_SET_CAPS` | - |
| `/users/{email}/unlock` | unlock a user | PUT | - | `USER_UNLOCK` | - |
| `/users/{email}/resetpwd` | reset a user's pwd | PUT | - | `USER_RESETPWD` | common.params.UserSetPwd |
| `/users/pwd` | set current user's pwd | PUT | common.params.UserSetPwd | - | - |
| `/users` | list users | GET | - | `USER_LIST` | []common.params.UserWithoutPwd |
| `/users/whoami` | list current user | GET | - | - | common.params.UserWithoutPwd |
| Route | Description | Method | Input | Req. user cap. | Output |
|--- |--- |--- |--- |--- |--- |
| `/users` | create a user | POST | [common.params.UserWithPwd](../src/common/params/users.go) | `USER_CREATE` | - |
| `/users/{email}` | delete a user | DELETE | - | `USER_DESTROY` | - |
| `/users/{email}/caps` | set caps for a user | PUT | [common.params.UserSetCaps](../src/common/params/users.go) | `USER_SET_CAPS` | - |
| `/users/{email}/unlock` | unlock a user | PUT | - | `USER_UNLOCK` | - |
| `/users/{email}/resetpwd` | reset a user's pwd | PUT | - | `USER_RESETPWD` | [common.params.UserSetPwd](../src/common/params/users.go) |
| `/users/pwd` | set current user's pwd | PUT | [common.params.UserSetPwd](../src/common/params/users.go) | - | - |
| `/users` | list users | GET | - | `USER_LIST` | [\[\]common.params.UserWithoutPwd](../src/common/params/users.go) |
| `/users/whoami` | list current user | GET | - | - | [common.params.UserWithoutPwd](../src/common/params/users.go) |
- Open question: shall we forbid the deletion of a user if they still own templates or VMs?
### VM management
| Route | Description | Method | Input | Req. user cap. | Op. | Req. VM access cap. | Output |
|--- |--- |--- |--- |--- |--- |--- |--- |
| `/vms` | returns VMs that can be listed | GET | - | `VM_LIST_ANY` | OR | `VM_LIST` | []common.vm.VMNetworkSerialized |
| `/vms/{id}` | returns the specified VM | GET | - | `VM_LIST_ANY` | OR | `VM_LIST` | common.vm.VMNetworkSerialized |
| `/vms/start` | returns VM creds info for VMs that can be started | GET | - | `VM_START_ANY` | OR | `VM_START` | []common.vm.VMCredentialsSerialized |
| `/vms/attach` | returns VM creds info for VMs that can be attached to | GET | - | `VM_ATTACH_ANY` | OR | `VM_ATTACH` | []common.vm.VMCredentialsSerialized |
| `/vms/{id}/attach` | returns VM creds info for the specified VM | GET | - | `VM_ATTACH_ANY` | OR | `VM_ATTACH` | common.vm.VMCredentialsSerialized |
| `/vms/stop` | returns VM creds info for VMs that can be killed/shutdown | GET | - | `VM_STOP_ANY` | OR | `VM_STOP` | []common.vm.VMCredentialsSerialized |
| `/vms/reboot` | returns VM creds info for VMs that can be rebooted | GET | - | `VM_REBOOT_ANY` | OR | `VM_REBOOT` | []common.vm.VMCredentialsSerialized |
| `/vms/edit` | returns VM creds info for VMs that can be edited | GET | - | `VM_EDIT_ANY` | OR | `VM_EDIT` | []common.vm.VMCredentialsSerialized |
| `/vms/editaccess` | returns VM creds info for VMs that can have their access changed | GET | - | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | []common.vm.VMCredentialsSerialized |
| `/vms/del` | returns VM creds info for VMs that can be deleted | GET | - | `VM_DESTROY_ANY` | OR | `VM_DESTROY` | []common.vm.VMCredentialsSerialized |
| `/vms/exportdir` | returns VM creds info for VMs that can have a dir downloaded | GET | - | `VM_READFS_ANY` | OR | `VM_READFS` | []common.vm.VMCredentialsSerialized |
| `/vms/importfiles` | returns VM creds info for VMs allowing files upload | GET | - | `VM_WRITEFS_ANY` | OR | `VM_WRITEFS` | []common.vm.VMCredentialsSerialized |
| Route | Description | Method | Input | Req. user cap. | Op. | Req. VM access cap. | Output |
|--- |--- |--- |--- |--- |--- |--- |--- |
| `/vms` | returns VMs that can be listed | GET | - | `VM_LIST_ANY` | OR | `VM_LIST` | [\[\]common.vm.VMNetworkSerialized](../src/common/vm/vm.go) |
| `/vms/{id}` | returns the specified VM | GET | - | `VM_LIST_ANY` | OR | `VM_LIST` | [common.vm.VMNetworkSerialized](../src/common/vm/vm.go) |
| `/vms/start` | returns VM creds info for VMs that can be started | GET | - | `VM_START_ANY` | OR | `VM_START` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/attach` | returns VM creds info for VMs that can be attached to | GET | - | `VM_ATTACH_ANY` | OR | `VM_ATTACH` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/{id}/attach` | returns VM creds info for the specified VM | GET | - | `VM_ATTACH_ANY` | OR | `VM_ATTACH` | [common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/stop` | returns VM creds info for VMs that can be killed/shutdown | GET | - | `VM_STOP_ANY` | OR | `VM_STOP` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/reboot` | returns VM creds info for VMs that can be rebooted | GET | - | `VM_REBOOT_ANY` | OR | `VM_REBOOT` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/edit` | returns VM creds info for VMs that can be edited | GET | - | `VM_EDIT_ANY` | OR | `VM_EDIT` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/editaccess` | returns VM creds info for VMs that can have their access changed | GET | - | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/del` | returns VM creds info for VMs that can be deleted | GET | - | `VM_DESTROY_ANY` | OR | `VM_DESTROY` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/exportdir` | returns VM creds info for VMs that can have a dir downloaded | GET | - | `VM_READFS_ANY` | OR | `VM_READFS` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| `/vms/importfiles` | returns VM creds info for VMs allowing files upload | GET | - | `VM_WRITEFS_ANY` | OR | `VM_WRITEFS` | [\[\]common.vm.VMCredentialsSerialized](../src/common/vm/vm.go) |
| Route | Description | Method | Input | Req. user cap. | Op. | Req. VM access cap. | Output |
|--- |--- |--- |--- |--- |--- |--- |--- |
| `/vms` | create a VM | POST | commmon.params.VMCreate | `VM_CREATE` | - | - | common.vm.VMNetworkSerialized |
| `/vms/{id}` | delete a VM | DELETE | - | `VM_DESTROY_ANY` | OR | `VM_DESTROY` | - |
| `/vms/{id}` | edit a VM | PUT | common.params.VMEdit | `VM_EDIT_ANY` | OR | `VM_EDIT` | common.vm.VMNetworkSerialized |
| `/vms/{id}/start` | start a VM | PUT | - | `VM_START_ANY` | OR | `VM_START` | - |
| `/vms/{id}/startwithcreds` | start a VM with credentials | PUT | common.params.VMStartWithCreds | `VM_START_ANY` | OR | `VM_START` | - |
| `/vms/{id}/stop` | kill a VM | PUT | - | `VM_STOP_ANY` | OR | `VM_STOP` | - |
| `/vms/{id}/reboot` | reboot a VM | PUT | - | `VM_REBOOT_ANY` | OR | `VM_REBOOT` | - |
| `/vms/{id}/shutdown` | gracefully shutdown a VM | PUT | - | `VM_STOP_ANY` | OR | `VM_STOP` | - |
| `/vms/{id}/access/{email}` | set VM access for a user | PUT | common.params.VMAddAccess | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | - |
| `/vms/{id}/access/{email}` | del VM access for a user | DELETE | - | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | - |
| `/vms/{id}/exportdir` | download a VM's dir | GET | common.params.VMExportDir | `VM_READFS_ANY` | OR | `VM_READFS` | tar.gz archive |
| `/vms/{id}/importfiles` | upload files into a VM's dir | POST | multipart form: { "vmDir" (path), "file" (tar.gz archive) } | `VM_WRITEFS_ANY` | OR | `VM_WRITEFS` | |
| Route | Description | Method | Input | Req. user cap. | Op. | Req. VM access cap. | Output |
|--- |--- |--- |--- |--- |--- |--- |--- |
| `/vms` | create a VM | POST | [commmon.params.VMCreate](../src/common/params/vms.go) | `VM_CREATE` | - | - | [common.vm.VMNetworkSerialized](../src/common/vm/vm.go) |
| `/vms/{id}` | delete a VM | DELETE | - | `VM_DESTROY_ANY` | OR | `VM_DESTROY` | - |
| `/vms/{id}` | edit a VM | PUT | [common.params.VMEdit](../src/common/params/vms.go) | `VM_EDIT_ANY` | OR | `VM_EDIT` | [common.vm.VMNetworkSerialized](../src/common/vm/vm.go) |
| `/vms/{id}/start` | start a VM | PUT | - | `VM_START_ANY` | OR | `VM_START` | - |
| `/vms/{id}/startwithcreds` | start a VM with credentials | PUT | [common.params.VMStartWithCreds](../src/common/params/vms.go) | `VM_START_ANY` | OR | `VM_START` | - |
| `/vms/{id}/stop` | kill a VM | PUT | - | `VM_STOP_ANY` | OR | `VM_STOP` | - |
| `/vms/{id}/reboot` | reboot a VM | PUT | - | `VM_REBOOT_ANY` | OR | `VM_REBOOT` | - |
| `/vms/{id}/shutdown` | gracefully shutdown a VM | PUT | - | `VM_STOP_ANY` | OR | `VM_STOP` | - |
| `/vms/{id}/access/{email}` | set VM access for a user | PUT | [common.params.VMAddAccess](../src/common/params/vms.go) | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | - |
| `/vms/{id}/access/{email}` | del VM access for a user | DELETE | - | `VM_SET_ACCESS` | AND | `VM_SET_ACCESS` | - |
| `/vms/{id}/exportdir` | download a VM's dir | GET | [common.params.VMExportDir](../src/common/params/vms.go) | `VM_READFS_ANY` | OR | `VM_READFS` | tar.gz archive |
| `/vms/{id}/importfiles` | upload files into a VM's dir | POST | multipart form: { "vmDir" (path), "file" (tar.gz archive) } | `VM_WRITEFS_ANY` | OR | `VM_WRITEFS` | |
### Template management
| Route | Description | Method | Input | Req. user cap. | Output |
|--- |--- |--- |--- |--- |--- |
| `/templates` | returns templates that can be listed | GET | - | `TPL_LIST_ANY` OR `TPL_LIST` | common.template.TemplateSerialized |
| `/templates/{id}` | returns a template | GET | - | `TPL_LIST_ANY` OR `TPL_LIST` | []common.template.TemplateSerialized |
| `/templates/vm` | create a template | POST | common.params.TplCreate | `TPL_CREATE` | common.template.TemplateSerialized |
| `/templates/{id}` | edit a template | PUT | common.params.TplEdit | `TPL_EDIT_ANY` OR `TPL_EDIT` | common.template.TemplateSerialized |
| `/templates/{id}` | delete a template | DELETE | - | `TPL_DESTROY_ANY` OR `TPL_DESTROY` | - |
| `/templates/{id}/disk` | download a template's disk image | GET | - | `TPL_READFS_ANY` OR `TPL_READFS` | qcow file |
| Route | Description | Method | Input | Req. user cap. | Output |
|--- |--- |--- |--- |--- |--- |
| `/templates` | returns templates that can be listed | GET | - | `TPL_LIST_ANY` OR `TPL_LIST` | [common.template.TemplateSerialized](../src/common/template/template.go) |
| `/templates/{id}` | returns a template | GET | - | `TPL_LIST_ANY` OR `TPL_LIST` | [\[\]common.template.TemplateSerialized](../src/common/template/template.go) |
| `/templates/vm` | create a template | POST | [common.params.TplCreate](../src/common/params/templates.go) | `TPL_CREATE` | [common.template.TemplateSerialized](../src/common/template/template.go) |
| `/templates/{id}` | edit a template | PUT | [common.params.TplEdit](../src/common/params/templates.go) | `TPL_EDIT_ANY` OR `TPL_EDIT` | [common.template.TemplateSerialized](../src/common/template/template.go) |
| `/templates/{id}` | delete a template | DELETE | - | `TPL_DESTROY_ANY` OR `TPL_DESTROY` | - |
| `/templates/{id}/disk` | download a template's disk image | GET | - | `TPL_READFS_ANY` OR `TPL_READFS` | qcow file |
<!--
| `/templates/qcow` | create a template | POST | multipart form: { "name", "access", "qcow" (qcow file) } | `TPL_CREATE` | common.template.TemplateSerialized |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment