2022-10-08 18:32:02 +08:00
|
|
|
import http from '@/api';
|
2022-10-09 16:17:15 +08:00
|
|
|
import { ResPage, ReqPage } from '../interface';
|
2022-10-08 18:32:02 +08:00
|
|
|
import { Container } from '../interface/container';
|
|
|
|
|
2022-10-17 16:04:39 +08:00
|
|
|
export const searchContainer = (params: Container.ContainerSearch) => {
|
2022-10-08 18:32:02 +08:00
|
|
|
return http.post<ResPage<Container.ContainerInfo>>(`/containers/search`, params);
|
|
|
|
};
|
2022-10-12 18:55:47 +08:00
|
|
|
export const createContainer = (params: Container.ContainerCreate) => {
|
|
|
|
return http.post(`/containers`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const logContainer = (params: Container.ContainerLogSearch) => {
|
2022-10-08 18:32:02 +08:00
|
|
|
return http.post<string>(`/containers/log`, params);
|
|
|
|
};
|
2022-10-13 18:24:24 +08:00
|
|
|
export const ContainerStats = (id: string) => {
|
|
|
|
return http.get<Container.ContainerStats>(`/containers/stats/${id}`);
|
|
|
|
};
|
2022-10-08 18:32:02 +08:00
|
|
|
export const ContainerOperator = (params: Container.ContainerOperate) => {
|
|
|
|
return http.post(`/containers/operate`, params);
|
|
|
|
};
|
2022-10-11 19:47:16 +08:00
|
|
|
export const inspect = (params: Container.ContainerInspect) => {
|
|
|
|
return http.post<string>(`/containers/inspect`, params);
|
2022-10-08 18:32:02 +08:00
|
|
|
};
|
2022-10-09 16:17:15 +08:00
|
|
|
|
2022-10-10 15:14:49 +08:00
|
|
|
// image
|
2022-10-17 09:10:06 +08:00
|
|
|
export const searchImage = (params: ReqPage) => {
|
2022-10-10 15:14:49 +08:00
|
|
|
return http.post<ResPage<Container.ImageInfo>>(`/containers/image/search`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const listImage = () => {
|
2022-10-12 18:55:47 +08:00
|
|
|
return http.get<Array<Container.Options>>(`/containers/image`);
|
|
|
|
};
|
2022-10-11 14:20:51 +08:00
|
|
|
export const imageBuild = (params: Container.ImageBuild) => {
|
2022-10-12 13:42:58 +08:00
|
|
|
return http.post<string>(`/containers/image/build`, params);
|
2022-10-11 14:20:51 +08:00
|
|
|
};
|
2022-10-10 15:14:49 +08:00
|
|
|
export const imagePull = (params: Container.ImagePull) => {
|
2022-12-07 14:28:11 +08:00
|
|
|
return http.post<string>(`/containers/image/pull`, params);
|
2022-10-10 15:14:49 +08:00
|
|
|
};
|
|
|
|
export const imagePush = (params: Container.ImagePush) => {
|
2022-12-07 14:28:11 +08:00
|
|
|
return http.post<string>(`/containers/image/push`, params);
|
2022-10-10 15:14:49 +08:00
|
|
|
};
|
|
|
|
export const imageLoad = (params: Container.ImageLoad) => {
|
2022-10-11 17:46:52 +08:00
|
|
|
return http.post(`/containers/image/load`, params);
|
2022-10-10 15:14:49 +08:00
|
|
|
};
|
|
|
|
export const imageSave = (params: Container.ImageSave) => {
|
2022-10-11 17:46:52 +08:00
|
|
|
return http.post(`/containers/image/save`, params);
|
2022-10-10 15:14:49 +08:00
|
|
|
};
|
2022-10-11 17:46:52 +08:00
|
|
|
export const imageTag = (params: Container.ImageTag) => {
|
|
|
|
return http.post(`/containers/image/tag`, params);
|
|
|
|
};
|
|
|
|
export const imageRemove = (params: Container.BatchDelete) => {
|
2022-10-10 15:14:49 +08:00
|
|
|
return http.post(`/containers/image/remove`, params);
|
|
|
|
};
|
|
|
|
|
2022-10-11 14:20:51 +08:00
|
|
|
// network
|
2022-10-17 09:10:06 +08:00
|
|
|
export const searchNetwork = (params: ReqPage) => {
|
2022-10-11 14:20:51 +08:00
|
|
|
return http.post<ResPage<Container.NetworkInfo>>(`/containers/network/search`, params);
|
|
|
|
};
|
|
|
|
export const deleteNetwork = (params: Container.BatchDelete) => {
|
|
|
|
return http.post(`/containers/network/del`, params);
|
|
|
|
};
|
|
|
|
export const createNetwork = (params: Container.NetworkCreate) => {
|
|
|
|
return http.post(`/containers/network`, params);
|
|
|
|
};
|
|
|
|
|
|
|
|
// volume
|
2022-10-17 09:10:06 +08:00
|
|
|
export const searchVolume = (params: ReqPage) => {
|
2022-10-11 14:20:51 +08:00
|
|
|
return http.post<ResPage<Container.VolumeInfo>>(`/containers/volume/search`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const listVolume = () => {
|
2022-10-12 18:55:47 +08:00
|
|
|
return http.get<Array<Container.Options>>(`/containers/volume`);
|
|
|
|
};
|
2022-10-11 14:20:51 +08:00
|
|
|
export const deleteVolume = (params: Container.BatchDelete) => {
|
|
|
|
return http.post(`/containers/volume/del`, params);
|
|
|
|
};
|
|
|
|
export const createVolume = (params: Container.VolumeCreate) => {
|
|
|
|
return http.post(`/containers/volume`, params);
|
|
|
|
};
|
|
|
|
|
2022-10-09 16:17:15 +08:00
|
|
|
// repo
|
2022-10-17 09:10:06 +08:00
|
|
|
export const searchImageRepo = (params: ReqPage) => {
|
2022-10-09 16:17:15 +08:00
|
|
|
return http.post<ResPage<Container.RepoInfo>>(`/containers/repo/search`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const listImageRepo = () => {
|
2022-10-10 15:14:49 +08:00
|
|
|
return http.get<Container.RepoOptions>(`/containers/repo`);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const createImageRepo = (params: Container.RepoCreate) => {
|
2022-10-09 16:17:15 +08:00
|
|
|
return http.post(`/containers/repo`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const updateImageRepo = (params: Container.RepoUpdate) => {
|
2022-10-09 16:17:15 +08:00
|
|
|
return http.put(`/containers/repo/${params.id}`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
export const deleteImageRepo = (params: { ids: number[] }) => {
|
2022-10-09 16:17:15 +08:00
|
|
|
return http.post(`/containers/repo/del`, params);
|
|
|
|
};
|
2022-10-17 09:10:06 +08:00
|
|
|
|
|
|
|
// composeTemplate
|
|
|
|
export const searchComposeTemplate = (params: ReqPage) => {
|
2022-10-17 16:04:39 +08:00
|
|
|
return http.post<ResPage<Container.TemplateInfo>>(`/containers/template/search`, params);
|
2022-10-17 09:10:06 +08:00
|
|
|
};
|
2022-10-17 16:04:39 +08:00
|
|
|
export const listComposeTemplate = () => {
|
|
|
|
return http.get<Container.TemplateInfo>(`/containers/template`);
|
2022-10-17 09:10:06 +08:00
|
|
|
};
|
|
|
|
export const deleteComposeTemplate = (params: { ids: number[] }) => {
|
2022-10-17 16:04:39 +08:00
|
|
|
return http.post(`/containers/template/del`, params);
|
2022-10-17 09:10:06 +08:00
|
|
|
};
|
|
|
|
export const createComposeTemplate = (params: Container.TemplateCreate) => {
|
2022-10-17 16:04:39 +08:00
|
|
|
return http.post(`/containers/template`, params);
|
2022-10-17 09:10:06 +08:00
|
|
|
};
|
|
|
|
export const updateComposeTemplate = (params: Container.TemplateUpdate) => {
|
2022-10-17 16:04:39 +08:00
|
|
|
return http.put(`/containers/template/${params.id}`, params);
|
|
|
|
};
|
|
|
|
|
|
|
|
// compose
|
|
|
|
export const searchCompose = (params: ReqPage) => {
|
|
|
|
return http.post<ResPage<Container.ComposeInfo>>(`/containers/compose/search`, params);
|
|
|
|
};
|
|
|
|
export const upCompose = (params: Container.ComposeCreate) => {
|
2022-12-06 15:05:13 +08:00
|
|
|
return http.post(`/containers/compose`, params);
|
2022-10-17 16:04:39 +08:00
|
|
|
};
|
2022-12-06 15:05:13 +08:00
|
|
|
export const composeOperator = (params: Container.ComposeOpration) => {
|
2022-10-17 16:04:39 +08:00
|
|
|
return http.post(`/containers/compose/operate`, params);
|
2022-10-17 09:10:06 +08:00
|
|
|
};
|
2022-12-06 15:05:13 +08:00
|
|
|
export const composeUpdate = (params: Container.ComposeUpdate) => {
|
|
|
|
return http.post(`/containers/compose/update`, params);
|
|
|
|
};
|
2022-11-14 19:19:42 +08:00
|
|
|
|
|
|
|
// docker
|
2022-12-07 17:28:14 +08:00
|
|
|
export const dockerOperate = (params: Container.DockerOperate) => {
|
|
|
|
return http.post(`/containers/docker/operate`, params);
|
|
|
|
};
|
2022-11-14 19:19:42 +08:00
|
|
|
export const loadDaemonJson = () => {
|
|
|
|
return http.get<Container.DaemonJsonConf>(`/containers/daemonjson`);
|
|
|
|
};
|
2022-12-07 18:15:56 +08:00
|
|
|
export const loadDockerStatus = () => {
|
|
|
|
return http.get<string>(`/containers/docker/status`);
|
|
|
|
};
|
2022-11-14 19:19:42 +08:00
|
|
|
export const updateDaemonJson = (params: Container.DaemonJsonConf) => {
|
|
|
|
return http.post(`/containers/daemonjson/update`, params);
|
|
|
|
};
|
|
|
|
export const updateDaemonJsonByfile = (params: Container.DaemonJsonUpdateByFile) => {
|
|
|
|
return http.post(`/containers/daemonjson/update/byfile`, params);
|
|
|
|
};
|