Files
ApiServer-Web-admin_dashboa…/src/utils/acs/mirror.js
T
2025-11-13 15:05:54 +08:00

97 lines
2.4 KiB
JavaScript

import {http2} from "@/utils/request.js";
/**获取镜像列表 */
export const getMirrorList = data => {
if(typeof data == "string"){
return http2.get("/acs/v1/image/list?server_id=" + data + "&count=9999999")
}
return http2.get(`/acs/v1/image/list?server_id=${data.server_id}&page=${data.page}&count=${data.count}&key=${data.key}&class_id=${data.class_id}`);
};
/*用户获取镜像列表 */
export const getUserMirrorList = data => {
return http2.get(
`/acs/v1/image/list?server_id=${data.server_id}&count=${data.count}&page=${data.page}&key=${data.key}`
);
};
/**上传镜像 */
export const uploadMirror = data => {
return http2.post("/acs/v1/image/pull", data, {
headers: {
"Content-Type": "multipart/form-data"
}
});
};
/**编辑镜像 */
export const editMirror = data => {
return http2.post("/acs/v1/image/update", data, {
headers: {
"Content-Type": "multipart/form-data"
}
});
};
/**删除镜像 */
export const delMirror = data => {
return http2.post("/acs/v1/image/delete", data, {
headers: {
"Content-Type": "multipart/form-data"
}
});
};
/**镜像同步 */
export const syncMirror = data => {
return http2.get(`/acs/v1/image/sync?server_id=${data}`);
};
/**重新拉取镜像 */
export const pullMirror = data => {
return http2.post(`/acs/v1/image/repull`, data, {
headers: {
"Content-Type": "multipart/form-data"
}
});
};
/**获取镜像信息 */
export const Mirrorinfo = data => {
const serverType = data.server_type || "dockerContainer"; // 设置默认值
return http2.get(
`/acs/v1/image/info?image_id=${data.image_id}&server_type=${serverType}`
);
};
export const addVirtualMirror = data => {
return http2.post("/acs/v1/image/create", data, {
headers: {
"Content-Type": "multipart/form-data"
}
});
};
export const getImageTypeList = (server_id) => {
return http2.get(`/acs/v1/image/class_list?server_id=${server_id}`);
};
export const createImageType = (server_id,class_name,class_ico) => {
return http2.post("/acs/v1/image/class_create", {
server_id,
class_name,
class_ico
},{
headers: {
"Content-Type": "multipart/form-data"
}
});
};
export const updateImageType = (class_id,class_name,class_ico) => {
return http2.post("/acs/v1/image/class_update", {
class_id,
class_name,
class_ico
},{
headers: {
"Content-Type": "multipart/form-data"
}
});
};