UNPKG

@xtail/ssh

Version:

X-Tail SSH 库,包含 SSH 连接服务器的类和工具方法等

96 lines (95 loc) 3.78 kB
import { default as SSHConfig } from 'ssh2-promise/lib/sshConfig'; import { SSHResultType } from '../types'; /** * 生成 SSH 结果对象 * * @param options 配置选项 * - success 操作执行是否成功,默认值 true * - server 执行操作的服务器主机地址及端口号,格式为 `host:port`,默认值 '127.0.0.1:22' * - message 操作执行的结果描述信息,默认值 '成功' * - detail 操作执行的详情信息,如果操作执行成功,则操作的执行结果将存放在此字段中返回;如果操 * 作执行失败,则错误的详细信息将存放在此字段中返回,默认值 null * @returns {SSHResultType} SSH 结果对象 */ export declare const genResult: (options?: { success?: boolean; server?: string; message?: any; detail?: any; }) => SSHResultType; export type GenResultType = typeof genResult; /** * 根据 SSH 连接服务器配置生成 SSH 结果对象 * * @param {SSHConfig} conf SSH 连接服务器配置 * @param options 配置选项 * - success 操作执行是否成功,默认值 true * - message 操作执行的结果描述信息,默认值 '成功' * - detail 操作执行的详情信息,如果操作执行成功,则操作的执行结果将存放在此字段中返回;如果操 * 作执行失败,则错误的详细信息将存放在此字段中返回,默认值 null * @returns {SSHResultType} SSH 结果对象 */ export declare const genResultByConf: (conf: SSHConfig, options?: { success?: boolean; message?: any; detail?: any; }) => SSHResultType; export type GenResultByConfType = typeof genResultByConf; /** * 生成 SSH 成功结果对象 * * @param options 配置选项 * - server 执行操作的服务器主机地址及端口号,格式为 `host:port`,默认值 '127.0.0.1:22' * - message 操作执行的结果描述信息,默认值 '成功' * - detail 操作的执行结果,默认值 null * @returns {SSHResultType} SSH 成功结果对象 */ export declare const genSuccessResult: (options?: { server?: string; message?: string; detail?: any; }) => SSHResultType; export type GenSuccessResultType = typeof genSuccessResult; /** * 根据 SSH 连接服务器配置生成 SSH 成功结果对象 * * @param {SSHConfig} conf SSH 连接服务器配置 * @param options 配置选项 * - message 操作执行的结果描述信息,默认值 '成功' * - detail 操作的执行结果,默认值 null * @returns {SSHResultType} SSH 成功结果对象 */ export declare const genSuccessResultByConf: (conf: SSHConfig, options?: { message?: string; detail?: any; }) => SSHResultType; export type GenSuccessResultByConfType = typeof genSuccessResultByConf; /** * 生成 SSH 失败结果对象 * * @param options 配置选项 * - server 执行操作的服务器主机地址及端口号,格式为 `host:port`,默认值 '127.0.0.1:22' * - message 操作执行的结果描述信息,默认值 '失败' * - detail 错误信息,默认值 null * @returns {SSHResultType} SSH 失败结果对象 */ export declare const genFailResult: (options?: { server?: string; message?: string; detail?: any; }) => SSHResultType; export type GenFailResultType = typeof genFailResult; /** * 根据 SSH 连接服务器配置生成 SSH 失败结果对象 * * @param {SSHConfig} conf SSH 连接服务器配置 * @param options 配置选项 * - message 操作执行的结果描述信息,默认值 '失败' * - detail 错误信息,默认值 null * @returns {SSHResultType} SSH 失败结果对象 */ export declare const genFailResultByConf: (conf: SSHConfig, options?: { message?: string; detail?: any; }) => SSHResultType; export type GenFailResultByConfType = typeof genFailResultByConf;