Files
orion-visor/orion-visor-ui/src/api/asset/host-key.ts

106 lines
2.2 KiB
TypeScript
Raw Normal View History

2023-10-25 10:26:14 +08:00
import type { DataGrid, Pagination } from '@/types/global';
import type { TableData } from '@arco-design/web-vue/es/table/interface';
2023-09-20 12:13:02 +08:00
import axios from 'axios';
2024-05-31 16:32:45 +08:00
import qs from 'query-string';
2023-09-20 12:13:02 +08:00
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
export interface HostKeyCreateRequest {
name?: string;
publicKey?: string;
privateKey?: string;
password?: string;
2025-01-17 09:56:30 +08:00
description?: string;
2023-09-20 12:13:02 +08:00
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
export interface HostKeyUpdateRequest extends HostKeyCreateRequest {
2023-09-25 14:36:13 +08:00
id?: number;
2023-09-21 13:50:42 +08:00
useNewPassword?: boolean;
2023-09-20 12:13:02 +08:00
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
export interface HostKeyQueryRequest extends Pagination {
2023-10-07 23:24:12 +08:00
searchValue?: string;
2023-09-20 12:13:02 +08:00
id?: number;
name?: string;
publicKey?: string;
privateKey?: string;
2025-01-17 09:56:30 +08:00
description?: string;
2023-09-20 12:13:02 +08:00
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
2023-09-24 22:08:33 +08:00
export interface HostKeyQueryResponse extends TableData {
2023-11-01 18:57:53 +08:00
id: number;
name: string;
publicKey: string;
privateKey: string;
password: string;
2025-01-17 09:56:30 +08:00
description: string;
2023-09-20 12:13:02 +08:00
createTime: number;
updateTime: number;
2025-01-17 09:56:30 +08:00
creator: string;
updater: string;
2023-09-20 12:13:02 +08:00
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
export function createHostKey(request: HostKeyCreateRequest) {
return axios.post('/asset/host-key/create', request);
}
/**
2024-05-17 12:26:01 +08:00
* id
2023-09-20 12:13:02 +08:00
*/
export function updateHostKey(request: HostKeyUpdateRequest) {
return axios.put('/asset/host-key/update', request);
}
/**
2024-05-17 12:26:01 +08:00
* id
2023-09-20 12:13:02 +08:00
*/
export function getHostKey(id: number) {
return axios.get<HostKeyQueryResponse>('/asset/host-key/get', { params: { id } });
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
2023-09-21 13:50:42 +08:00
export function getHostKeyList() {
2023-09-22 11:50:56 +08:00
return axios.get<Array<HostKeyQueryResponse>>('/asset/host-key/list');
2023-09-20 12:13:02 +08:00
}
/**
2024-05-17 12:26:01 +08:00
*
2023-09-20 12:13:02 +08:00
*/
export function getHostKeyPage(request: HostKeyQueryRequest) {
return axios.post<DataGrid<HostKeyQueryResponse>>('/asset/host-key/query', request);
}
/**
2024-05-17 12:26:01 +08:00
* id
2023-09-20 12:13:02 +08:00
*/
export function deleteHostKey(id: number) {
return axios.delete('/asset/host-key/delete', { params: { id } });
}
2024-05-31 16:32:45 +08:00
/**
*
*/
export function batchDeleteHostKey(idList: Array<number>) {
return axios.delete('/asset/host-key/batch-delete', {
params: { idList },
paramsSerializer: params => {
return qs.stringify(params, { arrayFormat: 'comma' });
}
});
}