@canonical/jujulib
Version:
Juju API client
108 lines (107 loc) • 3.38 kB
JavaScript
/**
Juju SSHClient version 2.
This facade is available on:
Controller-machine-agent
Machine-agent
Unit-agent
Models
NOTE: This file was generated using the Juju schema
from Juju 3.0-beta1 at the git SHA 61c87ab7e1.
Do not manually edit this file.
*/
import { autoBind } from "../../utils.js";
/**
Facade implements the API required by the sshclient worker.
*/
class SSHClientV2 {
constructor(transport, info) {
this.NAME = "SSHClient";
this.VERSION = 2;
this._transport = transport;
this._info = info;
// Automatically bind all methods to instances.
autoBind(this);
}
/**
AllAddresses reports all addresses that might have SSH listening for each given
entity in args. Machines and units are supported as entity types.
TODO(wpk): 2017-05-17 This is a temporary solution, we should not fetch environ here
but get the addresses from state. We will be changing it since we want to have space-aware
SSH settings.
*/
allAddresses(params) {
return new Promise((resolve, reject) => {
const req = {
type: "SSHClient",
request: "AllAddresses",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
PrivateAddress reports the preferred private network address for one or
more entities. Machines and units are supported.
*/
privateAddress(params) {
return new Promise((resolve, reject) => {
const req = {
type: "SSHClient",
request: "PrivateAddress",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
Proxy returns whether SSH connections should be proxied through the
controller hosts for the model associated with the API connection.
*/
proxy(params) {
return new Promise((resolve, reject) => {
const req = {
type: "SSHClient",
request: "Proxy",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
PublicAddress reports the preferred public network address for one
or more entities. Machines and units are supported.
*/
publicAddress(params) {
return new Promise((resolve, reject) => {
const req = {
type: "SSHClient",
request: "PublicAddress",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
PublicKeys returns the public SSH hosts for one or more
entities. Machines and units are supported.
*/
publicKeys(params) {
return new Promise((resolve, reject) => {
const req = {
type: "SSHClient",
request: "PublicKeys",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
SSHClientV2.NAME = "SSHClient";
SSHClientV2.VERSION = 2;
export default SSHClientV2;
//# sourceMappingURL=SSHClientV2.js.map