feat
This commit is contained in:
119
src/api/ops/security.ts
Normal file
119
src/api/ops/security.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
/** 安全设备服务项 */
|
||||
export interface SecurityServiceItem {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
service_identity: string
|
||||
oid: string
|
||||
server_identity: string
|
||||
name: string
|
||||
category: string
|
||||
type: string
|
||||
description: string
|
||||
enabled: boolean
|
||||
interval: number
|
||||
extra: string
|
||||
tags: string
|
||||
status_url: string
|
||||
agent_config: string
|
||||
collect_on: boolean
|
||||
collect_args: string
|
||||
collect_interval: number
|
||||
collect_last_result: string
|
||||
status: string
|
||||
status_code: number
|
||||
status_message: string
|
||||
response_time: number
|
||||
last_check_time: string
|
||||
last_online_time: string | null
|
||||
last_offline_time: string | null
|
||||
continuous_errors: number
|
||||
uptime: number
|
||||
}
|
||||
|
||||
/** 安全设备服务列表数据 */
|
||||
export interface SecurityServiceListData {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: SecurityServiceItem[]
|
||||
}
|
||||
|
||||
/** 安全设备服务列表响应参数 */
|
||||
export interface SecurityServiceListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
/** 创建/更新安全设备服务请求参数 */
|
||||
export interface SecurityServiceFormData {
|
||||
service_identity?: string
|
||||
oid?: string
|
||||
server_identity?: string
|
||||
name?: string
|
||||
category?: string
|
||||
type?: string
|
||||
description?: string
|
||||
enabled?: boolean
|
||||
interval?: number
|
||||
extra?: string
|
||||
tags?: string
|
||||
status_url?: string
|
||||
agent_config?: string
|
||||
collect_on?: boolean
|
||||
collect_args?: string
|
||||
collect_interval?: number
|
||||
policy_ids?: number[]
|
||||
}
|
||||
|
||||
/** 安全设备指标项 */
|
||||
export interface SecurityMetric {
|
||||
metric_name: string
|
||||
metric_value: number
|
||||
metric_unit: string
|
||||
}
|
||||
|
||||
/** 安全设备最新指标数据 */
|
||||
export interface SecurityMetricsLatestData {
|
||||
service_identity: string
|
||||
latest_timestamp: string | null
|
||||
count: number
|
||||
metrics: SecurityMetric[]
|
||||
}
|
||||
|
||||
/** 获取安全设备服务列表(分页) */
|
||||
export const fetchSecurityServiceList = (params?: SecurityServiceListParams) => {
|
||||
return request.get<{ code: number; message: string; details: SecurityServiceListData }>('/DC-Control/v1/security', { params })
|
||||
}
|
||||
|
||||
/** 获取安全设备服务详情 */
|
||||
export const fetchSecurityServiceDetail = (id: number) => {
|
||||
return request.get<{ code: number; message: string; details: SecurityServiceItem }>(`/DC-Control/v1/security/${id}`)
|
||||
}
|
||||
|
||||
/** 创建安全设备服务 */
|
||||
export const createSecurityService = (data: SecurityServiceFormData) => {
|
||||
return request.post<{ code: number; message: string; details: { message: string; id: number } }>('/DC-Control/v1/security', data)
|
||||
}
|
||||
|
||||
/** 更新安全设备服务 */
|
||||
export const updateSecurityService = (id: number, data: Partial<SecurityServiceFormData>) => {
|
||||
return request.put<{ code: number; message: string; details: { message: string } }>(`/DC-Control/v1/security/${id}`, data)
|
||||
}
|
||||
|
||||
/** 删除安全设备服务 */
|
||||
export const deleteSecurityService = (id: number) => {
|
||||
return request.delete<{ code: number; message: string; details: { message: string } }>(`/DC-Control/v1/security/${id}`)
|
||||
}
|
||||
|
||||
/** 获取最新时序指标 */
|
||||
export const fetchSecurityMetricsLatest = (serviceIdentity: string) => {
|
||||
return request.get<{ code: number; message: string; details: SecurityMetricsLatestData }>('/DC-Control/v1/security/metrics/latest', {
|
||||
params: { service_identity: serviceIdentity },
|
||||
})
|
||||
}
|
||||
150
src/api/ops/storage.ts
Normal file
150
src/api/ops/storage.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
/** 存储设备服务项 */
|
||||
export interface StorageItem {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
service_identity: string
|
||||
oid: string
|
||||
server_identity: string
|
||||
name: string
|
||||
category: string
|
||||
type: string
|
||||
description: string
|
||||
enabled: boolean
|
||||
interval: number
|
||||
extra: string
|
||||
tags: string
|
||||
status_url: string
|
||||
agent_config: string
|
||||
collect_on: boolean
|
||||
collect_args: string
|
||||
collect_interval: number
|
||||
collect_last_result: string
|
||||
status: string
|
||||
status_code: number
|
||||
status_message: string
|
||||
response_time: number
|
||||
last_check_time: string
|
||||
last_online_time: string | null
|
||||
last_offline_time: string | null
|
||||
continuous_errors: number
|
||||
uptime: number
|
||||
}
|
||||
|
||||
/** 存储设备列表响应 */
|
||||
export interface StorageListResponse {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: StorageItem[]
|
||||
}
|
||||
|
||||
/** 存储设备列表请求参数 */
|
||||
export interface StorageListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
/** 创建存储设备请求参数 */
|
||||
export interface StorageCreateData {
|
||||
service_identity: string
|
||||
name: string
|
||||
category?: string
|
||||
type: string
|
||||
oid?: string
|
||||
server_identity?: string
|
||||
description?: string
|
||||
enabled?: boolean
|
||||
interval?: number
|
||||
extra?: string
|
||||
tags?: string
|
||||
status_url?: string
|
||||
agent_config?: string
|
||||
collect_on?: boolean
|
||||
collect_args?: string
|
||||
collect_interval?: number
|
||||
policy_ids?: number[]
|
||||
}
|
||||
|
||||
/** 更新存储设备请求参数 */
|
||||
export interface StorageUpdateData {
|
||||
service_identity?: string
|
||||
oid?: string
|
||||
server_identity?: string
|
||||
name?: string
|
||||
category?: string
|
||||
type?: string
|
||||
description?: string
|
||||
enabled?: boolean
|
||||
interval?: number
|
||||
extra?: string
|
||||
tags?: string
|
||||
status_url?: string
|
||||
agent_config?: string
|
||||
collect_on?: boolean
|
||||
collect_args?: string
|
||||
collect_interval?: number
|
||||
collect_last_result?: string
|
||||
status?: string
|
||||
status_code?: number
|
||||
status_message?: string
|
||||
response_time?: number
|
||||
last_check_time?: string
|
||||
last_online_time?: string | null
|
||||
last_offline_time?: string | null
|
||||
continuous_errors?: number
|
||||
uptime?: number
|
||||
policy_ids?: number[]
|
||||
}
|
||||
|
||||
/** 指标项 */
|
||||
export interface StorageMetricItem {
|
||||
metric_name: string
|
||||
metric_value: number
|
||||
metric_unit: string
|
||||
}
|
||||
|
||||
/** 最新指标响应 */
|
||||
export interface StorageMetricsLatestResponse {
|
||||
service_identity: string
|
||||
latest_timestamp: string | null
|
||||
count: number
|
||||
metrics: StorageMetricItem[]
|
||||
}
|
||||
|
||||
/** 获取存储设备服务列表(匿名接口) */
|
||||
export const fetchStorageList = (params?: StorageListParams) => {
|
||||
return request.get<StorageListResponse>('/DC-Control/v1/storage', { params })
|
||||
}
|
||||
|
||||
/** 获取存储设备服务详情 */
|
||||
export const fetchStorageDetail = (id: number) => {
|
||||
return request.get<StorageItem>(`/DC-Control/v1/storage/${id}`)
|
||||
}
|
||||
|
||||
/** 创建存储设备服务 */
|
||||
export const createStorage = (data: StorageCreateData) => {
|
||||
return request.post<{ message: string; id: number }>('/DC-Control/v1/storage', data)
|
||||
}
|
||||
|
||||
/** 更新存储设备服务 */
|
||||
export const updateStorage = (id: number, data: StorageUpdateData) => {
|
||||
return request.put<{ message: string }>(`/DC-Control/v1/storage/${id}`, data)
|
||||
}
|
||||
|
||||
/** 删除存储设备服务 */
|
||||
export const deleteStorage = (id: number) => {
|
||||
return request.delete<{ message: string }>(`/DC-Control/v1/storage/${id}`)
|
||||
}
|
||||
|
||||
/** 查询最新一批时序指标 */
|
||||
export const fetchStorageMetricsLatest = (serviceIdentity: string) => {
|
||||
return request.get<StorageMetricsLatestResponse>('/DC-Control/v1/storage/metrics/latest', {
|
||||
params: { service_identity: serviceIdentity },
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user