Compare commits

..

4 Commits

Author SHA1 Message Date
MelissaFrncJrg
f94b771f83 PR number 2026-11-25 10:22:00 +01:00
MelissaFrncJrg
3110d6c567 feat(rest-api): expose proxy deletion 2026-11-25 10:15:38 +01:00
MelissaFrncJrg
748843781f feat(rest-api): expose proxy deletion endpoint 2026-11-25 08:40:32 +01:00
Sylvère
e9760747f9 feat: technical release (#10896)
* feat(@xen-orchestra/log): 1.0.0

* feat(@vates/disposable): 0.1.7

* feat(@xen-orchestra/fs): 4.11.0

* feat(vhd-lib): 4.17.1

* feat(@vates/fuse-vhd): 2.1.4

* feat(@vates/iscsi): 0.4.1

* feat(@vates/obfuscate): 0.2.0

* feat(xo-collection): 1.0.0

* feat(xen-api): 6.0.0

* feat(@vates/nbd-client): 3.7.1

* feat(@vates/node-vsphere-soap): 2.2.1

* feat(@vates/syslog): 0.2.0

* feat(@vates/types): 3.0.0

* feat(@xen-orchestra/acl): 1.9.0

* feat(@xen-orchestra/audit-core): 0.4.1

* feat(@xen-orchestra/autopilot-docking): 0.1.0

* feat(@xen-orchestra/backup-archive): 1.2.1

* feat(@xen-orchestra/xapi): 10.0.0

* feat(@xen-orchestra/backups): 1.0.0

* feat(@xen-orchestra/backups-cli): 1.1.19

* feat(@xen-orchestra/cr-seed-cli): 1.0.4

* feat(@xen-orchestra/disk-cli): 2.2.6

* feat(@xen-orchestra/immutable-backups): 3.0.10

* feat(@xen-orchestra/web-core): 0.66.0

* feat(@xen-orchestra/mcp): 1.4.4

* feat(@xen-orchestra/mixins): 0.24.0

* feat(@xen-orchestra/proxy): 0.35.0

* feat(@xen-orchestra/vmware-explorer): 1.3.0

* feat(@xen-orchestra/qa-test): 1.5.0

* feat(@xen-orchestra/rest-api): 0.42.0

* feat(@xen-orchestra/web): 0.66.0

* feat(xapi-explore-sr): 0.4.9

* feat(xo-server): 5.214.0

* feat(xo-server-audit): 0.16.0

* feat(xo-server-auth-ldap): 0.10.13

* feat(xo-server-backup-reports): 1.7.2

* feat(xo-server-ipmi-sensors): 2.1.2

* feat(xo-server-load-balancer): 0.14.1

* feat(xo-server-netbox): 1.14.1

* feat(xo-server-openmetrics): 1.9.4

* feat(xo-server-perf-alert): 1.1.3

* feat(xo-server-sdn-controller): 1.7.0

* feat(xo-server-transport-nagios): 1.0.4

* feat(xo-server-usage-report): 0.11.2

* feat(xo-server-web-hooks): 0.4.1

* feat(xo-web): 5.209.0

* chore(CHANGELOG): update next
2026-11-24 16:47:56 +01:00
6 changed files with 60 additions and 5 deletions

View File

@@ -466,6 +466,8 @@ export type XoApp = EventEmitter & {
opts?: { bypassAuthorization?: boolean; fromGroup?: boolean; fromUser?: boolean }
): Promise<XoAclRole[]>
getAllGroups(): Promise<XoGroup[]>
/** Also destroys the VM of the proxy, if any */
destroyProxy(id: XoProxy['id']): Promise<void>
getAllProxies(): Promise<XoProxy[]>
getAllJobs<T extends AnyXoJob['type']>(type: T): Promise<Extract<AnyXoJob, { type: T }>[]>
getAllJobs(type?: string): Promise<AnyXoJob[]>
@@ -503,10 +505,7 @@ export type XoApp = EventEmitter & {
* `assertBrowserMediaInsertable` reports the predictable failures synchronously, e.g. before
* starting a task.
*/
insertBrowserMedia(params: {
id: XoBrowserMediaSession['id']
vmId: XoVm['id']
}): Promise<{ vdiId: XoVdi['id'] }>
insertBrowserMedia(params: { id: XoBrowserMediaSession['id']; vmId: XoVm['id'] }): Promise<{ vdiId: XoVdi['id'] }>
assertBrowserMediaInsertable(params: { id: XoBrowserMediaSession['id']; vmId: XoVm['id'] }): void
/** Eject the ISO of a browser media session, release its storage, and disconnect the browser */
ejectBrowserMedia(id: XoBrowserMediaSession['id']): Promise<void>

View File

@@ -1,3 +1,4 @@
export default {
read: true,
delete: true,
}

View File

@@ -1,4 +1,5 @@
import {
Delete,
Example,
Extension,
Get,
@@ -23,6 +24,7 @@ import {
badRequestResp,
forbiddenOperationResp,
internalServerErrorResp,
noContentResp,
notFoundResp,
proxyUnreachableResp,
unauthorizedResp,
@@ -146,4 +148,34 @@ export class ProxyController extends XoController<XoProxy> {
return { success: true }
}
/**
* Deletes a proxy
*
* Destroys the VM of the proxy, if it has one, with its disks and snapshots, then removes the proxy from Xen Orchestra.
*
* Required privilege:
* - resource: proxy, action: delete
*
* This privilege is enough to destroy the VM of the proxy: no privilege on that VM is checked.
*
* @example id "e625ea0c-a876-405a-b838-109d762efe88"
*/
@Extension('x-mcp-exposure', 'confirm')
@Delete('{id}')
@Middlewares(
acl({
resource: 'proxy',
action: 'delete',
objectId: 'params.id',
getObject: ({ restApi }) => restApi.xoApp.getProxy,
})
)
@SuccessResponse(noContentResp.status, noContentResp.description)
@Response(forbiddenOperationResp.status, forbiddenOperationResp.description)
@Response(notFoundResp.status, notFoundResp.description)
@Response(internalServerErrorResp.status, internalServerErrorResp.description)
async deleteProxy(@Path() id: string): Promise<void> {
await this.restApi.xoApp.destroyProxy(id as XoProxy['id'])
}
}

View File

@@ -49,3 +49,21 @@ describe('ProxyController.getProxyHealth', () => {
await assert.rejects(controller.getProxyHealth(proxyId), error => error === unrelatedError)
})
})
describe('ProxyController.deleteProxy', () => {
it('forwards the id to destroyProxy', async () => {
const calls: unknown[] = []
const restApi = {
xoApp: {
destroyProxy: async (id: string) => {
calls.push(['destroyProxy', id])
},
},
} as unknown as RestApi
const controller = new ProxyController(restApi)
await controller.deleteProxy(proxyId)
assert.deepEqual(calls, [['destroyProxy', proxyId]])
})
})

View File

@@ -9,6 +9,8 @@
> Users must be able to say: "Nice enhancement, I'm eager to test it"
- [REST API] Delete a proxy: `DELETE /rest/v0/proxies/:id` (PR [#10900](https://github.com/vatesfr/xen-orchestra/pull/10900))
### Bug fixes
> Users must be able to say: "I had this issue, happy to know it's fixed"
@@ -29,4 +31,7 @@
<!--packages-start-->
- @xen-orchestra/acl minor
- @xen-orchestra/rest-api minor
<!--packages-end-->

View File

@@ -190,7 +190,7 @@ This action makes the XO server send a GET request to the given URL, so the hold
| | `reclaim-space`, |
| `schedule` | `read`, `run` |
| `restore-log` | `read` |
| `proxy` | `read` |
| `proxy` | `read`, `delete` |
| `server` | `read`, `create`, `delete`, `connect`, `disconnect` |
| `task` | `read`, `abort`, `delete` |
| `alarm` | `read` |