A Juju API client allowing for logging in and get access to facades.

Param

The WebSocket instance already connected to a Juju controller or model.

Param

Connections options. See the connect documentation above for a description of available options.

Hierarchy

  • Client

Constructors

Properties

_admin: default | default
_bakery?: null | Bakery
_facades: (ClassType<Facade> | GenericFacade)[]
_oidcEnabled: boolean
_transport: Transport

Methods

  • Report whether the given error is a redirection error from Juju.

    Returns

    Whether the given error is a redirection error.

    Parameters

    • err: unknown

      The error returned by the login request.

    Returns err is RedirectionError

  • Log in to Juju.

    Returns

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

    Parameters

    • Optional credentials: Credentials

      An object with the user and password fields for userpass authentication or the macaroons field for bakery authentication. If an empty object is provided a full bakery discharge will be attempted for logging in with macaroons. Any necessary third party discharges are performed using the bakery instance originally provided to connect().

    • clientVersion: string = CLIENT_VERSION

      The Juju controller version to target.

    Returns Promise<undefined | Connection>

  • Log out from Juju.

    Parameters

    • Optional callback: ((code: number, callback: CloseCallback) => void)

      Called when the logout process completes and the connection is closed, the callback receives the close code and optionally another callback. It is responsibility of the callback to call the provided callback if present.

        • (code: number, callback: CloseCallback): void
        • Parameters

          • code: number
          • callback: CloseCallback

          Returns void

    Returns void

Generated using TypeDoc