mirror of
https://github.com/rustfs/console.git
synced 2026-09-19 01:47:44 +08:00
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
export const useTiers = () => {
|
|
const { $api } = useNuxtApp()
|
|
/**
|
|
* 添加分层
|
|
*
|
|
*'{"type":"minio","minio":{"name":"COLDTIER","endpoint":"","bucket":"","prefix":"","region":"","accesskey":"","secretkey":""}}'
|
|
* {"type":"rustfs","rustfs":{"name":"COLDTIER","endpoint":"","bucket":"","prefix":"","region":"","accesskey":"","secretkey":""}}
|
|
* {"type":"s3","s3":{"name":"S3COLDTIER","endpoint":"","bucket":"","prefix":"","region":"","accesskey":"","secretkey":"","storageclass":"STANDAR
|
|
*
|
|
*/
|
|
const addTiers = async (data: any)=> {
|
|
return await $api.put('/tier?force=false',data)
|
|
}
|
|
|
|
|
|
/**
|
|
* 编辑分层
|
|
* @returns
|
|
*/
|
|
const updateTiers = async (name: string, data: any) =>{
|
|
return await $api.post(`/tier/${encodeURIComponent(name)}`, data)
|
|
}
|
|
|
|
/**
|
|
* 获取分层列表
|
|
* @returns
|
|
*/
|
|
const listTiers = async () =>{
|
|
return await $api.get('/tier')
|
|
}
|
|
|
|
/**
|
|
* 删除分层列表
|
|
* @returns
|
|
*/
|
|
const removeTiers = async (name: string) => {
|
|
return await $api.delete(`/tier/${encodeURIComponent(name)}`, {})
|
|
}
|
|
|
|
return {
|
|
addTiers,
|
|
updateTiers,
|
|
listTiers,
|
|
removeTiers
|
|
}
|
|
}
|