README
JS Jujulib
This project provides a JavaScript API client library for interacting with the Juju WebSocket API.
Getting Started
To access the Juju API, a connection must be made to either a Juju controller or a Juju 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 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 is used to log into the controller or model by providing a user/pass credentials or macaroons. See the various examples.
Client API Reference
Visit the full API documentation for detailed information on the Client API.
Facade API Reference
Detailed Facade documentation is available as part of the full API documentation or you can visit the facade source directly using the following links:
- action-pruner-v1.ts
- action-v6.ts
- action-v7.ts
- admin-v3.ts
- agent-tools-v1.ts
- agent-v3.ts
- all-model-watcher-v2.ts
- all-watcher-v1.ts
- annotations-v2.ts
- application-offers-v2.ts
- application-offers-v3.ts
- application-scaler-v1.ts
- application-v12.ts
- application-v13.ts
- backups-v2.ts
- backups-v3.ts
- block-v2.ts
- bundle-v1.ts
- bundle-v4.ts
- bundle-v5.ts
- caasadmission-v1.ts
- caasagent-v2.ts
- caasapplication-provisioner-v1.ts
- caasapplication-v1.ts
- caasfirewaller-embedded-v1.ts
- caasfirewaller-v1.ts
- caasmodel-config-manager-v1.ts
- caasmodel-operator-v1.ts
- caasoperator-provisioner-v1.ts
- caasoperator-upgrader-v1.ts
- caasoperator-v1.ts
- caasunit-provisioner-v2.ts
- charm-downloader-v1.ts
- charm-hub-v1.ts
- charm-revision-updater-v2.ts
- charms-v2.ts
- charms-v4.ts
- cleaner-v2.ts
- client-v2.ts
- client-v3.ts
- cloud-v1.ts
- cloud-v2.ts
- cloud-v3.ts
- cloud-v4.ts
- cloud-v5.ts
- cloud-v7.ts
- controller-v11.ts
- controller-v3.ts
- controller-v4.ts
- controller-v5.ts
- controller-v6.ts
- controller-v7.ts
- controller-v8.ts
- controller-v9.ts
- credential-manager-v1.ts
- credential-validator-v2.ts
- cross-controller-v1.ts
- cross-model-relations-v2.ts
- deployer-v1.ts
- disk-manager-v2.ts
- entity-watcher-v2.ts
- external-controller-updater-v1.ts
- fan-configurer-v1.ts
- filesystem-attachments-watcher-v2.ts
- firewall-rules-v1.ts
- firewaller-v7.ts
- high-availability-v2.ts
- host-key-reporter-v1.ts
- image-manager-v2.ts
- image-metadata-manager-v1.ts
- image-metadata-v3.ts
- instance-mutater-v2.ts
- instance-poller-v4.ts
- key-manager-v1.ts
- key-updater-v1.ts
- leadership-service-v2.ts
- life-flag-v1.ts
- log-forwarding-v1.ts
- logger-v1.ts
- machine-actions-v1.ts
- machine-manager-v6.ts
- machine-undertaker-v1.ts
- machiner-v5.ts
- meter-status-v2.ts
- metrics-adder-v2.ts
- metrics-debug-v2.ts
- metrics-manager-v1.ts
- migration-flag-v1.ts
- migration-master-v3.ts
- migration-minion-v1.ts
- migration-status-watcher-v1.ts
- migration-target-v1.ts
- model-config-v2.ts
- model-generation-v4.ts
- model-manager-v2.ts
- model-manager-v3.ts
- model-manager-v4.ts
- model-manager-v5.ts
- model-manager-v8.ts
- model-manager-v9.ts
- model-summary-watcher-v1.ts
- model-upgrader-v1.ts
- notify-watcher-v1.ts
- offer-status-watcher-v1.ts
- payloads-hook-context-v1.ts
- payloads-v1.ts
- pinger-v1.ts
- provisioner-v11.ts
- proxy-updater-v2.ts
- raft-lease-v1.ts
- reboot-v2.ts
- relation-status-watcher-v1.ts
- relation-units-watcher-v1.ts
- remote-relation-watcher-v1.ts
- remote-relations-v2.ts
- resources-hook-context-v1.ts
- resources-v1.ts
- resources-v2.ts
- resumer-v2.ts
- retry-strategy-v1.ts
- secrets-manager-v1.ts
- secrets-rotation-watcher-v1.ts
- secrets-v1.ts
- singular-v2.ts
- spaces-v6.ts
- sshclient-v2.ts
- status-history-v2.ts
- storage-provisioner-v4.ts
- storage-v6.ts
- strings-watcher-v1.ts
- subnets-v4.ts
- undertaker-v1.ts
- unit-assigner-v1.ts
- uniter-v18.ts
- upgrade-series-v3.ts
- upgrade-steps-v2.ts
- upgrader-v1.ts
- user-manager-v1.ts
- user-manager-v2.ts
- volume-attachment-plans-watcher-v1.ts
- volume-attachments-watcher-v2.ts
Examples
We have a number of examples showing how to perform a few common tasks. Those can be found in the examples folder.
Library Maintenance
Updating Library Facades
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.
After generating a new schema run npm run store-schema which will store the updated schema and necessary meta data in this project.
To update the facades, run npm run build on this project. This will generate the facades using the locally stored schema, sha, and version the schema was generated from.
Releasing to NPM
- Update the version number in
package.json, respecting semver. - Run the tests with
npm test. - Run the examples with
nodeto ensure that everything works as expected. - Upgrade the Juju Dashboard to this version using
npm linkand ensure that everything works as expected. - Tag the version in the git repository with the version number from above.
npm publish.- Update the release notes in the repository.
- Create a post on the Juju Discourse with information about the release.