mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-09-10 22:14:48 -05:00
feat(@xen-orchestra/rest-api): expose get vms and get vm (#8356)
@vates/types Added an export to the root of the lib because TSOA requires importing the type from the root library to generate the OpenAPI specification
@vates/types Tuples ([number, number]) throw errors when generating the OpenAPI specification. They have been updated to number[]
@vates/types Created a XapiXoRecord to be able to differentiate between XO types that come from xapi-object-to-xo and XO types that come from XO collections
xo-server Added getObjectsByType to avoid iterating over all XAPI objects when we know what type of object we want
Branded is not a valid type for the OpenAPI spec. I created a Unbrand type, that convert all Branded to string . (Use Unbrand only for OpenAPI specification definition to maintain Branded type safety)
Added another error middleware to catch TSOA errors and throw XO errors
Added a README.md to have consistency of order in the use of decorators
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
"name": "@vates/types",
|
||||
"private": false,
|
||||
"version": "0.0.0",
|
||||
"main": "./dist/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"default": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.mts"
|
||||
},
|
||||
"./xo": "./dist/xo.d.mts",
|
||||
"./xen-api": "./dist/xen-api.d.mts",
|
||||
"./common": {
|
||||
|
||||
3
@vates/types/src/index.mts
Normal file
3
@vates/types/src/index.mts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './common.mjs'
|
||||
export * from './xen-api.mjs'
|
||||
export * from './xo.mjs'
|
||||
@@ -8,6 +8,10 @@ type BaseXoVm = {
|
||||
|
||||
$container: XoPool['id'] | XoHost['id']
|
||||
$pool: XoPool['id']
|
||||
/**
|
||||
* @deprecated use $pool instead
|
||||
*/
|
||||
$poolId: XoPool['id']
|
||||
|
||||
_xapiRef: string
|
||||
|
||||
@@ -46,9 +50,9 @@ type BaseXoVm = {
|
||||
installTime?: number | null
|
||||
isFirmwareSupported: boolean
|
||||
memory: {
|
||||
dynamic: [number, number]
|
||||
dynamic: number[]
|
||||
size: number
|
||||
static: [number, number]
|
||||
static: number[]
|
||||
usage?: number
|
||||
}
|
||||
mainIpAddress?: string
|
||||
@@ -123,7 +127,7 @@ export type XoUser = {
|
||||
|
||||
export type XoVbd = {
|
||||
id: Branded<'VBD'>
|
||||
type: 'VBDu'
|
||||
type: 'VBD'
|
||||
}
|
||||
|
||||
export type XoVdi = {
|
||||
@@ -182,12 +186,10 @@ export type XoVtpm = {
|
||||
type: 'VTPM'
|
||||
}
|
||||
|
||||
export type XoRecord =
|
||||
| XoGroup
|
||||
export type XapiXoRecord =
|
||||
| XoHost
|
||||
| XoPool
|
||||
| XoSr
|
||||
| XoUser
|
||||
| XoVbd
|
||||
| XoVdi
|
||||
| XoVgpu
|
||||
@@ -196,3 +198,5 @@ export type XoRecord =
|
||||
| XoVmController
|
||||
| XoVmSnapshot
|
||||
| XoVtpm
|
||||
|
||||
export type XoRecord = XapiXoRecord | XoGroup | XoUser
|
||||
|
||||
Reference in New Issue
Block a user