| 1 | import type { FlaskBaseResponse } from "@/types/flask.d" |
| 2 | import type { SourceConfiguration, SourceName } from "@/types/incidentManagement/sources.d" |
| 3 | import { HttpClient } from "../../httpClient" |
| 4 | |
| 5 | export default { |
| 6 | getConfiguredSources() { |
| 7 | return HttpClient.get<FlaskBaseResponse & { sources: SourceName[] }>( |
| 8 | `/incidents/db_operations/configured/sources` |
| 9 | ) |
| 10 | }, |
| 11 | getAvailableMappings(indexName: string) { |
| 12 | return HttpClient.get<FlaskBaseResponse & { available_mappings: string[] }>( |
| 13 | `/incidents/db_operations/mappings/fields-assets-title-and-timefield`, |
| 14 | { |
| 15 | params: { index_name: indexName } |
| 16 | } |
| 17 | ) |
| 18 | }, |
| 19 | getSourceByIndex(indexName: string) { |
| 20 | return HttpClient.get<FlaskBaseResponse & { source: SourceName }>( |
| 21 | `/incidents/db_operations/available-source/${indexName}` |
| 22 | ) |
| 23 | }, |
| 24 | getAvailableIndices(source: SourceName) { |
| 25 | return HttpClient.get<FlaskBaseResponse & { indices: string[] }>( |
| 26 | `/incidents/db_operations/available-indices/${source}` |
| 27 | ) |
| 28 | }, |
| 29 | createSourceConfiguration(payload: SourceConfiguration) { |
| 30 | return HttpClient.post<FlaskBaseResponse>(`/incidents/db_operations/fields-assets-title-and-timefield`, payload) |
| 31 | }, |
| 32 | updateSourceConfiguration(payload: SourceConfiguration) { |
| 33 | return HttpClient.put<FlaskBaseResponse>(`/incidents/db_operations/fields-assets-title-and-timefield`, payload) |
| 34 | }, |
| 35 | getSourceConfiguration(source: SourceName) { |
| 36 | return HttpClient.get<FlaskBaseResponse & SourceConfiguration>( |
| 37 | `/incidents/db_operations/fields-assets-title-and-timefield`, |
| 38 | { |
| 39 | params: { source } |
| 40 | } |
| 41 | ) |
| 42 | }, |
| 43 | getSocfortressRecommendsWazuh() { |
| 44 | return HttpClient.get<FlaskBaseResponse & SourceConfiguration>( |
| 45 | `/incidents/db_operations/socfortress/recommends/wazuh` |
| 46 | ) |
| 47 | }, |
| 48 | deleteSourceConfiguration(source: SourceName) { |
| 49 | return HttpClient.delete<FlaskBaseResponse>(`/incidents/db_operations/configured/sources/${source}`) |
| 50 | } |
| 51 | } |