import { Client, ConnectConfig } from 'ssh2'; import { AbstractCommand } from './commands/AbstractCommand'; import { ConnectionFactory } from './ConnectionFactory'; declare class Rocket { private connectionFactory; currentTarget: string; commands: AbstractCommand[]; connections: Client[]; targets: { [target: string]: ConnectConfig[]; }; missions: { [name: string]: Function; }; prependArgs: string[]; once: boolean; constructor(connectionFactory: ConnectionFactory); /** * Add a new target that the rocket can use to execute commands on * @param target The name of the target * @param connectionConfigs Connections for each host this target should hit */ target(target: string, connectionConfigs: ConnectConfig[]): void; /** * Run a command on all remote hosts in the target * @param cmd Command to run remotely */ remote(cmd: string): Promise; /** * Run a command locally, once * @param cmd Command to run locally */ local(cmd: string): Promise; /** * Create a new mission with a particular name that executes a callback * containing javascript and commands to run * @param name Name of the mission * @param callback Function to call when executing a mission */ mission(name: string, callback: Function): void; /** * Reset all internal attributes, commands, missions, and targets */ reset(): void; /** * Prepend all commands inside of a given callback with a given command * @param command Command to prepend to all commands executed in the callback * @param callback Callback containing commands to execute */ with(command: string, callback: Function): Promise; /** * Execute all commands only on one of the remote hosts * @param callback Callback containing commands to execute */ justOnce(callback: Function): Promise; /** * Make the rocket liftoff! And run all commands sequentially! * @param target Target to use when executing commands * @param mission Missions to run on the selected target, default is 'default' */ liftoff(target: string, mission?: string): Promise; private executeCommand; private composeCmd; } export { Rocket };