| 1 | import type { FlaskBaseResponse } from "@/types/flask.d" |
| 2 | import type { ConfigContent, DeployConfigResponse, UploadConfigFileResponse } from "@/types/sysmonConfig.d" |
| 3 | import { HttpClient } from "../httpClient" |
| 4 | |
| 5 | export default { |
| 6 | getAll() { |
| 7 | return HttpClient.get<FlaskBaseResponse & { customer_codes: string[] }>(`/sysmon_config`) |
| 8 | }, |
| 9 | getConfigContent(customerCode: string) { |
| 10 | return HttpClient.get<FlaskBaseResponse & ConfigContent>(`/sysmon_config/content/${customerCode}`) |
| 11 | }, |
| 12 | getConfigFile(customerCode: string) { |
| 13 | return HttpClient.get<Blob>(`/sysmon_config/${customerCode}`, { |
| 14 | responseType: "blob" |
| 15 | }) |
| 16 | }, |
| 17 | uploadConfigFile(customerCode: string, config: File) { |
| 18 | const form = new FormData() |
| 19 | form.append("file", new Blob([config], { type: config.type }), config.name) |
| 20 | form.append("customer_code", customerCode) |
| 21 | |
| 22 | return HttpClient.post<FlaskBaseResponse & UploadConfigFileResponse>(`/sysmon_config/upload`, form) |
| 23 | }, |
| 24 | deployConfig(customerCode: string) { |
| 25 | return HttpClient.post<FlaskBaseResponse & DeployConfigResponse>(`/sysmon_config/deploy/${customerCode}`) |
| 26 | } |
| 27 | } |