snippets_js
Integration
New integration from credential
const sshConnection = yepcode.integration.ssh2Promise("credential-slug");
New integration from plain authentication data (username and password)
const SSH2Promise = require("ssh2-promise");
const options = {
host: "hostname",
port: portNumber,
username: "username",
password: "password",
};
const sshConnection = await new SSH2Promise(options).connect();
New integration from plain authentication data (private key)
const SSH2Promise = require("ssh2-promise");
const options = {
host: "hostname",
port: portNumber,
username: "username",
privateKey: "privateKey",
};
const sshConnection = await new SSH2Promise(options).connect();
Execute Shell Commands
Exec shell command (promise)
sshConnection.exec("your-command").then((data) => {
// Use the received data
console.log(data);
sshConnection.close();
});
Exec shell command (async/await)
const data = await sshConnection.exec("your-command");
// Use the received data
console.log(data);
sshConnection.close();