2024-03-14 00:09:20 +08:00
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行命令请求
|
|
|
|
|
*/
|
|
|
|
|
export interface ExecCommandRequest {
|
2024-03-14 19:46:05 +08:00
|
|
|
logId?: number;
|
2024-03-14 00:09:20 +08:00
|
|
|
description?: string;
|
|
|
|
|
timeout?: number;
|
|
|
|
|
command?: string;
|
|
|
|
|
parameter?: string;
|
2024-03-14 19:46:05 +08:00
|
|
|
parameterSchema?: string;
|
2024-03-14 00:09:20 +08:00
|
|
|
hostIdList?: number[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 中断命令请求
|
|
|
|
|
*/
|
|
|
|
|
export interface ExecInterruptRequest {
|
|
|
|
|
logId?: number;
|
|
|
|
|
hostLogId?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行命令响应
|
|
|
|
|
*/
|
|
|
|
|
export interface ExecCommandResponse {
|
|
|
|
|
id: number;
|
|
|
|
|
hosts: {
|
|
|
|
|
id: number;
|
|
|
|
|
hostId: number;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行命令
|
|
|
|
|
*/
|
|
|
|
|
export function execCommand(request: ExecCommandRequest) {
|
|
|
|
|
return axios.post<ExecCommandResponse>('/asset/exec/exec-command', request);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 19:46:05 +08:00
|
|
|
/**
|
|
|
|
|
* 重新执行命令
|
|
|
|
|
*/
|
|
|
|
|
export function reExecCommand(request: ExecCommandRequest) {
|
|
|
|
|
return axios.post<ExecCommandResponse>('/asset/exec/re-exec-command', request);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 00:09:20 +08:00
|
|
|
/**
|
|
|
|
|
* 中断执行命令
|
|
|
|
|
*/
|
|
|
|
|
export function interruptExec(request: ExecInterruptRequest) {
|
|
|
|
|
return axios.put('/asset/exec/interrupt', request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 中断执行主机命令
|
|
|
|
|
*/
|
|
|
|
|
export function interruptHostExec(request: ExecInterruptRequest) {
|
|
|
|
|
return axios.put('/asset/exec/interrupt-host', request);
|
|
|
|
|
}
|