This project provides a JavaScript API client library for interacting with the Juju WebSocket API.
In order to access the Juju API, a connection must be made, to either a Juju controller or model.
import ApplicationV5 from "jujulib/api/facades/application-v5.js";
import ClientV1 from "jujulib/api/facades/client-v1.js";
import ClientV2 from "jujulib/api/facades/client-v2.js";
const juju = await jujulib.connect(
'wss://example.com/model/x-y-z/api',
{facades: [ApplicationV5, ClientV1, ClientV2]}
);
In the code above, a connection is being established to the provided model API URL, and the client declares interest in using the specified set of facades.
Note When multiple versions of the same facade are included (like the two client versions in the example), the most recent version supported by the server is made available to the client.
The connect
method returns a juju
object which can be used to log into the controller or model by providing a userpass credentials or macaroons. See The various examples below.
Visit the full API documentation for detailed information on the Client API.
Defailed Facade documentation can be found by visiting the full API documentation or you can visit the facade source directly using the links below.
We have a number of examples showing how to perform a few common tasks. Those can be found in the examples folder.
The Juju facade API files are generated from a supplied Juju schema.
To generate this schema you will need to clone the Juju repository and then run go run github.com/juju/juju/generate/schemagen -admin-facades --facade-group=client,jimm ./apiserver/facades/schema.json
to generate a schema file that contains the publicly available facades as well as the set of facades for JAAS. Other --facade-group
options are latest
and all
.
To update the facades run npm run build
on this project. This will generate the facades using the schema stored at $GOPATH/src/github.com/juju/juju/apiserver/facades/schema.json
. It will also pull the SHA and Juju version from this repository.
package.json
, respecting semver.npm test
.node
to ensure that everything works as expected.npm link
and ensure that everything works as expected.npm publish
.Generated using TypeDoc