feat(xen-api/getRecord): add $id, $type and $ref props

This commit is contained in:
Julien Fontanet 2018-08-21 17:48:58 +02:00
parent 32d7ccfea5
commit 41506e785e

View File

@ -496,8 +496,17 @@ export class Xapi extends EventEmitter {
throw new Error('no object with UUID: ' + uuid) throw new Error('no object with UUID: ' + uuid)
} }
getRecord (type, ref) { async getRecord (type, ref) {
return this._sessionCall(`${type}.get_record`, [ref]) const record = await this._sessionCall(`${type}.get_record`, [ref])
// All custom properties are read-only and non enumerable.
defineProperties(record, {
$id: { value: record.uuid || ref },
$ref: { value: ref },
$type: { value: type },
})
return record
} }
@cancelable @cancelable