working on the backup management parts
This commit is contained in:
@@ -9,6 +9,7 @@ export interface SCSTTarget {
|
||||
iqn: string
|
||||
alias?: string
|
||||
is_active: boolean
|
||||
lun_count?: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
@@ -31,7 +32,11 @@ export interface SCSTInitiator {
|
||||
iqn: string
|
||||
is_active: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
updated_at?: string
|
||||
target_id?: string
|
||||
target_iqn?: string
|
||||
target_name?: string
|
||||
group_name?: string
|
||||
}
|
||||
|
||||
export interface SCSTInitiatorGroup {
|
||||
@@ -45,9 +50,19 @@ export interface SCSTInitiatorGroup {
|
||||
|
||||
export interface SCSTHandler {
|
||||
name: string
|
||||
label: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface SCSTPortal {
|
||||
id: string
|
||||
ip_address: string
|
||||
port: number
|
||||
is_active: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface CreateTargetRequest {
|
||||
iqn: string
|
||||
target_type: string
|
||||
@@ -80,6 +95,7 @@ export const scstAPI = {
|
||||
getTarget: async (id: string): Promise<{
|
||||
target: SCSTTarget
|
||||
luns: SCSTLUN[]
|
||||
initiator_groups?: SCSTInitiatorGroup[]
|
||||
}> => {
|
||||
const response = await apiClient.get(`/scst/targets/${id}`)
|
||||
return response.data
|
||||
@@ -87,7 +103,8 @@ export const scstAPI = {
|
||||
|
||||
createTarget: async (data: CreateTargetRequest): Promise<SCSTTarget> => {
|
||||
const response = await apiClient.post('/scst/targets', data)
|
||||
return response.data.target
|
||||
// Backend returns target directly, not wrapped in { target: ... }
|
||||
return response.data
|
||||
},
|
||||
|
||||
addLUN: async (targetId: string, data: AddLUNRequest): Promise<{ task_id: string }> => {
|
||||
@@ -109,5 +126,81 @@ export const scstAPI = {
|
||||
const response = await apiClient.get('/scst/handlers')
|
||||
return response.data.handlers || []
|
||||
},
|
||||
|
||||
listPortals: async (): Promise<SCSTPortal[]> => {
|
||||
const response = await apiClient.get('/scst/portals')
|
||||
return response.data.portals || []
|
||||
},
|
||||
|
||||
getPortal: async (id: string): Promise<SCSTPortal> => {
|
||||
const response = await apiClient.get(`/scst/portals/${id}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
createPortal: async (data: { ip_address: string; port?: number; is_active?: boolean }): Promise<SCSTPortal> => {
|
||||
const response = await apiClient.post('/scst/portals', data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
updatePortal: async (id: string, data: { ip_address: string; port?: number; is_active?: boolean }): Promise<SCSTPortal> => {
|
||||
const response = await apiClient.put(`/scst/portals/${id}`, data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
deletePortal: async (id: string): Promise<void> => {
|
||||
await apiClient.delete(`/scst/portals/${id}`)
|
||||
},
|
||||
|
||||
enableTarget: async (targetId: string): Promise<{ message: string }> => {
|
||||
const response = await apiClient.post(`/scst/targets/${targetId}/enable`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
disableTarget: async (targetId: string): Promise<{ message: string }> => {
|
||||
const response = await apiClient.post(`/scst/targets/${targetId}/disable`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
listInitiators: async (): Promise<SCSTInitiator[]> => {
|
||||
const response = await apiClient.get('/scst/initiators')
|
||||
return response.data.initiators || []
|
||||
},
|
||||
|
||||
getInitiator: async (id: string): Promise<SCSTInitiator> => {
|
||||
const response = await apiClient.get(`/scst/initiators/${id}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
removeInitiator: async (id: string): Promise<void> => {
|
||||
await apiClient.delete(`/scst/initiators/${id}`)
|
||||
},
|
||||
|
||||
listExtents: async (): Promise<SCSTExtent[]> => {
|
||||
const response = await apiClient.get('/scst/extents')
|
||||
return response.data.extents || []
|
||||
},
|
||||
|
||||
createExtent: async (extent: CreateExtentRequest): Promise<{ message: string }> => {
|
||||
const response = await apiClient.post('/scst/extents', extent)
|
||||
return response.data
|
||||
},
|
||||
|
||||
deleteExtent: async (deviceName: string): Promise<void> => {
|
||||
await apiClient.delete(`/scst/extents/${deviceName}`)
|
||||
},
|
||||
}
|
||||
|
||||
export interface SCSTExtent {
|
||||
handler_type: string
|
||||
device_name: string
|
||||
device_path: string
|
||||
is_in_use: boolean
|
||||
lun_count: number
|
||||
}
|
||||
|
||||
export interface CreateExtentRequest {
|
||||
device_name: string
|
||||
device_path: string
|
||||
handler_type: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user