• Connect to the Juju controller or model at the given URL.

    Returns

    This promise will be rejected if there is an error connecting, or resolved with a new Client instance. Note that the promise will not be resolved or rejected if a callback is provided.

    Parameters

    • url: string

      The WebSocket URL of the Juju controller or model.

    • Optional options: ConnectOptions

      Connections options, including:

      • facades (default=[]): the list of facade classes to include in the API connection object. Those classes are usually auto-generated and can be found in the facades directory of the project. When multiple versions of the same facade are included, the most recent version supported by the server is made available as part of the connection object;
      • debug (default=false): when enabled, all API messages are logged at debug level;
      • wsclass (default=W3C browser native WebSocket): the WebSocket class to use for opening the connection and sending/receiving messages. Server side, require('websocket').w3cwebsocket can be used safely, as it implements the W3C browser native WebSocket API;
      • bakery (default: null): the bakery client to use when macaroon discharges are required, in the case an external user is used to connect to Juju; see https://www.npmjs.com/package/macaroon-bakery;
      • closeCallback: a callback to be called with the exit code when the connection is closed.
    • Optional callback: Callback<Client>

      Called when the connection is made, the callback receives an error and a client object. If there are no errors, the client can be used to login and logout to Juju. See the docstring for the Client class for information on how to use the client.

    Returns Promise<Client>

Generated using TypeDoc