@vcd/node-client

VMware Cloud Director Client bindings for NodeJS

Usage no npm install needed!

<script type="module">
  import vcdNodeClient from 'https://cdn.skypack.dev/@vcd/node-client';
</script>

README

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);
});