feat(xo-server/api): proxy.openSupportTunnel (#7126)

The goal is to provide an easier way for the support team to open a tunnel on a proxy appliance.

This is the server side of this feature.
This commit is contained in:
Julien Fontanet 2023-10-25 17:12:17 +02:00 committed by GitHub
parent fb83d1fc98
commit f14f716f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,6 +202,26 @@ checkHealth.params = {
},
}
export async function openSupportTunnel({ id }) {
await this.callProxyMethod(id, 'appliance.supportTunnel.open')
for (let i = 0; i < 10; ++i) {
const { open, stdout } = await this.callProxyMethod(id, 'appliance.supportTunnel.getState')
if (open && stdout.length !== 0) {
return stdout
}
await new Promise(resolve => setTimeout(resolve, 1e3))
}
throw new Error('could not open support tunnel')
}
openSupportTunnel.permission = 'admin'
openSupportTunnel.params = {
id: { type: 'string' },
}
export function updateApplianceSettings({ id, ...props }) {
return this.updateProxyAppliance(id, props)
}