xen-api-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Typescript for XenAPI Usage

Examples

Install lib from npm repository

$ npm install xen-api-ts

The usage of Typescript XenAPI is almost identical to the Python XenAPI, except it's asynchronous and requires async/await.

import { xapi_client } from "xen-api-ts"
async function main() {
    const session = xapi_client(process.env.HOST_URL)
    try:
        await session.login_with_password(process.env.USERNAME, process.env.PASSWORD)
        const hosts = await session.xenapi.host.get_all()
    finally:
        await session.xenapi.session.logout()
}
main()

For more example usage, we can run as follows.

$ cd <examples/typescript dir>
$ npm install
$ echo "HOST_URL=xxx" >> .env
$ echo "USERNAME=xxx" >> .env
$ echo "PASSWORD=xxx" >> .env
$ npm test tests/getXapiVersion.ts

Packaging

Package Sidebar

Install

npm i xen-api-ts

Weekly Downloads

3

Version

1.0.4

License

GPLv2

Unpacked Size

4.23 kB

Total Files

4

Last publish

Collaborators

  • acefei