@cryptotaxi247 / CoPilot / commits / 3a3d724b

added indices api

Davide Di Modica committed Aug 16, 2023 at 22:10 UTC 3a3d724b8f8ae26a70dd457c0ba167d9af2e730e
2 files changed +24 -1
src/api/index.ts
+3 -1
@@ -1,5 +1,7 @@
1 import connectors from "./connectors"
2 +import indices from "./indices"
3
4 export default {
4 - connectors
5 + connectors,
6 + indices
7 }
src/api/indices.ts new
+21
@@ -0,0 +1,21 @@
1 +import { FlaskBaseResponse } from "@/types/flask"
2 +import { HttpClient } from "./httpClient"
3 +import { ClusterHealth, Index, IndexAllocation, IndexShard } from "@/types/indices"
4 +
5 +export default {
6 + getAllocation() {
7 + return HttpClient.get<FlaskBaseResponse & { node_allocation: IndexAllocation[] }>("/wazuh_indexer/allocation")
8 + },
9 + getIndices() {
10 + return HttpClient.get<FlaskBaseResponse & { indices: Index[] }>("/wazuh_indexer/indices")
11 + },
12 + getShards() {
13 + return HttpClient.get<FlaskBaseResponse & { shards: IndexShard[] }>("/wazuh_indexer/shards")
14 + },
15 + getClusterHealth() {
16 + return HttpClient.get<FlaskBaseResponse & { cluster_health: ClusterHealth }>("/wazuh_indexer/health")
17 + },
18 + deleteIndex(index: string) {
19 + return HttpClient.delete<FlaskBaseResponse>(`/graylog/indices/${index}/delete`)
20 + }
21 +}