0.0.5 • Published 3 years ago

@vcd/node-client v0.0.5

Weekly downloads
7
License
BSD-2
Repository
-
Last release
3 years ago

VMware Cloud Director Client bindings for NodeJS

The Javascript clients for VMware Cloud Director is implemented in typescript, but can be called from either Javascript or Typescript.

The client is implemented for server-side use with node using the request library.

Installation

npm install @vcd/node-client

Example code

Login and save configuration

import * as vcd from '@vcd/node-client'

const vcdConfig = new vcd.CloudDirectorConfig();
const config = await vcd.CloudDirectorConfig.withUsernameAndPassword(
    "https://<host>[:<port>]/cloudapi",
    "myusername",
    "System", // for Provider login use System as organization name
    "myfakepassword"
)
config.saveConfig("alias")

List all orgs

import * as vcd from '@vcd/node-client'

const vcdConfig = CloudDirectorConfig.fromDefault()

const orgApi: vcd.OrgApi = vcdConfig.makeApiClient(vcd.OrgApi)

orgApi.queryOrgs(1, 128).then((res) => {
    console.log(res.body);
});