2024-08-20 12:11:31 +00:00
|
|
|
import { request } from '@cmp/cmp-element'
|
|
|
|
import { wrapperParams, downloadFile } from 'utils'
|
|
|
|
|
|
|
|
// 镜像
|
|
|
|
const imageUrl = '/cmp/plugins/ctstack/v1/images'
|
|
|
|
export function getImage(params) {
|
|
|
|
return request.get(imageUrl, {
|
|
|
|
params
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createImage(params) {
|
|
|
|
return request.post(imageUrl, wrapperParams(params))
|
|
|
|
}
|
|
|
|
|
|
|
|
export function modifyImage(params) {
|
|
|
|
return request.put(`${imageUrl}/${params.id}`, wrapperParams(params))
|
|
|
|
}
|
|
|
|
|
|
|
|
export function removeImage(id) {
|
|
|
|
return request.delete(`${imageUrl}/${id}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
export function removeTcImage(id, params) {
|
|
|
|
return request.delete(`${imageUrl}/${id}`, {
|
|
|
|
params: JSON.stringify(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function detailImage(id) {
|
|
|
|
return request.get(`${imageUrl}/${id}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
export function conditionImage(obj) {
|
|
|
|
const params = { condition: JSON.stringify(obj) }
|
|
|
|
return request.get(`${imageUrl}/condition`, { params })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function removeImages(params) {
|
|
|
|
return request.delete(imageUrl, { data: wrapperParams(params) })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 批量更新 复制镜像
|
|
|
|
export function allModifyImage(params) {
|
|
|
|
return request.put(imageUrl, wrapperParams(params))
|
|
|
|
}
|
|
|
|
|
|
|
|
// 更新镜像到期时间
|
|
|
|
export function updateImageTime(params) {
|
|
|
|
return request.patch(`${imageUrl}/${params.resId}`, {
|
|
|
|
action: 'updateExpriedTime',
|
|
|
|
...wrapperParams(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 批量删除 根据某种需求删除镜像
|
|
|
|
export function removeAllImage(params) {
|
|
|
|
return request.delete(imageUrl, wrapperParams(params))
|
|
|
|
}
|
|
|
|
|
|
|
|
// 镜像共享
|
|
|
|
export function shareImage(params) {
|
|
|
|
return request.patch(`${imageUrl}/${params.imageId}`, {
|
|
|
|
action: 'shareImage',
|
|
|
|
...wrapperParams(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function shareSyncImage(params) {
|
|
|
|
return request.patch(`${imageUrl}/${params.imageId}`, {
|
|
|
|
action: 'syncImages',
|
|
|
|
...wrapperParams(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function patchImage(action, params) {
|
|
|
|
return request.patch(`${imageUrl}/${params.id}`, {
|
|
|
|
action: action,
|
|
|
|
...wrapperParams(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查询镜像使用的存储卷
|
|
|
|
export function volumeImage(id) {
|
|
|
|
return request.get(`${imageUrl}/${id}/volumes`)
|
|
|
|
}
|
2024-09-03 09:56:02 +00:00
|
|
|
export function getBMSImage(params) {
|
|
|
|
return request.get(`${imageUrl}/listPhysical`, {
|
|
|
|
params
|
|
|
|
})
|
|
|
|
}
|