feat
This commit is contained in:
@@ -117,3 +117,70 @@ export const fetchSecurityMetricsLatest = (serviceIdentity: string) => {
|
||||
params: { service_identity: serviceIdentity },
|
||||
})
|
||||
}
|
||||
|
||||
/** 采集配置补丁参数 */
|
||||
export interface SecurityServicePatchData {
|
||||
collect_on?: boolean
|
||||
collect_interval?: number
|
||||
}
|
||||
|
||||
/** 采集配置补丁 */
|
||||
export const patchSecurityServiceCollect = (id: number, data: SecurityServicePatchData) => {
|
||||
return request.patch<{ code: number; message: string; details: { message: string } }>(`/DC-Control/v1/security/${id}/collect`, data)
|
||||
}
|
||||
|
||||
/** 告警聚合查询参数 */
|
||||
export interface SecurityMetricsAggregateParams {
|
||||
service_identity: string
|
||||
metric_name: string
|
||||
start_time: string
|
||||
end_time: string
|
||||
aggregation: 'avg' | 'max' | 'min' | 'sum' | 'count'
|
||||
}
|
||||
|
||||
/** 告警聚合值 */
|
||||
export interface SecurityMetricsAggregateData {
|
||||
metric_name: string
|
||||
aggregation: string
|
||||
value: number
|
||||
unit: string
|
||||
start_time: string
|
||||
end_time: string
|
||||
count: number
|
||||
}
|
||||
|
||||
/** 获取告警聚合值 */
|
||||
export const fetchSecurityMetricsAggregate = (params: SecurityMetricsAggregateParams) => {
|
||||
return request.get<{ code: number; message: string; details: SecurityMetricsAggregateData }>(
|
||||
'/DC-Control/v1/services/metrics/security/aggregate',
|
||||
{ params }
|
||||
)
|
||||
}
|
||||
|
||||
/** 安全设备类型映射 */
|
||||
export const SECURITY_TYPE_MAP: Record<string, string> = {
|
||||
firewall: '防火墙',
|
||||
waf: 'WAF',
|
||||
ids: 'IDS',
|
||||
ips: 'IPS',
|
||||
vpn: 'VPN',
|
||||
other: '其他',
|
||||
}
|
||||
|
||||
/** 安全设备类型选项 */
|
||||
export const SECURITY_TYPE_OPTIONS = [
|
||||
{ label: '防火墙', value: 'firewall' },
|
||||
{ label: 'WAF', value: 'waf' },
|
||||
{ label: 'IDS', value: 'ids' },
|
||||
{ label: 'IPS', value: 'ips' },
|
||||
{ label: 'VPN', value: 'vpn' },
|
||||
{ label: '其他', value: 'other' },
|
||||
]
|
||||
|
||||
/** 运行状态映射 */
|
||||
export const STATUS_MAP: Record<string, string> = {
|
||||
online: '在线',
|
||||
offline: '离线',
|
||||
error: '异常',
|
||||
unknown: '未知',
|
||||
}
|
||||
|
||||
@@ -148,3 +148,14 @@ export const fetchStorageMetricsLatest = (serviceIdentity: string) => {
|
||||
params: { service_identity: serviceIdentity },
|
||||
})
|
||||
}
|
||||
|
||||
/** 采集配置补丁 */
|
||||
export interface StoragePatchData {
|
||||
collect_on?: boolean
|
||||
collect_interval?: number
|
||||
}
|
||||
|
||||
/** 采集配置补丁更新 */
|
||||
export const patchStorage = (id: number, data: StoragePatchData) => {
|
||||
return request.patch<{ message: string }>(`/DC-Control/v1/storage/${id}/collect`, data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user